Inheritance: IDisposable
Exemple #1
0
        public static void RegisterWidgetLibrary(WidgetLibrary library)
        {
            NotifyChanging();

            try
            {
                if (coreLib != null && library.Name == coreLib.Name)
                {
                    libraries.Remove(coreLib);
                    InternalUpdate();
                    coreLib = library;
                }
                libraries.Add(library);
                library.Load();
                classes.AddRange(library.AllClasses);
                UpdateGladeTransform();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
            finally
            {
                NotifyChanged();
            }
        }
Exemple #2
0
        void RegisterLibrary(AssemblyResolver resolver, Hashtable visited, WidgetLibrary lib)
        {
            if (lib == null || visited.Contains(lib.Name))
            {
                return;
            }

            visited [lib.Name] = lib;

            foreach (string s in lib.GetLibraryDependencies())
            {
                if (!Application.InternalIsWidgetLibrary(resolver, s))
                {
                    continue;
                }
                AddLibrary(resolver, visited, s);
            }

            try {
                Registry.RegisterWidgetLibrary(lib);
            } catch (Exception ex) {
                // Catch errors when loading a library to avoid aborting
                // the whole update method. After all, that's not a fatal
                // error (some widgets just won't be shown).
                // FIXME: return the error somewhere
                Console.WriteLine(ex);
            }
        }
Exemple #3
0
		public static void Initialize (WidgetLibrary coreLibrary)
		{
			RegisterWidgetLibrary (coreLibrary);
			
			coreLib = coreLibrary;
			
		}
        public override void Load()
        {
            canGenerateCode = true;

            RefreshFromCache();
            if (cache_info == null || !File.Exists(filename))
            {
                return;
            }

            assembly = AssemblyDefinition.ReadAssembly(filename);

            objects_dirty = false;
            Load(cache_info.ObjectsDocument);
            if (objects_dirty)
            {
                cache_info.WriteObjectsFile();
            }

            foreach (string dep in GetLibraryDependencies())
            {
                WidgetLibrary lib = Registry.GetWidgetLibrary(dep);
                if (lib != null && !lib.CanGenerateCode)
                {
                    canGenerateCode = false;
                }
            }
            assembly     = null;
            info_changed = false;
        }
Exemple #5
0
        WidgetLibrary AddLibrary(AssemblyResolver resolver, Hashtable visited, string s)
        {
            if (Registry.IsRegistered(s))
            {
                WidgetLibrary lib = Registry.GetWidgetLibrary(s);
                CheckDependencies(resolver, visited, lib);
                return(lib);
            }

            // Avoid registering direct references of libstetic
            if (Path.GetFileName(s) == "libstetic.dll" && s != coreLibrary)
            {
                return(null);
            }

            WidgetLibrary alib = CreateLibrary(resolver, s);

            if (alib == null)
            {
                return(null);
            }

            RegisterLibrary(resolver, visited, alib);
            return(alib);
        }
Exemple #6
0
		public static void UnregisterWidgetLibrary (WidgetLibrary library)
		{
			if (library == coreLib)
				return;

			NotifyChanging ();

			libraries.Remove (library);
			library.Dispose ();
			InternalUpdate ();

			NotifyChanged ();
		}
Exemple #7
0
        public static void UnregisterWidgetLibrary(WidgetLibrary library)
        {
            if (library == coreLib)
            {
                return;
            }

            NotifyChanging();

            libraries.Remove(library);
            InternalUpdate();

            NotifyChanged();
        }
Exemple #8
0
        public static void RegisterWidgetLibrary(WidgetLibrary library)
        {
            NotifyChanging();

            try {
                libraries.Add(library);
                library.Load();
                classes.AddRange(library.AllClasses);
                UpdateGladeTransform();
            } catch (Exception ex) {
                Console.WriteLine(ex);
                throw;
            } finally {
                NotifyChanged();
            }
        }
        void CheckDependencies(AssemblyResolver resolver, Hashtable visited, WidgetLibrary lib)
        {
            if (visited.Contains(lib.Name))
            {
                return;
            }

            visited [lib.Name] = lib;

//			foreach (string dep in lib.GetLibraryDependencies ()) {
//				WidgetLibrary depLib = Registry.GetWidgetLibrary (dep);
//				if (depLib == null)
//					AddLibrary (resolver, visited, dep);
//				else
//					CheckDependencies (resolver, visited, depLib);
//			}
        }
Exemple #10
0
        WidgetLibrary AddLibrary(AssemblyResolver resolver, Hashtable visited, string s)
        {
            if (Registry.IsRegistered(s))
            {
                WidgetLibrary lib = Registry.GetWidgetLibrary(s);
                CheckDependencies(resolver, visited, lib);
                return(lib);
            }

            WidgetLibrary alib = CreateLibrary(resolver, s);

            if (alib == null)
            {
                return(null);
            }

            RegisterLibrary(resolver, visited, alib);
            return(alib);
        }
Exemple #11
0
        public override void Load()
        {
            LibraryCache.LibraryInfo info = cache [name];

            objects_dirty = false;
            Load(info.ObjectsDocument);
            if (objects_dirty)
            {
                info.WriteObjectsFile();
            }

            canGenerateCode = true;
            foreach (string dep in GetLibraryDependencies())
            {
                WidgetLibrary lib = Registry.GetWidgetLibrary(dep);
                if (lib != null && !lib.CanGenerateCode)
                {
                    canGenerateCode = false;
                }
            }
        }
Exemple #12
0
		public static void RegisterWidgetLibrary (WidgetLibrary library)
		{
			NotifyChanging ();
			
			try {
				if (coreLib != null && library.Name == coreLib.Name) {
					libraries.Remove (coreLib);
					InternalUpdate ();
					coreLib = library;
				}
				libraries.Add (library);
				library.Load ();
				classes.AddRange (library.AllClasses);
				UpdateGladeTransform ();
			} catch (Exception ex) {
				Console.WriteLine (ex);
				throw;
			} finally {
				NotifyChanged ();
			}
		}
Exemple #13
0
        void CheckDependencies(AssemblyResolver resolver, Hashtable visited, WidgetLibrary lib)
        {
            if (visited.Contains(lib.Name) || lib.Name == coreLibrary)
            {
                return;
            }

            visited [lib.Name] = lib;

            foreach (string dep in lib.GetLibraryDependencies())
            {
                WidgetLibrary depLib = Registry.GetWidgetLibrary(dep);
                if (depLib == null)
                {
                    AddLibrary(resolver, visited, dep);
                }
                else
                {
                    CheckDependencies(resolver, visited, depLib);
                }
            }
        }
Exemple #14
0
 public static void Initialize(WidgetLibrary coreLibrary)
 {
     RegisterWidgetLibrary(coreLibrary);
     coreLib = coreLibrary;
 }
Exemple #15
0
		internal void SetLibrary (WidgetLibrary library)
		{
			this.library = library;
		}
Exemple #16
0
 public static bool IsRegistered(WidgetLibrary library)
 {
     return(libraries.Contains(library));
 }
Exemple #17
0
		public static bool IsRegistered (WidgetLibrary library)
		{
			return libraries.Contains (library);
		}
		void CheckDependencies (AssemblyResolver resolver, Hashtable visited, WidgetLibrary lib)
		{
			if (visited.Contains (lib.Name) || lib.Name == coreLibrary)
				return;
				
			visited [lib.Name] = lib;
			
			foreach (string dep in lib.GetLibraryDependencies ()) {
				WidgetLibrary depLib = Registry.GetWidgetLibrary (dep);
				if (depLib == null)
					AddLibrary (resolver, visited, dep);
				else
					CheckDependencies (resolver, visited, depLib);
			}
		}
 internal void SetLibrary(WidgetLibrary library)
 {
     this.library = library;
 }
		void CheckDependencies (AssemblyResolver resolver, Hashtable visited, WidgetLibrary lib)
		{
			if (visited.Contains (lib.Name))
				return;
				
			visited [lib.Name] = lib;
			
//			foreach (string dep in lib.GetLibraryDependencies ()) {
//				WidgetLibrary depLib = Registry.GetWidgetLibrary (dep);
//				if (depLib == null)
//					AddLibrary (resolver, visited, dep);
//				else
//					CheckDependencies (resolver, visited, depLib);
//			}
		}
		void RegisterLibrary (AssemblyResolver resolver, Hashtable visited, WidgetLibrary lib)
		{
			if (lib == null || visited.Contains (lib.Name))
				return;
				
			visited [lib.Name] = lib;

			foreach (string s in lib.GetLibraryDependencies ()) {
				if (!Application.InternalIsWidgetLibrary (resolver, s))
					continue;
				AddLibrary (resolver, visited, s);
			}
			
			try {
				Registry.RegisterWidgetLibrary (lib);
			} catch (Exception ex) {
				// Catch errors when loading a library to avoid aborting
				// the whole update method. After all, that's not a fatal
				// error (some widgets just won't be shown).
				// FIXME: return the error somewhere
				Console.WriteLine (ex);
			}
		}
Exemple #22
0
        public static void RegisterWidgetLibrary(WidgetLibrary library)
        {
            NotifyChanging ();

            try {
                libraries.Add (library);
                library.Load ();
                classes.AddRange (library.AllClasses);
                UpdateGladeTransform ();
            } catch (Exception ex) {
                Console.WriteLine (ex);
                throw;
            } finally {
                NotifyChanged ();
            }
        }