Exemple #1
0
 internal static ScriptCompilerBase CreateCompilerInstance(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater)
 {
     if (island._files.Length == 0)
     {
         throw new ArgumentException("Cannot compile MonoIsland with no files");
     }
     using (List <SupportedLanguage> .Enumerator enumerator = ScriptCompilers._supportedLanguages.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             SupportedLanguage current = enumerator.Current;
             if (current.GetExtensionICanCompile() == island.GetExtensionOfSourceFiles())
             {
                 return(current.CreateCompiler(island, buildingForEditor, targetPlatform, runUpdater));
             }
         }
     }
     throw new ApplicationException(string.Format("Unable to find a suitable compiler for sources with extension '{0}' (Output assembly: {1})", (object)island.GetExtensionOfSourceFiles(), (object)island._output));
 }
Exemple #2
0
        internal static string GetNamespace(string file)
        {
            if (string.IsNullOrEmpty(file))
            {
                throw new ArgumentException("Invalid file");
            }
            string extensionOfSourceFile = ScriptCompilers.GetExtensionOfSourceFile(file);

            using (List <SupportedLanguage> .Enumerator enumerator = ScriptCompilers._supportedLanguages.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SupportedLanguage current = enumerator.Current;
                    if (current.GetExtensionICanCompile() == extensionOfSourceFile)
                    {
                        return(current.GetNamespace(file));
                    }
                }
            }
            throw new ApplicationException("Unable to find a suitable compiler");
        }