示例#1
0
        public NameResolutionPath GetNameResolutionPath(LoadedLibrary systemLibrary)
        {
            if (_nameResolutionPath == null)
            {
                /* Depth first traversal, tracking level, add every unique required library at the level corresponding to the depth of the library in the dependency graph */
                _nameResolutionPath = new NameResolutionPath();
                GetNameResolutionPath(_nameResolutionPath, 0, this);

                /* Remove all levels with no libraries */
                for (int index = _nameResolutionPath.Count - 1; index >= 0; index--)
                {
                    if (_nameResolutionPath[index].Count == 0)
                    {
                        _nameResolutionPath.RemoveAt(index);
                    }
                }

                /* Ensure that system is in the path */
                if (!_nameResolutionPath.Contains(systemLibrary))
                {
                    _nameResolutionPath.Add(new Schema.LoadedLibraries());
                    _nameResolutionPath[_nameResolutionPath.Count - 1].Add(systemLibrary);
                }
            }

            return(_nameResolutionPath);
        }
示例#2
0
        public SettingsList RegisterAssembly(LoadedLibrary library, Assembly assembly)
        {
            lock (_assemblies)
            {
                try
                {
                    RegisteredAssembly localAssembly = new RegisteredAssembly(assembly, library);
                    if (!_assemblies.Contains(assembly.FullName))
                    {
                        SettingsList classes = GetClassList(assembly);
                        foreach (SettingsItem setting in classes.Values)
                        {
                            RegisteredClass classValue = new RegisteredClass(setting.Name, library, localAssembly, setting.Value);
                            _classes.Add(classValue);
                        }
                        _assemblies.Add(localAssembly);
                        return(classes);
                    }

                    return(new SettingsList());
                }
                catch
                {
                    UnregisterAssembly(library, assembly);
                    throw;
                }
            }
        }
示例#3
0
 public bool Contains(LoadedLibrary library)
 {
     for (int index = 0; index < Count; index++)
     {
         if (this[index].Contains(library))
         {
             return(true);
         }
     }
     return(false);
 }
示例#4
0
 /// <summary>Returns true if ALibrary is the same as this library, or is required by this library.</summary>
 public bool IsRequiredLibrary(LoadedLibrary library)
 {
     if (this.Equals(library))
     {
         return(true);
     }
     foreach (LoadedLibrary localLibrary in _requiredLibraries)
     {
         if (localLibrary.IsRequiredLibrary(library))
         {
             return(true);
         }
     }
     return(false);
 }
示例#5
0
        public SettingsList UnregisterAssembly(LoadedLibrary library, Assembly assembly)
        {
            lock (_assemblies)
            {
                SettingsList classes = GetClassList(assembly);
                foreach (SettingsItem setting in classes.Values)
                {
                    if (_classes.Contains(setting.Name))
                    {
                        Schema.RegisteredClass classValue = _classes[setting.Name];
                        _classes.RemoveAt(_classes.IndexOf(setting.Name));
                    }
                }

                int index = _assemblies.IndexOf(assembly.FullName);
                if (index >= 0)
                {
                    _assemblies.RemoveAt(index);
                }

                return(classes);
            }
        }
示例#6
0
 public RegisteredClass(string name, LoadedLibrary library, RegisteredAssembly assembly, string className) : base(name)
 {
     _library   = library;
     _assembly  = assembly;
     _className = className;
 }
示例#7
0
 public RegisteredAssembly(Assembly assembly, LoadedLibrary library) : base()
 {
     _name     = assembly.FullName;
     _assembly = assembly;
     _library  = library;
 }