GetWidgetLibrary() 공개 정적인 메소드

public static GetWidgetLibrary ( string name ) : WidgetLibrary
name string
리턴 WidgetLibrary
예제 #1
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);
        }
        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;
        }
예제 #3
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);
        }
예제 #4
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;
                }
            }
        }
예제 #5
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);
                }
            }
        }
예제 #6
0
        public bool UpdateLibraries(ArrayList libraries, ArrayList projects, bool allowBackendRestart, bool forceUnload)
        {
            try {
                Registry.BeginChangeSet();

                libraries.Add(Registry.CoreWidgetLibrary.Name);

                // Notify libraries that need to be unloaded and loaded again

                foreach (WidgetLibrary lib in Registry.RegisteredWidgetLibraries)
                {
                    if (lib.NeedsReload)
                    {
                        appFrontend.NotifyLibraryUnloaded(lib.Name);
                    }
                }

                if (!Registry.ReloadWidgetLibraries() && allowBackendRestart)
                {
                    return(false);
                }

                // Store a list of registered libraries, used later to know which
                // ones need to be unloaded

                ArrayList loaded = new ArrayList();
                foreach (WidgetLibrary alib in Registry.RegisteredWidgetLibraries)
                {
                    loaded.Add(alib.Name);
                }

                // Load required libraries

                Hashtable visited = new Hashtable();
                LoadLibraries(new AssemblyResolver(this), visited, libraries);

                foreach (ProjectBackend project in projects)
                {
                    LoadLibraries(project.Resolver, visited, project.WidgetLibraries);
                }

                // Unload libraries which are not required

                foreach (string name in loaded)
                {
                    if (!visited.Contains(name))
                    {
                        if (forceUnload && allowBackendRestart)
                        {
                            return(false);
                        }
                        appFrontend.NotifyLibraryUnloaded(name);
                        Registry.UnregisterWidgetLibrary(Registry.GetWidgetLibrary(name));
                    }
                }

                return(true);
            }
            finally {
                Registry.EndChangeSet();
            }
        }