| 95 |
|
//---------------------------------------------------Parse Operation command (start) |
| 96 |
|
try |
| 97 |
|
{ |
| 98 |
< |
if (forceFiles == null) |
| 98 |
> |
if (String.IsNullOrEmpty(forceFiles)) |
| 99 |
|
{ |
| 100 |
|
File = getPatchParameter(operation, "File"); |
| 101 |
|
} |
| 114 |
|
return false; |
| 115 |
|
} |
| 116 |
|
|
| 117 |
< |
if (Element == "") |
| 117 |
> |
if (String.IsNullOrEmpty(Element)) |
| 118 |
|
{ |
| 119 |
|
return false; |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
//---------------------------------------------------Parse Operation command (end) |
| 123 |
|
List<String> filesToProcess = new List<String>(); |
| 124 |
< |
if (File == "") |
| 124 |
> |
if (String.IsNullOrEmpty(File)) |
| 125 |
|
{ |
| 126 |
|
filesToProcess = Util.getAllXmlFiles(); //no file specified, use all xml files found in same folder |
| 127 |
|
} |
| 187 |
|
//---------------------------------------------------Parse Operation command (start) |
| 188 |
|
try |
| 189 |
|
{ |
| 190 |
< |
if (forceFiles == null) |
| 190 |
> |
if (String.IsNullOrEmpty(forceFiles)) |
| 191 |
|
{ |
| 192 |
|
File = getPatchParameter(operation, "File"); |
| 193 |
|
} |
| 206 |
|
return false; |
| 207 |
|
} |
| 208 |
|
|
| 209 |
< |
if (Element == "") |
| 209 |
> |
if (String.IsNullOrEmpty(Element)) |
| 210 |
|
{ |
| 211 |
|
return false; |
| 212 |
|
} |
| 214 |
|
//---------------------------------------------------Parse Operation command (end) |
| 215 |
|
|
| 216 |
|
List<String> filesToProcess = new List<String>(); |
| 217 |
< |
if (File == "") |
| 217 |
> |
if (String.IsNullOrEmpty(File)) |
| 218 |
|
{ |
| 219 |
|
filesToProcess = Util.getAllXmlFiles(); //no file specified, use all xml files found in same folder |
| 220 |
|
} |
| 271 |
|
|
| 272 |
|
command = command.Replace("@COMMAND ", ""); //get only the command to process |
| 273 |
|
|
| 274 |
< |
if (command.Trim() == "") |
| 274 |
> |
if (String.IsNullOrEmpty(command.Trim())) |
| 275 |
|
{ |
| 276 |
|
Program.printAppError(Program.appErrors.PATCH_COMMAND_NOT_FOUND, "Error parsing commandOperation in Patch file: Command is empty."); |
| 277 |
|
return false; |
| 279 |
|
|
| 280 |
|
try |
| 281 |
|
{ |
| 282 |
< |
if (forceFiles != null) |
| 282 |
> |
if (!String.IsNullOrEmpty(forceFiles)) |
| 283 |
|
{ |
| 284 |
|
string paramType = ""; |
| 285 |
|
|
| 295 |
|
// Add the filename if it doesn't exists |
| 296 |
|
else |
| 297 |
|
{ |
| 298 |
< |
command = command.Insert(command.Length-1," -filename:" + this.forceFiles); // -1 to be inside quotes |
| 298 |
> |
command = command.Insert(command.Length," -filename:" + this.forceFiles); |
| 299 |
|
} |
| 300 |
|
|
| 301 |
< |
if (paramType != "") |
| 301 |
> |
if (!String.IsNullOrEmpty(paramType)) |
| 302 |
|
{ |
| 303 |
|
int startIdx = command.IndexOf(paramType) + paramType.Length; |
| 304 |
|
int endIdx = command.IndexOf(" ", startIdx); // it may end with space |
| 305 |
|
if (endIdx == -1) |
| 306 |
|
{ |
| 307 |
|
endIdx = command.IndexOf("\n", startIdx); // or with endline |
| 308 |
+ |
if(endIdx==-1){ // Filename parameters is the last one in the file (file ends with this parameter) |
| 309 |
+ |
endIdx=command.Length-1; |
| 310 |
+ |
} |
| 311 |
|
} |
| 312 |
|
string currFilename = command.Substring(startIdx, endIdx - startIdx); |
| 313 |
|
command = command.Replace(currFilename, this.forceFiles); |
| 317 |
|
|
| 318 |
|
if (this.globalNoBackups && !Util.ContainsIgnoreCase(command,"nobackups")) // add noBackup flag if provided as global parameter |
| 319 |
|
{ |
| 320 |
< |
command = command.Insert(command.Length - 1, " -nobackups"); // -1 to be inside quotes |
| 320 |
> |
command = command.Insert(command.Length, " -nobackups"); |
| 321 |
|
} |
| 322 |
|
|
| 323 |
|
Program.Main(Util.stringToArgsArray(command)); // use the current process is more efficient than start a new one |