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

Comparing xmlTools/trunk/posUpdate/ParametersParser.cs (file contents):
Revision 742 by s10k, Tue Mar 26 02:30:48 2013 UTC vs.
Revision 867 by s10k, Thu May 9 10:37:17 2013 UTC

# Line 11 | Line 11 | namespace xmlTools
11      // Define a class to receive parsed values
12      class ParametersParser
13      {
14 <        private static string globalFileName="";
15 <        private static string globalElement="";
16 <        private static string globalParentElement="";
14 >        private static string globalFileName = "";
15 >        private static string globalElement = "";
16 >        private static string globalParentElement = "";
17          private static bool globalNoBackups = false;
18  
19          [Verb]
# Line 50 | Line 50 | namespace xmlTools
50          public static void updateChainValues(
51              [Parameter(Required = true, Description = "The new first value of the chain. All the chain will be updated based on this value")] string newValue,
52              [Parameter(Description = "Value which have some kind of relation with -newVal \n Together with -newVal updates all the values based on the" +
53 <                "-newVal and another position specified on -valRelation parameter (basically starts with (newVal-valRelation) ) Is especially useful when" +
53 >                "-newvalue and another position specified on -valrelation parameter (basically starts with (newvalue-valrelation) ) Is especially useful when" +
54                  "updating multiple related chains (on different files), like multiple objects from one position to another. Don't use with -filename, because" +
55 <                "it will only update one file. \nExample: xmlTools.exe -newVal \"1 1 1\" -valRelation \"4 4 4\" -valElement Translation -valParentElement" +
55 >                "it will only update one file. \nExample: xmlTools.exe updatechainvalues -filename:OBANheli_body_center.xml -newvalue:\"1 1 1\" -valrelation:\"4 4 4\" -element:Translation -parelement:" +
56                  "OBANKeyFrame")] string valRelation,
57 <            [Parameter(Description = "Only update specific positions. Positions starts with 0, separted multiple positions with space. Example: valPositions=0 1 4")] [MoreThan(-1)]  string valPositions
57 >            [Parameter(Description = "Only update specific positions. Positions starts with 0, separted multiple positions with space. Example: valpositions=\"0 1 4\"")] [MoreThan(-1)]  string valPositions
58              )
59          {
60              initialChecks();
# Line 106 | Line 106 | namespace xmlTools
106              List<string> filesToProcess = getFilesToProcess(globalFileName);
107              foreach (string currentFile in filesToProcess)
108              {
109 <                if (valPositions != null)
109 >                if (!String.IsNullOrEmpty(valPositions))
110                  {
111                      myTools.replaceAll(currentFile, value, valPositions);
112                  }
# Line 129 | Line 129 | namespace xmlTools
129          {
130              XmlPatch myPatch;
131  
132 <            if (forceInFiles != "")
132 >            if (!String.IsNullOrEmpty(forceInFiles))
133              {
134                  myPatch = new XmlPatch(globalFileName, forceInFiles, globalNoBackups);
135              }
# Line 148 | Line 148 | namespace xmlTools
148              Console.WriteLine("\nWritten by s10k");
149          }
150  
151 +        [Verb]
152 +        public static void showErrTypes()
153 +        {
154 +            Array values = Enum.GetValues(typeof(Program.appErrors));
155 +
156 +            foreach (Program.appErrors val in values)
157 +            {
158 +                Console.WriteLine(Enum.GetName(typeof(Program.appErrors),val) + " : " + (int)val);
159 +            }
160 +        }
161 +
162          // Global Parameters
163          [Global(Description = "Filename to apply the operations (with patchFile specifies the patch filename). Wildcards accepted for multiple files. No filename = search all .xml files in current path.")]
164          public static void fileName(
# Line 184 | Line 195 | namespace xmlTools
195          {
196              List<String> filesToProccess = new List<String>();
197  
198 <            if (filename == "") // No filename? Process everything xml file found.
198 >            if (String.IsNullOrEmpty(filename)) // No filename? Process everything xml file found.
199              {
200                  List<string> allXmlFiles = Util.getAllXmlFiles();
201                  foreach (String file in allXmlFiles)

Diff Legend

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