public string GetNamespaceNewRuntime(string filePath, string definedSymbols, string[] defines)
        {
            var definedSymbolSplit = definedSymbols.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            var uniqueSymbols      = defines.Union(definedSymbolSplit).Distinct().ToArray();

            return(CSharpNamespaceParser.GetNamespace(
                       ReadAndConverteNewLines(filePath).ReadToEnd(),
                       Path.GetFileNameWithoutExtension(filePath),
                       uniqueSymbols));
        }
Esempio n. 2
0
        public string GetNamespaceNewRuntime(string filePath, string[] definesSymbols, string[] rspDefines)
        {
            var uniqueSymbols = definesSymbols;

            if (rspDefines != null && rspDefines.Any())
            {
                uniqueSymbols = definesSymbols.Union(rspDefines).Distinct().ToArray();
            }

            return(CSharpNamespaceParser.GetNamespace(
                       ReadAndConverteNewLines(filePath).ReadToEnd(),
                       Path.GetFileNameWithoutExtension(filePath),
                       uniqueSymbols));
        }
Esempio n. 3
0
        public override void GetClassAndNamespace(string filePath, string definedSymbols,
                                                  out string outClassName, out string outNamespace)
        {
            var responseFilePath = Path.Combine("Assets", MicrosoftCSharpCompiler.ResponseFilename);
            var responseFileData = ScriptCompilerBase.ParseResponseFileFromFile(
                responseFilePath,
                Directory.GetParent(Application.dataPath).FullName,
                GetSystemReferenceDirectories(ApiCompatibilityLevel.NET_4_6));

            var definedSymbolSplit = definedSymbols.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            var uniqueSymbols      = responseFileData.Defines.Union(definedSymbolSplit).Distinct().ToArray();

            CSharpNamespaceParser.GetClassAndNamespace(ReadAndConverteNewLines(filePath).ReadToEnd(),
                                                       Path.GetFileNameWithoutExtension(filePath), out outClassName, out outNamespace, uniqueSymbols);
        }
Esempio n. 4
0
        public string GetNamespaceNewRuntime(string filePath, string definedSymbols)
        {
            var definedSymbolSplit = definedSymbols.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            string[] defines          = null;
            var      responseFilePath = Path.Combine("Assets", MonoCSharpCompiler.ReponseFilename);

            try
            {
                var responseFileData = ScriptCompilerBase.ParseResponseFileFromFile(responseFilePath);
                defines = new string[responseFileData.Defines.Length + definedSymbolSplit.Length];
                Array.Copy(definedSymbolSplit, defines, definedSymbolSplit.Length);
                Array.Copy(responseFileData.Defines, 0, defines, definedSymbolSplit.Length, responseFileData.Defines.Length);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }

            var uniqueSymbols = new HashSet <string>(defines ?? definedSymbolSplit);

            return(CSharpNamespaceParser.GetNamespace(ReadAndConverteNewLines(filePath).ReadToEnd(), Path.GetFileNameWithoutExtension(filePath), uniqueSymbols.ToArray()));
        }
Esempio n. 5
0
 public override void GetClassAndNamespace(string filePath, out string outClassName, out string outNamespace)
 {
     CSharpNamespaceParser.GetClassAndNamespace(ReadAndConverteNewLines(filePath).ReadToEnd(),
                                                Path.GetFileNameWithoutExtension(filePath), out outClassName, out outNamespace);
 }