Beispiel #1
0
 internal void AddScript(string source, ScriptingLanguage lang, string ns, string fileName, int lineNumber)
 {
     XsltArgumentList.ValidateExtensionNamespace(ns);
     for (ScriptingLanguage langTmp = ScriptingLanguage.JScript; langTmp <= ScriptingLanguage.CSharp; langTmp++)
     {
         Hashtable typeDecls = _typeDeclsByLang[(int)langTmp];
         if (lang == langTmp)
         {
             CodeTypeDeclaration scriptClass = (CodeTypeDeclaration)typeDecls[ns];
             if (scriptClass == null)
             {
                 scriptClass = new CodeTypeDeclaration(GenerateUniqueClassName());
                 scriptClass.TypeAttributes = TypeAttributes.Public;
                 typeDecls.Add(ns, scriptClass);
             }
             CodeSnippetTypeMember scriptSnippet = new CodeSnippetTypeMember(source);
             if (lineNumber > 0)
             {
                 scriptSnippet.LinePragma = new CodeLinePragma(fileName, lineNumber);
             }
             scriptClass.Members.Add(scriptSnippet);
         }
         else if (typeDecls.Contains(ns))
         {
             throw new XsltException(Res.Xslt_ScriptMixLang);
         }
     }
 }