Skip to content
Browse files

2008-06-18 Mike Kestner <mkestner@novell.com>

	* libsteticui/CecilWidgetLibrary.cs: remove timestamp code and reuse 
	cache currency logic. flatten out an unnecessary if branch in Load.

svn path=/trunk/stetic/; revision=106111
  • Loading branch information...
1 parent 9bf4411 commit 06649d33a86b2decb3ea858651de1f803d17d10d @mkestner mkestner committed Jun 18, 2008
Showing with 15 additions and 23 deletions.
  1. +5 −0 ChangeLog
  2. +10 −23 libsteticui/CecilWidgetLibrary.cs
View
5 ChangeLog
@@ -1,5 +1,10 @@
2008-06-18 Mike Kestner <mkestner@novell.com>
+ * libsteticui/CecilWidgetLibrary.cs: remove timestamp code and reuse
+ cache currency logic. flatten out an unnecessary if branch in Load.
+
+2008-06-18 Mike Kestner <mkestner@novell.com>
+
* libsteticui/Application.cs: remove dead code
2008-06-02 Mike Kestner <mkestner@novell.com>
View
33 libsteticui/CecilWidgetLibrary.cs
@@ -14,7 +14,6 @@ internal class CecilWidgetLibrary: WidgetLibrary
static LibraryCache cache = LibraryCache.Load ();
AssemblyDefinition assembly;
- DateTime timestamp;
string name;
string fileName;
XmlDocument objects;
@@ -40,10 +39,6 @@ public CecilWidgetLibrary (ImportContext importContext, string assemblyPath)
fileName = assemblyPath;
this.importContext = importContext;
- if (File.Exists (assemblyPath))
- timestamp = System.IO.File.GetLastWriteTime (assemblyPath);
- else
- timestamp = DateTime.MinValue;
ScanDependencies ();
}
@@ -104,7 +99,7 @@ void StoreCachedDescription ()
get {
if (!System.IO.File.Exists (fileName))
return false;
- return System.IO.File.GetLastWriteTime (fileName) != timestamp;
+ return cache.IsCurrent (fileName);
}
}
@@ -116,14 +111,8 @@ void StoreCachedDescription ()
get { return canGenerateCode; }
}
- public DateTime TimeStamp {
- get { return timestamp; }
- }
-
public override void Load ()
{
- // Assume that it can generate code
- canGenerateCode = true;
resolvedCache = new Hashtable ();
if (!fromCache) {
@@ -133,8 +122,6 @@ public override void Load ()
return;
}
- timestamp = System.IO.File.GetLastWriteTime (fileName);
-
assembly = AssemblyFactory.GetAssembly (fileName);
}
@@ -158,17 +145,17 @@ public override void Load ()
Load (objects);
- if (canGenerateCode) {
- // If it depends on libraries which can't generate code,
- // this one can't
- foreach (string dlib in GetLibraryDependencies ()) {
- WidgetLibrary lib = Registry.GetWidgetLibrary (dlib);
- if (lib != null && !lib.CanGenerateCode) {
- canGenerateCode = false;
- break;
- }
+ canGenerateCode = true;
+ // If it depends on libraries which can't generate code,
+ // this one can't
+ foreach (string dlib in GetLibraryDependencies ()) {
+ WidgetLibrary lib = Registry.GetWidgetLibrary (dlib);
+ if (lib != null && !lib.CanGenerateCode) {
+ canGenerateCode = false;
+ break;
}
}
+
if (!fromCache && objects != null) {
// Store dependencies in the cached xml
XmlElement elem = objects.CreateElement ("dependencies");

0 comments on commit 06649d3

Please sign in to comment.
Something went wrong with that request. Please try again.