diff options
author | Jeremie Laval <jeremie.laval@gmail.com> | 2012-03-30 00:12:09 +0400 |
---|---|---|
committer | Jeremie Laval <jeremie.laval@gmail.com> | 2012-03-30 00:12:09 +0400 |
commit | 278ad061f15e8385102726280b9dcc1215fbdfe9 (patch) | |
tree | 26565703d6cbb87e570f815156088ea6106294ab | |
parent | ec10550d9dfde5141a51b9ba1f6cb9bde2c3fc9e (diff) |
[appledocwizard] Only push back archive and write status file when the operation wasn't cancelled
-rw-r--r-- | AppleDocWizard/AppleDocHandler.cs | 8 | ||||
-rw-r--r-- | AppleDocWizard/MDocArchive.cs | 12 |
2 files changed, 9 insertions, 11 deletions
diff --git a/AppleDocWizard/AppleDocHandler.cs b/AppleDocWizard/AppleDocHandler.cs index 1f341cb..c8bc098 100644 --- a/AppleDocWizard/AppleDocHandler.cs +++ b/AppleDocWizard/AppleDocHandler.cs @@ -211,10 +211,12 @@ namespace macdoc CancellationToken = token }); merger.MergeDocumentation (); - mdocArchive.Dispose (); - var statusFile = Path.Combine (baseApplicationPath, "macdoc", "merge.status"); - File.WriteAllText (statusFile, infos.Version.ToString ()); + if (!token.IsCancellationRequested) { + mdocArchive.CommitChanges (); + var statusFile = Path.Combine (baseApplicationPath, "macdoc", "merge.status"); + File.WriteAllText (statusFile, infos.Version.ToString ()); + } FireAppleDocEvent (new AppleDocEventArgs () { Stage = ProcessStage.Finished }); } diff --git a/AppleDocWizard/MDocArchive.cs b/AppleDocWizard/MDocArchive.cs index e0a5aba..477f586 100644 --- a/AppleDocWizard/MDocArchive.cs +++ b/AppleDocWizard/MDocArchive.cs @@ -6,9 +6,10 @@ using Ionic.Zip; namespace macdoc { - public interface IMdocArchive : IDisposable + public interface IMdocArchive { string GetPathForType (Type t); + void CommitChanges (); } // This is an uncompiled 'en' directory of ECMA documentation @@ -26,7 +27,7 @@ namespace macdoc return Path.Combine (baseDir, t.Namespace, t.Name + ".xml"); } - public void Dispose () + public void CommitChanges () { } @@ -95,7 +96,7 @@ namespace macdoc return new MDocZipArchive (archivePath, extractionDir); } - public void SaveBack () + public void CommitChanges () { File.Copy (originalArchivePath, originalArchivePath + originSuffix, true); File.Delete (originalArchivePath); @@ -104,11 +105,6 @@ namespace macdoc zip.Save (); } } - - public void Dispose () - { - SaveBack (); - } } } |