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