Skip to content

Commit

Permalink
minor folder squish + race condition improvement
Browse files Browse the repository at this point in the history
now updater will just wait and then try again on extraction, instead of waiting by default. still will try to eliminate race condition altogether.
  • Loading branch information
fmmmlee committed Aug 30, 2019
1 parent 509d99b commit 5c96c35
Show file tree
Hide file tree
Showing 35 changed files with 15 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ void selfUpdate_DownloadProgress(object sender, DownloadProgressChangedEventArgs
{
viewModel.UpdateDownloadProgress = e.ProgressPercentage;
}

//TODO: Add reference to a special method that launches the updater to each place the program exits (x button, finish button, etc)
public static void startUpdater()
{
Process.Start("UOAOM Updater.exe");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ static void Main(string[] args)
{
//race condition handicap. TODO: um, MAKE THIS NOT A RACE CONDITION lol
//(idk, have another helper process that starts on close button pressed in main app, waits until main app's process is closed, then starts this updater and closes itself?)
//
//add clause to retry an extraction if it doesn't work?
System.Threading.Thread.Sleep(3000);

if (Directory.Exists(update_folder))
Expand All @@ -26,7 +28,19 @@ static void Main(string[] args)
if (string.IsNullOrEmpty(entry.Name))
Directory.CreateDirectory(entry.FullName);
else if (entry.FullName != "UOAOM updater.exe")
entry.ExtractToFile(Path.Combine(Directory.GetCurrentDirectory(), entry.FullName), true);
{
try
{
entry.ExtractToFile(Path.Combine(Directory.GetCurrentDirectory(), entry.FullName), true);
}
catch (IOException e)
{
System.Threading.Thread.Sleep(3000);
entry.ExtractToFile(Path.Combine(Directory.GetCurrentDirectory(), entry.FullName), true);
}

}

}
zip.Close();
}
Expand Down

0 comments on commit 5c96c35

Please sign in to comment.