예제 #1
0
 void ProcessText(StringBuilder sb, ConfigItem item)
 {
     if (item.replaceSessionContext)
     {
         // TODO:
         sb.Replace("default(cast(session_context(N'TenantId') as int))", "default(1)");
     }
     if (String.IsNullOrEmpty(item.remove))
     {
         return;
     }
     while (true)
     {
         var   sx   = sb.ToString();
         Int32 fPos = sx.IndexOf($"/*{item.remove.ToUpperInvariant()}=FALSE*/");
         if (fPos == -1)
         {
             return;
         }
         Int32 lPos = sx.IndexOf("go", fPos);
         sb.Remove(fPos, lPos - fPos + 2);
     }
 }
예제 #2
0
        void ProcessOneItem(ConfigItem item)
        {
            String outFilePath = Path.Combine(_path, item.outputFile);

            File.Delete(outFilePath);
            var nl = Environment.NewLine;

            using (var fw = File.Open(outFilePath, FileMode.CreateNew, FileAccess.Write))
            {
                Console.WriteLine($"Writing {item.outputFile}");
                using (var sw = new StreamWriter(fw))
                {
                    sw.Write($"{nl}{nl}/* {item.outputFile} */{nl}{nl}");
                    foreach (var f in item.inputFiles)
                    {
                        var inputPath = Path.Combine(_path, f);
                        Console.WriteLine($"\t{f}");
                        var inputText = File.ReadAllText(inputPath);
                        sw.Write(inputText);
                    }
                }
            }
        }