コード例 #1
0
 private string WrapScriptOuterVB(string innerCode)
 {
     if (!string.IsNullOrEmpty(innerCode))
     {
         int num = 0;
         foreach (string importNamespace in _importNamespaces)
         {
             num += importNamespace.Length;
         }
         SRID   sRID       = SRID.ArrayOfNullIllegal;
         string @namespace = sRID.GetType().Namespace;
         string text       = string.Format(CultureInfo.InvariantCulture, "#ExternalSource (\"{0}\", 1)\nImports System\nImports System.Collections.Generic\nImports System.Diagnostics\nImports {1}\nImports {1}.Recognition\nImports {1}.Recognition.SrgsGrammar\n", new object[2]
         {
             "<Does Not Exist>",
             @namespace
         });
         StringBuilder stringBuilder = new StringBuilder(_script.Length + text.Length + 200);
         stringBuilder.Append(text);
         foreach (string importNamespace2 in _importNamespaces)
         {
             stringBuilder.Append("Imports ");
             stringBuilder.Append(importNamespace2);
             stringBuilder.Append("\n");
         }
         if (_namespace != null)
         {
             stringBuilder.Append("Namespace ");
             stringBuilder.Append(_namespace);
             stringBuilder.Append("\n");
         }
         stringBuilder.Append("#End ExternalSource\n");
         stringBuilder.Append(innerCode);
         if (_namespace != null)
         {
             stringBuilder.Append("End Namespace\n");
         }
         return(stringBuilder.ToString());
     }
     return(null);
 }
コード例 #2
0
 private string WrapScriptOuterCSharp(string innerCode)
 {
     if (!string.IsNullOrEmpty(innerCode))
     {
         int num = 0;
         foreach (string importNamespace in _importNamespaces)
         {
             num += importNamespace.Length;
         }
         SRID   sRID       = SRID.ArrayOfNullIllegal;
         string @namespace = sRID.GetType().Namespace;
         string text       = string.Format(CultureInfo.InvariantCulture, "#line 1 \"{0}\"\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing {1};\nusing {1}.Recognition;\nusing {1}.Recognition.SrgsGrammar;\n", new object[2]
         {
             "<Does Not Exist>",
             @namespace
         });
         StringBuilder stringBuilder = new StringBuilder(_script.Length + text.Length + 200);
         stringBuilder.Append(text);
         foreach (string importNamespace2 in _importNamespaces)
         {
             stringBuilder.Append("using ");
             stringBuilder.Append(importNamespace2);
             stringBuilder.Append(";\n");
         }
         if (_namespace != null)
         {
             stringBuilder.Append("namespace ");
             stringBuilder.Append(_namespace);
             stringBuilder.Append("\n{\n");
         }
         stringBuilder.Append(innerCode);
         if (_namespace != null)
         {
             stringBuilder.Append("}\n");
         }
         return(stringBuilder.ToString());
     }
     return(null);
 }