コード例 #1
0
        private void AddAssemblyReferences(Project project, string referenceFolder)
        {
            if (Mode == "IKVM")
            {
                project.AddAssemblyReference(referenceFolder + Path.DirectorySeparatorChar + "IKVM.GNU.Classpath.dll");
            }

            IDictionary references = options.GetKeys("References");

            UsingVisitor uv = new UsingVisitor();

            foreach (Source source in Sources.Values)
            {
                if (source.CodeFile && source.OutputFile.StartsWith(project.OutputFolder))
                {
                    uv.VisitCompilationUnit(source.CompilationUnit, null);
                }
            }
            IList added = new ArrayList();

            foreach (string key in uv.Usings.Keys)
            {
                foreach (DictionaryEntry entry in references)
                {
                    if (key.StartsWith(entry.Key.ToString()))
                    {
                        string[] assemblies = entry.Value.ToString().Split(',');
                        foreach (string assembly in assemblies)
                        {
                            if (added.Contains(assembly))
                            {
                                continue;
                            }
                            project.AddAssemblyReference(referenceFolder + Path.DirectorySeparatorChar + assembly + ".dll");
                            added.Add(assembly);
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Translator.cs プロジェクト: sourcewarehouse/janett
        private void AddAssemblyReferences(Project project, string referenceFolder)
        {
            if (Mode == "IKVM")
                project.AddAssemblyReference(referenceFolder + Path.DirectorySeparatorChar + "IKVM.GNU.Classpath.dll");

            IDictionary references = options.GetKeys("References");

            UsingVisitor uv = new UsingVisitor();
            foreach (Source source in Sources.Values)
            {
                if (source.CodeFile && source.OutputFile.StartsWith(project.OutputFolder))
                    uv.VisitCompilationUnit(source.CompilationUnit, null);
            }
            IList added = new ArrayList();
            foreach (string key in uv.Usings.Keys)
            {
                foreach (DictionaryEntry entry in references)
                {
                    if (key.StartsWith(entry.Key.ToString()))
                    {
                        string[] assemblies = entry.Value.ToString().Split(',');
                        foreach (string assembly in assemblies)
                        {
                            if (added.Contains(assembly))
                                continue;
                            project.AddAssemblyReference(referenceFolder + Path.DirectorySeparatorChar + assembly + ".dll");
                            added.Add(assembly);
                        }
                    }
                }
            }
        }