Ejemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var assemblyNames = (AssemblyNamesCollection)this.Resources["AssemblyNames"];
            AssemblyCacheEnum assemblyCacheEnum = null;

            Action initialize = null;

            initialize = () =>
            {
                if (assemblyCacheEnum == null)
                {
                    assemblyCacheEnum = new AssemblyCacheEnum(null);
                }

                int    count = 5;
                string name  = null;
                while (count-- > 0 && (name = assemblyCacheEnum.GetNextAssembly()) != null)
                {
                    assemblyNames.Add(new AssemblyName(name));
                }

                if (name != null)
                {
                    Dispatcher.BeginInvoke(initialize);
                }
            };
            Dispatcher.BeginInvoke(initialize);
        }
Ejemplo n.º 2
0
        private void LoadAssemblies()
        {
            using (ProgressDialog progress = new ProgressDialog())
            {
                AssemblyCacheEnum asmEnum;

                progress.Title = "Load .NET Assemblies";
                progress.Line1 = "Please wait...";
                progress.ShowDialog(this, DialogFlags.Modal | DialogFlags.NoMinimize | DialogFlags.AutoTime | DialogFlags.MarqueeProgress | DialogFlags.NoCancel);
                Application.DoEvents();
                asmEnum = new AssemblyCacheEnum(null);
                while (true)
                {
                    string nextAsm = asmEnum.GetNextAssembly();

                    if (_ExitType != Exit.None)
                    {
                        break;
                    }
                    if (nextAsm != null)
                    {
                        string       info         = AssemblyCache.QueryAssemblyInfo(nextAsm);
                        AssemblyName assemblyName = AssemblyName.GetAssemblyName(info);

                        if (assemblyName.ProcessorArchitecture == ProcessorArchitecture.Amd64 && Is64Bit ||
                            assemblyName.ProcessorArchitecture == ProcessorArchitecture.IA64 && Is64Bit ||
                            assemblyName.ProcessorArchitecture == ProcessorArchitecture.X86 && !Is64Bit ||
                            assemblyName.ProcessorArchitecture == ProcessorArchitecture.MSIL)
                        {
                            ListViewItem item;

                            progress.Line2 = "Loading " + assemblyName.Name;
                            item           = AddAssembly(assemblyName);
                            if (ShouldExclude(assemblyName.Name))
                            {
                                item.BackColor = SystemColors.InactiveCaption;
                                item.Checked   = true;
                            }
                            Application.DoEvents();
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            _SaveReferences = true;
        }
Ejemplo n.º 3
0
        void FWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var assemblyCacheEnum = new AssemblyCacheEnum(null);
            var assemblyName      = assemblyCacheEnum.GetNextAssembly();

            while (assemblyName != null)
            {
                var details = assemblyName.Split(',');

                var shortName = details[0].Trim();
                var version   = details[1].Trim().Split('=')[1];

                FGacAssemblies.Add(new string[] { assemblyName, shortName, version });

                assemblyName = assemblyCacheEnum.GetNextAssembly();
            }
        }
Ejemplo n.º 4
0
        private static void InitIsSystemAssembly()
        {
            SystemAssemblies = new List <string>();

            AssemblyCacheEnum asmEnum = new AssemblyCacheEnum(null);
            string            nextAsm;

            while ((nextAsm = asmEnum.GetNextAssembly()) != null)
            {
                SystemAssemblies.Add(nextAsm.Split(',')[0]);
            }

            int count1 = SystemAssemblies.Count();

            SystemAssemblies = SystemAssemblies.Distinct().OrderBy(a => a).ToList();
            int count2 = SystemAssemblies.Count();
        }
            public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode)
            {
                List <string> ss = new List <string>();

                AssemblyCacheEnum ace = new AssemblyCacheEnum(null);
                string            s;

                s = ace.GetNextAssembly();
                while (!string.IsNullOrEmpty(s))
                {
                    ss.Add(s);
                    s = ace.GetNextAssembly();
                }
                ss.Sort();
                for (int i = 0; i < ss.Count; i++)
                {
                    parentNode.Nodes.Add(new TreeNodeAssembly(ss[i]));
                }
            }
Ejemplo n.º 6
0
        private static void InitIsSystemAssembly()
        {
            SystemAssemblies = new List <string>();

            AssemblyCacheEnum asmEnum = new AssemblyCacheEnum(null);
            string            nextAsm;

            while ((nextAsm = asmEnum.GetNextAssembly()) != null)
            {
                SystemAssemblies.Add(nextAsm.Split(',')[0]);
            }

            int count1 = SystemAssemblies.Count();

            SystemAssemblies = SystemAssemblies.Distinct().OrderBy(a => a).ToList();
            int count2 = SystemAssemblies.Count();

            ConsoleHelper.WriteLine($"Found {count1} GAC assemblies, {count2} unique names.", true);

            foreach (string gacass in SystemAssemblies)
            {
                ConsoleHelper.WriteLine($"'{gacass}'", true);
            }
        }
Ejemplo n.º 7
0
        private void GlobalAddRemove(string version)
        {
            bool install = false;

//      bool installed;

            //// Check to see if SQLite is installed in the GAC
            //try
            //{
            //  string file = AssemblyCache.QueryAssemblyInfo("System.Data.SQLite");
            //  installed = true;
            //}
            //catch
            //{
            //  installed = false;
            //}

            // Check to see if any checkboxes in the list are checked
            for (int n = 0; n < installList.Items.Count; n++)
            {
                if (installList.Items[n].Checked == true)
                {
                    install = true;
                    break;
                }
            }

            // If at least 1 item is checked, then install some global settings
            if (install)
            {
                string path = Path.GetDirectoryName(SQLiteLocation);

                foreach (string framework in _frameworks)
                {
                    using (RegistryKey key = Registry.LocalMachine.CreateSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework), RegistryKeyPermissionCheck.ReadWriteSubTree))
                    {
                        key.SetValue(null, path);
                    }
                }

                while (String.IsNullOrEmpty(path) == false)
                {
                    if (File.Exists(path + "\\CompactFramework\\System.Data.SQLite.DLL") == false)
                    {
                        path = Path.GetDirectoryName(path);
                    }
                    else
                    {
                        break;
                    }
                }

                if (String.IsNullOrEmpty(path) == false)
                {
                    path += "\\CompactFramework\\";

                    for (int n = 0; n < compactFrameworks.Length; n++)
                    {
                        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true))
                        {
                            if (key != null)
                            {
                                using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree))
                                {
                                    subkey.SetValue(null, path);
                                }
                            }
                        }
                    }

                    for (int n = 0; n < compactFrameworks.Length; n++)
                    {
                        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v3.5.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true))
                        {
                            if (key != null)
                            {
                                using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree))
                                {
                                    subkey.SetValue(null, path);
                                }
                            }
                        }
                    }
                }

                for (int n = 0; n < 2; n++)
                {
                    foreach (string framework in _frameworks)
                    {
                        // Add factory support to the machine.config file.
                        try
                        {
                            string      xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework));
                            XmlDocument xmlDoc      = new XmlDocument();
                            xmlDoc.PreserveWhitespace = true;
                            xmlDoc.Load(xmlFileName);


                            XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]");
                            if (xmlNode == null)
                            {
                                XmlNode xmlConfig = xmlDoc.SelectSingleNode("configuration");
                                if (xmlConfig != null)
                                {
                                    XmlNode xmlData = xmlConfig.SelectSingleNode("system.data");
                                    if (xmlData == null)
                                    {
                                        xmlData = xmlDoc.CreateNode(XmlNodeType.Element, "system.data", "");
                                        xmlConfig.AppendChild(xmlData);
                                    }
                                    XmlNode xmlParent = xmlData.SelectSingleNode("DbProviderFactories");
                                    if (xmlParent == null)
                                    {
                                        xmlParent = xmlDoc.CreateNode(XmlNodeType.Element, "DbProviderFactories", "");
                                        xmlData.AppendChild(xmlParent);
                                    }

                                    //xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "remove", "");
                                    //xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant"));
                                    //xmlParent.AppendChild(xmlNode);
                                    //xmlNode.Attributes.GetNamedItem("invariant").Value = "System.Data.SQLite";

                                    xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "add", "");
                                    xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("name"));
                                    xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant"));
                                    xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("description"));
                                    xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("type"));
                                    xmlParent.AppendChild(xmlNode);
                                }
                            }
                            xmlNode.Attributes.GetNamedItem("name").Value        = "SQLite Data Provider";
                            xmlNode.Attributes.GetNamedItem("invariant").Value   = "System.Data.SQLite";
                            xmlNode.Attributes.GetNamedItem("description").Value = ".Net Framework Data Provider for SQLite";
                            xmlNode.Attributes.GetNamedItem("type").Value        = "System.Data.SQLite.SQLiteFactory, " + SQLite.GetName().FullName;

                            xmlDoc.Save(xmlFileName);
                        }
                        catch
                        {
                        }
                    }
                }
            }
            else // No checkboxes are checked, remove some global settings
            {
                try
                {
                    foreach (string framework in _frameworks)
                    {
                        Registry.LocalMachine.DeleteSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework));
                    }

                    string[] versions = { "v2.0.0.0", "v3.5.0.0" };
                    for (int x = 0; x < versions.Length; x++)
                    {
                        for (int n = 0; n < compactFrameworks.Length; n++)
                        {
                            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\{1}\\{0}\\DataProviders", compactFrameworks[n], versions[x]), true))
                            {
                                try
                                {
                                    if (key != null)
                                    {
                                        key.DeleteSubKey(standardDataProviderGuid.ToString("B"));
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }

                    for (int n = 0; n < compactFrameworks.Length; n++)
                    {
                        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true))
                        {
                            try
                            {
                                if (key != null)
                                {
                                    key.DeleteSubKey("SQLite");
                                }
                            }
                            catch
                            {
                            }
                        }
                    }

                    for (int n = 0; n < 2; n++)
                    {
                        try
                        {
                            foreach (string framework in _frameworks)
                            {
                                // Remove any entries in the machine.config if they're still there
                                string      xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework));
                                XmlDocument xmlDoc      = new XmlDocument();
                                xmlDoc.PreserveWhitespace = true;
                                xmlDoc.Load(xmlFileName);

                                XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]");

                                if (xmlNode != null)
                                {
                                    xmlNode.ParentNode.RemoveChild(xmlNode);
                                }

                                xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]");
                                if (xmlNode != null)
                                {
                                    xmlNode.ParentNode.RemoveChild(xmlNode);
                                }

                                xmlDoc.Save(xmlFileName);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch
                {
                }
            }

            try
            {
                if (!install) // Remove SQLite from the GAC if its there
                {
                    AssemblyCacheUninstallDisposition disp;

                    string            s;
                    AssemblyCacheEnum entries = new AssemblyCacheEnum("System.Data.SQLite");
                    while (true)
                    {
                        s = entries.GetNextAssembly();
                        if (String.IsNullOrEmpty(s))
                        {
                            break;
                        }

                        AssemblyCache.UninstallAssembly(s, null, out disp);
                    }

                    entries = new AssemblyCacheEnum("SQLite.Designer");
                    while (true)
                    {
                        s = entries.GetNextAssembly();
                        if (String.IsNullOrEmpty(s))
                        {
                            break;
                        }

                        AssemblyCache.UninstallAssembly(s, null, out disp);
                    }

                    entries = new AssemblyCacheEnum("System.Data.SQLite.Linq");
                    while (true)
                    {
                        s = entries.GetNextAssembly();
                        if (String.IsNullOrEmpty(s))
                        {
                            break;
                        }

                        AssemblyCache.UninstallAssembly(s, null, out disp);
                    }

                    SQLite = null;
                }
                else // Install SQLite into the GAC
                {
                    byte[] cfdt     = Properties.Resources.System_Data_SQLite;
                    string tempPath = Path.GetTempPath();
                    tempPath = Path.Combine(tempPath, "System.Data.SQLite.DLL");
                    using (FileStream fs = File.Open(tempPath, FileMode.Create, FileAccess.Write, FileShare.None))
                    {
                        fs.Write(cfdt, 0, cfdt.Length);
                    }

                    try
                    {
                        AssemblyCache.InstallAssembly(tempPath, null, AssemblyCommitFlags.Default);
                        AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "x64\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default);
                        AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "itanium\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default);
                    }
                    catch
                    {
                    }
                    finally
                    {
                        File.Delete(tempPath);
                        if (File.Exists(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL")) == true)
                        {
                            AssemblyCache.InstallAssembly(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL"), null, AssemblyCommitFlags.Default);
                        }

                        AssemblyCache.InstallAssembly(Path.GetFullPath("SQLite.Designer.DLL"), null, AssemblyCommitFlags.Default);
                        AssemblyCache.InstallAssembly(SQLiteLocation, null, AssemblyCommitFlags.Default);
                    }
                }
            }
            catch
            {
                throw;
            }

            FixXmlLibPaths(install, version);
        }
Ejemplo n.º 8
0
        //The rules Visual Studio uses to resolve references are as follows:
        //1. Assemblies that are visible in the project as project items or links are considered.
        //   If Visual Studio .NET 2005 with MSBuild is being used, these must have a Build Action of Content or None.
        //2. Assemblies in Reference Path directories are considered.
        //   These are stored in .user files and are visible under project properties.
        //3. The HintPath of the reference is considered.
        //   This is a path to the referenced assembly (relative to the project).
        //   It is stored when the reference is originally created.
        //4. Assemblies in the native framework directory are considered
        //   (e.g., \Windows\Microsoft.NET\Framework\v1.1.4322 for Visual Studio .NET 2003).
        //5. Assemblies in the registered assembly folders are considered.
        //   These are the directories discussed in the last section about adding assemblies to the list of .NET assemblies.
        //   If Visual Studio .NET 2005 with MSBuild is being used,
        //   HKLM\Software\Microsoft\ .NETFramework\v2.x.xxxxx\AssemblyFoldersEx will be considered first.
        //6. If Visual Studio .NET 2005 with MSBuild is being used and the assembly has a strong name,
        //   Visual Studio will look in the GAC for the assembly.

        IExternalAssemblyModuleInfo loadExternalAssemblyModule2(
            IExternalAssemblyOwner externalAssemblyOwner,
            ExternalAssemblyReferenceInfo externalAssemblyReferenceInfo
            )
        {
            string path = null;

            if (externalAssemblyReferenceInfo.moduleFrom == null)
            {
                //load assembly
                //priority:
                //1.HintPath
                //2.include
                //3.NET Framework directories
                //4.AssemblyFoldersEx directories
                //5.GAC

                //Hint path
                path = getPathAndCheckExists(externalAssemblyOwner, externalAssemblyReferenceInfo.hintPath);

                //include
                if (path == null &&
                    externalAssemblyReferenceInfo.assemblyInfo == null)
                {
                    path = getPathAndCheckExists(externalAssemblyOwner, externalAssemblyReferenceInfo.include);
                }

                //reference path (.user file)
                if (path == null &&
                    externalAssemblyReferenceInfo.referencePath != null &&
                    externalAssemblyReferenceInfo.include != null &&
                    externalAssemblyReferenceInfo.include.Contains(".dll"))
                {
                    string s = Path.Combine(externalAssemblyReferenceInfo.referencePath, externalAssemblyReferenceInfo.include);
                    path = getPathAndCheckExists(externalAssemblyOwner, s);
                }

                //.NET Framework directories
                if (path == null &&
                    externalAssemblyReferenceInfo.assemblyInfo != null &&
                    externalAssemblyReferenceInfo.assemblyInfo.Name != null)
                {
                    string frameworkDir;

                    if (string.Equals(externalAssemblyReferenceInfo.assemblyInfo.ProcessorArchitecture, "X86", StringComparison.InvariantCultureIgnoreCase))
                    {
                        frameworkDir = @"C:\Windows\Microsoft.NET\Framework";
                    }
                    else if (string.Equals(externalAssemblyReferenceInfo.assemblyInfo.ProcessorArchitecture, "AMD64", StringComparison.InvariantCultureIgnoreCase))
                    {
                        frameworkDir = @"C:\Windows\Microsoft.NET\Framework64";
                    }
                    else
                    {
                        unsafe
                        {
                            if (sizeof(IntPtr) == 4)
                            {
                                frameworkDir = @"C:\Windows\Microsoft.NET\Framework";
                            }
                            else
                            {
                                frameworkDir = @"C:\Windows\Microsoft.NET\Framework64";
                            }
                        }
                    }

                    string          requiredTargetFramework = externalAssemblyReferenceInfo.solutionRequiredTargetFramework;
                    AssemblyVersion av;
                    if (requiredTargetFramework != null)
                    {
                        av = getMinAssemblyVersionFromRequiredTargetFramework(requiredTargetFramework);
                    }
                    else
                    {
                        switch (externalAssemblyReferenceInfo.vs_version)
                        {
                        case Metaspec.vs_version.vsv_vs2002:
                            av = new AssemblyVersion(1, 0, 0, 0);
                            break;

                        case Metaspec.vs_version.vsv_vs2003:
                            av = new AssemblyVersion(1, 1, 0, 0);
                            break;

                        case Metaspec.vs_version.vsv_vs2005:
                            av = new AssemblyVersion(2, 0, 0, 0);
                            break;

                        case Metaspec.vs_version.vsv_vs2008:
                            av = new AssemblyVersion(3, 5, 0, 0);
                            break;

                        case Metaspec.vs_version.vsv_vs2010:
                            av = new AssemblyVersion(4, 0, 0, 0);
                            break;

                        default:
                            av = new AssemblyVersion(0, 0, 0, 0);
                            break;
                        }
                    }
                    if (externalAssemblyReferenceInfo.assemblyInfo.Version > av)
                    {
                        av = externalAssemblyReferenceInfo.assemblyInfo.Version;
                    }

                    vs_version vs_version = externalAssemblyReferenceInfo.vs_version;
                    if (av.MajorVersion >= 4)
                    {
                        vs_version = Metaspec.vs_version.vsv_vs2010;
                    }
                    else if (av.MajorVersion >= 3 &&
                             av.MinorVersion >= 5)
                    {
                        vs_version = Metaspec.vs_version.vsv_vs2008;
                    }
                    else if (av.MajorVersion >= 2)
                    {
                        vs_version = Metaspec.vs_version.vsv_vs2005;
                    }
                    else if (av.MajorVersion >= 1 &&
                             av.MinorVersion >= 1)
                    {
                        vs_version = Metaspec.vs_version.vsv_vs2003;
                    }
                    else if (av.MajorVersion >= 1)
                    {
                        vs_version = Metaspec.vs_version.vsv_vs2002;
                    }

                    bool loadFromAssembliesFoldersFlag = false;

                    {
                        while (vs_version != vs_version.vsv_unknown)
                        {
                            string dotnetVersionDir = null;

                            dotnetVersionDir = GetNetVersionDirectory(vs_version);

                            if (dotnetVersionDir != null)
                            {
                                string s = Path.Combine(frameworkDir, dotnetVersionDir);
                                s    = Path.Combine(s, externalAssemblyReferenceInfo.assemblyInfo.Name + ".dll");
                                path = getPathAndCheckExists(externalAssemblyOwner, s);
                                if (path != null)
                                {
                                    break;
                                }
                            }

                            if (path == null &&
                                !loadFromAssembliesFoldersFlag)
                            {
                                //AssembliesFolders
                                path = LoadFromAssembliesFolders(externalAssemblyOwner, externalAssemblyReferenceInfo, vs_version);
                                if (path != null)
                                {
                                    break;
                                }
                                loadFromAssembliesFoldersFlag = true;
                            }

                            --vs_version;
                        }
                    }
                }

                //GAC
                if (path == null)
                {
                    if (externalAssemblyReferenceInfo.assemblyInfo != null)
                    {
                        List <BetterAssemblyInfo> betterAssemblyInfo = new List <BetterAssemblyInfo>();

                        AssemblyCacheEnum ace = new AssemblyCacheEnum(externalAssemblyReferenceInfo.assemblyInfo.Name);
                        bool presentInCache   = false;
                        while (true)
                        {
                            string s = ace.GetNextAssembly();
                            if (string.IsNullOrEmpty(s))
                            {
                                break;
                            }
                            presentInCache = true;

                            Metaspec.AssemblyInfo ai = Metaspec.AssemblyInfo.parse(s);

                            if (ai != null)
                            {
                                betterAssemblyInfo.Add(new BetterAssemblyInfo(ai, s));
                            }
                        }

                        string sAssemblyInfo = selectBetterAssembly(externalAssemblyReferenceInfo, betterAssemblyInfo);
                        if (sAssemblyInfo != null)
                        {
                            path = AssemblyCache.QueryAssemblyInfo(sAssemblyInfo);
                        }
                    }
                }

                //OutputPath
                if (path == null &&
                    externalAssemblyReferenceInfo.outputPath != null &&
                    (externalAssemblyReferenceInfo.assemblyInfo.Name != null ||
                     (externalAssemblyReferenceInfo.include != null) &&
                     externalAssemblyReferenceInfo.include.Contains(".dll")))
                {
                    if (externalAssemblyReferenceInfo.assemblyInfo.Name != null)
                    {
                        string s = Path.Combine(externalAssemblyReferenceInfo.outputPath, externalAssemblyReferenceInfo.assemblyInfo.Name + ".dll");
                        path = getPathAndCheckExists(externalAssemblyOwner, s);
                    }
                    if (path == null &&
                        externalAssemblyReferenceInfo.include != null &&
                        externalAssemblyReferenceInfo.include.Contains(".dll"))
                    {
                        string s = Path.Combine(externalAssemblyReferenceInfo.outputPath, externalAssemblyReferenceInfo.include);
                        path = getPathAndCheckExists(externalAssemblyOwner, s);
                    }
                }
            }
            else
            {
                //load module
                path = Path.GetDirectoryName(externalAssemblyReferenceInfo.moduleFrom.getPath());
                path = Path.Combine(path, externalAssemblyReferenceInfo.modulePath);
            }

            if (path == null ||
                !File.Exists(path))
            {
                return(null);
            }

            IExternalAssemblyModuleInfo module_info = new IExternalAssemblyModuleInfo();

            module_info.shared_assembly = true;

            string pathUpper = path.ToUpper();

            if (!modules.ContainsKey(pathUpper))
            {
                byte[] bytes = File.ReadAllBytes(path);
                IExternalAssemblyModule module = IExternalAssemblyModuleFactory.create(bytes, path);
                module_info.module = module;
                modules.Add(pathUpper, module);
            }
            else
            {
                module_info.module = modules[pathUpper];
            }

            return(module_info);
        }