| 1 | 
   | 
 using System; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 2 | 
   | 
 using System.Collections.Generic; | 
 
 
 
 
 
 
 
 
 
 | 3 | 
 – | 
 using System.Text; | 
 
 
 
 
 
 
 
 
 
 | 4 | 
 – | 
 using System.Xml; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 | 
   | 
 using System.IO; | 
 
 
 
 
 
 
 
 
 
 
 
 | 4 | 
 < | 
 using System.Globalization; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
 < | 
 using System.Text.RegularExpressions; | 
 
 
 
 
 
 
 
 
 
 | 4 | 
 > | 
 using System.Text; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 5 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 6 | 
   | 
 namespace xmlTools | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 8 | 
   | 
     class Program | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 9 | 
   | 
     { | 
 
 
 
 
 
 
 
 
 
 
 
 | 10 | 
 < | 
         public static readonly string toolsVersion = "0.8g"; | 
 
 
 
 
 
 
 
 
 
 | 10 | 
 > | 
         public const string XmlToolsVersion = "0.9"; // const variable are by default static | 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
   | 
         private static appErrors lastError = appErrors.NO_ERROR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 13 | 
   | 
         public enum appErrors | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 | 
   | 
             PATCH_COMMAND_PROCESS_ERROR = 202, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 | 
   | 
             PATCH_ELEMENT_NOT_FOUND = 203, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 30 | 
   | 
             PATCH_ADDTO_ERROR_PARSING_XML = 204, | 
 
 
 
 
 
 
 
 
 
 
 
 | 31 | 
 < | 
             PATCH_COMMAND_NOT_FOUND = 205 | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 31 | 
 > | 
             PATCH_COMMAND_NOT_FOUND = 205, | 
 
 
 
 
 
 | 32 | 
 > | 
             PATCH_CODE_PROCESS_ERROR=206, | 
 
 
 
 
 
 | 33 | 
 > | 
             PATCH_CODE_NOT_FOUND=207, | 
 
 
 
 
 
 | 34 | 
 > | 
             PATCH_CODE_PARSE_XML_OUTPUT_ERROR=208, | 
 
 
 
 
 
 
 
 
 
 
 
 | 35 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 36 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 | 
   | 
         public static void printAppError(appErrors error, string description, bool exitApp = false) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 48 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 49 | 
   | 
         public static int Main(string[] args) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 50 | 
   | 
         { | 
 
 
 
 
 
 
 
 
 | 51 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 52 | 
   | 
             try | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 53 | 
   | 
             { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 54 | 
   | 
                 //We use a command parse library due to its advantages |