diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index 0f6ec8b98..c8b4b6adc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -13,6 +13,7 @@ using System.Threading.Tasks; using Tango.Core.Commands; using Tango.Core.DI; using Tango.Core.Helpers; +using Tango.Core.IO; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Navigation; @@ -45,7 +46,7 @@ namespace Tango.MachineStudio.UI.ViewModels private IStudioApplicationManager _application; private IAuthenticationProvider _authentication; private CheckForUpdatesResponse _updateInfo; - private String _newPackageTempFolder; + private TemporaryFolder _newPackageTempFolder; private UpdateStatus _status; public UpdateStatus Status @@ -184,7 +185,7 @@ namespace Tango.MachineStudio.UI.ViewModels Task.Factory.StartNew(() => { - var tempFile = PathHelper.GetTempFilePath() + ".zip"; + var tempFile = TemporaryManager.CreateFile(".zip"); try { @@ -192,7 +193,7 @@ namespace Tango.MachineStudio.UI.ViewModels int fileSize = 0; - using (FileStreamWrapper fs = new FileStreamWrapper(tempFile, FileMode.Create, (current) => + using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) => { InvokeUINow(() => { @@ -216,9 +217,10 @@ namespace Tango.MachineStudio.UI.ViewModels Status = UpdateStatus.Updating; - _newPackageTempFolder = PathHelper.GetTempFolderPath(); + _newPackageTempFolder = TemporaryManager.CreateFolder(); + _newPackageTempFolder.Persist = true; - using (ZipFile zip = ZipFile.Read(tempFile)) + using (ZipFile zip = ZipFile.Read(tempFile.Path)) { int currentEntry = 0; @@ -235,7 +237,7 @@ namespace Tango.MachineStudio.UI.ViewModels { Thread.Sleep(10); - string newPath = Path.Combine(_newPackageTempFolder, entry.FileName); + string newPath = Path.Combine(_newPackageTempFolder.Path, entry.FileName); try { @@ -246,7 +248,7 @@ namespace Tango.MachineStudio.UI.ViewModels else { CurrentUpdateFile = Path.GetFileName(entry.FileName); - entry.Extract(_newPackageTempFolder, ExtractExistingFileAction.OverwriteSilently); + entry.Extract(_newPackageTempFolder.Path, ExtractExistingFileAction.OverwriteSilently); } } catch @@ -266,7 +268,7 @@ namespace Tango.MachineStudio.UI.ViewModels } finally { - PathHelper.TryDeleteFile(tempFile); + tempFile.Delete(); } }); } |
