Наследование: SupportedLanguage
Пример #1
0
 public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater)
 {
     if (CSharpLanguage.GetUseMicrosoftCSharpCompiler(targetPlatform, buildingForEditor, island._output))
     {
         return(new MicrosoftCSharpCompiler(island, runUpdater));
     }
     return(new MonoCSharpCompiler(island, runUpdater));
 }
Пример #2
0
        public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater)
        {
            switch (CSharpLanguage.GetCSharpCompiler(targetPlatform, buildingForEditor, island._output))
            {
            case CSharpCompiler.Microsoft:
                return((ScriptCompilerBase) new MicrosoftCSharpCompiler(island, runUpdater));

            default:
                return((ScriptCompilerBase) new MonoCSharpCompiler(island, runUpdater));
            }
        }
Пример #3
0
        public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater)
        {
            CSharpCompiler     cSharpCompiler = CSharpLanguage.GetCSharpCompiler(targetPlatform, buildingForEditor, island._output);
            ScriptCompilerBase result;

            if (cSharpCompiler != CSharpCompiler.Microsoft)
            {
                if (cSharpCompiler != CSharpCompiler.Mono)
                {
                }
                result = new MonoCSharpCompiler(island, runUpdater);
            }
            else
            {
                result = new MicrosoftCSharpCompiler(island, runUpdater);
            }
            return(result);
        }
Пример #4
0
        public override string GetNamespace(string fileName, string definedSymbols)
        {
            string result;

            using (IParser parser = ParserFactory.CreateParser(ICSharpCode.NRefactory.SupportedLanguage.CSharp, CSharpLanguage.ReadAndConverteNewLines(fileName)))
            {
                HashSet <string> hashSet = new HashSet <string>(definedSymbols.Split(new char[]
                {
                    ','
                }, StringSplitOptions.RemoveEmptyEntries));
                foreach (string current in hashSet)
                {
                    parser.Lexer.ConditionalCompilationSymbols.Add(current, string.Empty);
                }
                parser.Lexer.EvaluateConditionalCompilation = true;
                parser.Parse();
                try
                {
                    CSharpLanguage.NamespaceVisitor visitor     = new CSharpLanguage.NamespaceVisitor();
                    CSharpLanguage.VisitorData      visitorData = new CSharpLanguage.VisitorData
                    {
                        TargetClassName = Path.GetFileNameWithoutExtension(fileName)
                    };
                    parser.CompilationUnit.AcceptVisitor(visitor, visitorData);
                    result = ((!string.IsNullOrEmpty(visitorData.DiscoveredNamespace)) ? visitorData.DiscoveredNamespace : string.Empty);
                    return(result);
                }
                catch
                {
                }
            }
            result = string.Empty;
            return(result);
        }