Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/macdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Laval <jeremie.laval@gmail.com>2012-03-07 19:19:40 +0400
committerJeremie Laval <jeremie.laval@gmail.com>2012-03-07 19:19:40 +0400
commitf5ed2643f37e734a0f899629a7574e7f6602c472 (patch)
tree6f99272746163d5753ef85152368efa635e6bdc2 /AppleDocWizard
parentf6273b5c1a033e24041bf1e523f540c17a69486e (diff)
[appledocwizard] if user cancel during apple doc extraction, we delete the resulting directory so that we can restart anew during the following run
Diffstat (limited to 'AppleDocWizard')
-rw-r--r--AppleDocWizard/AppleDocHandler.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/AppleDocWizard/AppleDocHandler.cs b/AppleDocWizard/AppleDocHandler.cs
index 29772df..e519681 100644
--- a/AppleDocWizard/AppleDocHandler.cs
+++ b/AppleDocWizard/AppleDocHandler.cs
@@ -152,7 +152,7 @@ namespace macdoc
var evtArgs = new AppleDocEventArgs () { Stage = ProcessStage.Downloading };
WebClient client = new WebClient ();
- client.DownloadFileCompleted += (sender, e) => HandleAppleDocDownloadFinished (e, tempPath, evt, token);
+ client.DownloadFileCompleted += (sender, e) => HandleAppleDocDownloadFinished (e, infos, tempPath, evt, token);
client.DownloadProgressChanged += (sender, e) => { evtArgs.Percentage = e.ProgressPercentage; FireAppleDocEvent (evtArgs); };
FireAppleDocEvent (new AppleDocEventArgs () { Stage = ProcessStage.Downloading, Percentage = -1 });
@@ -161,7 +161,7 @@ namespace macdoc
evt.WaitOne ();
}
- void HandleAppleDocDownloadFinished (System.ComponentModel.AsyncCompletedEventArgs e, string path, ManualResetEvent evt, CancellationToken token)
+ void HandleAppleDocDownloadFinished (System.ComponentModel.AsyncCompletedEventArgs e, AppleDocInformation infos, string path, ManualResetEvent evt, CancellationToken token)
{
try {
if (e.Cancelled || token.IsCancellationRequested) {
@@ -170,6 +170,11 @@ namespace macdoc
FireAppleDocEvent (new AppleDocEventArgs () { Stage = ProcessStage.Extracting, CurrentFile = null });
var evtArgs = new AppleDocEventArgs () { Stage = ProcessStage.Extracting };
XarApi.ExtractXar (path, searchPaths.First (), token, (filepath) => { evtArgs.CurrentFile = filepath; FireAppleDocEvent (evtArgs); });
+ if (token.IsCancellationRequested) {
+ var extractedDocDir = Path.Combine (searchPaths.First (), infos.ID + ".docset");
+ if (Directory.Exists (extractedDocDir))
+ Directory.Delete (extractedDocDir, true);
+ }
} finally {
evt.Set ();
}