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

Last change on this file since 714 was 710, checked in by s10k, 12 years ago
File size: 2.2 KB
Line 
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 //long ticksThisTime = 0;
48 //System.Diagnostics.Stopwatch timePerParse = System.Diagnostics.Stopwatch.StartNew();
49
50
51
52 try
53 {
54 //We use a command parse library due to its advantages
55 CLAP.Parser.RunConsole<ParametersParser>(args);
56 }
57 catch (Exception e)
58 {
59 printAppError(appErrors.ERROR_PARAMS, "Error processing parameters:\n" + e.ToString());
60 }
61
62
63
64 //// Stop the timer, and save the
65 //// elapsed ticks for the operation.
66
67 //timePerParse.Stop();
68 //ticksThisTime = timePerParse.ElapsedTicks;
69 //Console.WriteLine(ticksThisTime);
70 //Console.ReadLine();
71 }
72 }
73}
Note: See TracBrowser for help on using the repository browser.