source: xmlTools/trunk/posUpdate/Program.cs@ 723

Last change on this file since 723 was 718, checked in by s10k, 12 years ago

reverted the no backup test

File size: 1.8 KB
RevLine 
[710]1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Xml;
5using System.IO;
6using System.Globalization;
7using System.Text.RegularExpressions;
8
9namespace xmlTools
10{
11 class Program
12 {
13 public static readonly string toolsVersion = "0.7d";
14
15 public enum appErrors
16 {
17 // 0-19 Errors with input parameters
18 ERROR_PARAMS = 0,
19 FILE_NOT_FOUND = 1,
20 ELEMENT_NOT_SPECIFIED=2,
21 ELEMENT_NOT_FOUND=3,
22 // 20-199 General application errors
23 BACKUPS_ALREADY_EXISTS=20,
24 NUMBER_VALUES_TO_REPLACE_NE_AVAILABLE_VALUES = 21,
25 INVALID_POSITIONS_RANGE=22,
26 // 200-299 Patch operations errors
27 PATCH_ADDTO_PROCESS_ERROR = 200,
28 PATCH_REMOVE_PROCESS_ERROR = 201,
29 PATCH_COMMAND_PROCESS_ERROR=202,
30 PATCH_ELEMENT_NOT_FOUND=203,
31 PATCH_ADDTO_ERROR_PARSING_XML=204,
32 PATCH_COMMAND_NOT_FOUND=205
33 }
34
35 public static void printAppError(appErrors error, string description, bool exitApp=false){
36 Console.Error.WriteLine("Error Code: "+(int)error);
37 Console.Error.WriteLine(description);
38
39 if (exitApp)
40 {
41 Environment.Exit(1);
42 }
43 }
44
45 static void Main(string[] args)
46 {
47 try
48 {
49 //We use a command parse library due to its advantages
50 CLAP.Parser.RunConsole<ParametersParser>(args);
51 }
52 catch (Exception e)
53 {
54 printAppError(appErrors.ERROR_PARAMS, "Error processing parameters:\n" + e.ToString());
55 }
56 }
57 }
58}
Note: See TracBrowser for help on using the repository browser.