ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/xmlTools/trunk/posUpdate/Program.cs
(Generate patch)

Comparing xmlTools/trunk/posUpdate/Program.cs (file contents):
Revision 743 by s10k, Tue Mar 26 10:39:19 2013 UTC vs.
Revision 745 by s10k, Tue Mar 26 15:04:38 2013 UTC

# Line 10 | Line 10 | namespace xmlTools
10   {
11      class Program
12      {
13 <        public static readonly string toolsVersion = "0.8a";
13 >        public static readonly string toolsVersion = "0.8b";
14 >        private static appErrors lastError;
15  
16          public enum appErrors
17          {
18 <            // 0-19 Errors with input parameters
19 <            ERROR_PARAMS = 0,
20 <            FILE_NOT_FOUND = 1,
21 <            ELEMENT_NOT_SPECIFIED=2,
22 <            ELEMENT_NOT_FOUND=3,
18 >            // 1-19 Errors with input parameters
19 >            ERROR_PARAMS = 1,
20 >            FILE_NOT_FOUND = 2,
21 >            ELEMENT_NOT_SPECIFIED=3,
22 >            ELEMENT_NOT_FOUND=4,
23              // 20-199 General application errors
24              BACKUPS_ALREADY_EXISTS=20,
25              NUMBER_VALUES_TO_REPLACE_NE_AVAILABLE_VALUES = 21,
# Line 35 | Line 36 | namespace xmlTools
36          public static void printAppError(appErrors error, string description, bool exitApp=false){
37              Console.Error.WriteLine("Error Code: "+(int)error);
38              Console.Error.WriteLine(description);
39 <            
39 >
40              if (exitApp)
41              {
42                  Environment.Exit(1);
43              }
44 +
45 +            lastError = error;
46          }
47  
48 <        public static void Main(string[] args)
48 >        public static int Main(string[] args)
49          {
50              try
51              {
52                  //We use a command parse library due to its advantages
53                  CLAP.Parser.RunConsole<ParametersParser>(args);
54 +                return (int)lastError;
55              }
56              catch (Exception e)
57              {
58                  printAppError(appErrors.ERROR_PARAMS, "Error processing parameters:\n" + e.ToString());
59 +                return (int)appErrors.ERROR_PARAMS;
60              }
61          }
62      }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)