InternalIsWidgetLibrary() static private method

static private InternalIsWidgetLibrary ( AssemblyResolver resolver, string assemblyRef ) : bool
resolver AssemblyResolver
assemblyRef string
return bool
Beispiel #1
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);
            }
        }
Beispiel #2
0
        void AddDependencies(XmlElement elem, AssemblyResolver resolver, string filename, AssemblyDefinition asm)
        {
            string dir = Path.GetDirectoryName(filename);

            foreach (AssemblyNameReference aref in asm.MainModule.AssemblyReferences)
            {
                string file = null;
                if (resolver != null)
                {
                    resolver.Resolve(aref.FullName, dir);
                }
                if (file != null && Application.InternalIsWidgetLibrary(resolver, file))
                {
                    XmlElement edep = elem.OwnerDocument.CreateElement("dependency");
                    edep.InnerText = file;
                    elem.AppendChild(edep);
                }
            }
        }