/// <summary> /// save patch file to disk /// </summary> /// <param name="filename"></param> public void SavePatchFile(string filename) { //save all patch task int j = patchTasks.Count; var output = new SourceFile(filename, true); //first line of patch file is original file name output.AddLine(_ORIGINAL + " " + this.OriginalFileName); for (int i = 0; i < j; ++i) { PatchTask ptask = patchTasks[i]; List <PatchCommand> cmds = ptask.GetCommands(); //each task begin with start command output.AddLine(PatchCommand.START + " " + ptask.TaskId); output.AddLine(ptask.LandMark); int cmdCount = cmds.Count; for (int n = 0; n < cmdCount; ++n) { PatchWriter.WriteCommand(output, cmds[n], true); } } output.Save(); }
/// <summary> /// save patch file to disk /// </summary> /// <param name="filename"></param> public void SavePatchFile(string filename) { //save all patch task int j = patchTasks.Count; var output = new SourceFile(filename, true); //first line of patch file is original file name output.AddLine(_ORIGINAL + " " + this.OriginalFileName); for (int i = 0; i < j; ++i) { PatchTask ptask = patchTasks[i]; List <PatchCommand> cmds = ptask.GetCommands(); //each task begin with start command if (ptask.IsPatchBlock) { //this is patch block output.AddLine(PatchCommand.BEGIN + " 0"); //pre-notes/ post-notes int noteCount = ptask.preNotes.Count; for (int m = 0; m < noteCount; ++m) { //write each line of pre note output.AddLine(PatchCommand.PRE); output.AddLine(ptask.preNotes[m]); } //--------- int contentLineCount = ptask.ContentLines.Count; for (int m = 0; m < contentLineCount; ++m) { output.AddLine(ptask.ContentLines[m]); } //--------- noteCount = ptask.postNotes.Count; for (int m = 0; m < noteCount; ++m) { //write each line of post note output.AddLine(PatchCommand.POST); output.AddLine(ptask.postNotes[m]); } output.AddLine(PatchCommand.END + " 0"); } else { if (!string.IsNullOrEmpty(ptask.PatchStartCmd)) { output.AddLine(PatchCommand.START + " " + ptask.TaskId + " " + ptask.PatchStartCmd); } else { output.AddLine(PatchCommand.START + " " + ptask.TaskId); } output.AddLine(ptask.LandMark); int cmdCount = cmds.Count; for (int n = 0; n < cmdCount; ++n) { PatchWriter.WriteCommand(output, cmds[n], true); } } } output.Save(); }