Changeset 745
- Timestamp:
- Mar 26, 2013, 4:04:38 PM (12 years ago)
- Location:
- xmlTools/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
xmlTools/trunk/posUpdate/Program.cs
r743 r745 11 11 class Program 12 12 { 13 public static readonly string toolsVersion = "0.8a"; 13 public static readonly string toolsVersion = "0.8b"; 14 private static appErrors lastError; 14 15 15 16 public enum appErrors 16 17 { 17 // 0-19 Errors with input parameters18 ERROR_PARAMS = 0,19 FILE_NOT_FOUND = 1,20 ELEMENT_NOT_SPECIFIED= 2,21 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, 22 23 // 20-199 General application errors 23 24 BACKUPS_ALREADY_EXISTS=20, … … 36 37 Console.Error.WriteLine("Error Code: "+(int)error); 37 38 Console.Error.WriteLine(description); 38 39 39 40 if (exitApp) 40 41 { 41 42 Environment.Exit(1); 42 43 } 44 45 lastError = error; 43 46 } 44 47 45 public static voidMain(string[] args)48 public static int Main(string[] args) 46 49 { 47 50 try … … 49 52 //We use a command parse library due to its advantages 50 53 CLAP.Parser.RunConsole<ParametersParser>(args); 54 return (int)lastError; 51 55 } 52 56 catch (Exception e) 53 57 { 54 58 printAppError(appErrors.ERROR_PARAMS, "Error processing parameters:\n" + e.ToString()); 59 return (int)appErrors.ERROR_PARAMS; 55 60 } 56 61 } -
xmlTools/trunk/posUpdate/Util.cs
r743 r745 149 149 return source.IndexOf(sToSearch, StringComparison.OrdinalIgnoreCase) >= 0; 150 150 } 151 152 // Thanks DarthDevilous for the regex! http://forums.thedailywtf.com/forums/t/2478.aspx 153 public static string[] stringToArgsArray(string args) 154 { 155 MatchCollection ms = Regex.Matches(args, "([^\" ]*(\"[^\"]*\")[^\" ]*)|[^\" ]+"); 156 List<string> listArgs=new List<string>(); 157 foreach (Match m in ms) 158 { 159 listArgs.Add(m.Value.Replace("\"","")); //remove quotes or it will cause an error 160 } 161 return listArgs.ToArray(); 162 } 151 163 } 152 164 } -
xmlTools/trunk/posUpdate/XmlPatch.cs
r742 r745 285 285 286 286 // Filename already exists? 287 if ( command.IndexOf("filename:") != -1)287 if (Util.ContainsIgnoreCase(command,"filename:")) 288 288 { 289 289 paramType = "filename:"; 290 290 } 291 else if ( command.IndexOf("filename=") != -1)291 else if (Util.ContainsIgnoreCase(command, "filename=")) 292 292 { 293 293 paramType = "filename="; … … 305 305 if (endIdx == -1) 306 306 { 307 endIdx = command.IndexOf("\ "", startIdx); // or with quotes307 endIdx = command.IndexOf("\n", startIdx); // or with endline 308 308 } 309 309 string currFilename = command.Substring(startIdx, endIdx - startIdx); … … 318 318 } 319 319 320 command = command.Replace("\"", ""); // remove quotes 321 322 Program.Main(command.Split(' ')); // use the current process is more efficient than start a new one 320 Program.Main(Util.stringToArgsArray(command)); // use the current process is more efficient than start a new one 323 321 } 324 322 catch (Exception e) -
xmlTools/trunk/posUpdate/xmlTools.csproj.user
r743 r745 2 2 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 4 <StartArguments> replaceall -element:FirstLevel -value:0 -nobackups -filename:C:\Users\home\AppData\Local\Temp\oni_aei\installrun_temp-2013_03_26-01_55_52\level0_final\xml\%2a.xml</StartArguments>4 <StartArguments>patchfile -filename:TRAM-knockdown.oni-patch</StartArguments> 5 5 </PropertyGroup> 6 6 <PropertyGroup>
Note:
See TracChangeset
for help on using the changeset viewer.