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));
        }
Exemple #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));
        }
        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()));
        }