diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs index 3ee81f19b..fb5fbc27c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs @@ -6,7 +6,9 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; +using Tango.AdvancedInstaller; using Tango.Core; using Tango.Core.Cryptography; using Tango.Core.Helpers; @@ -127,6 +129,19 @@ namespace Tango.MachineStudio.Common.Publish throw new FileNotFoundException($"Could not locate the machine studio executable at {appPath}."); } + if (!String.IsNullOrWhiteSpace(Options.InstallerProject)) + { + if (!File.Exists(Options.InstallerProject)) + { + throw new FileNotFoundException($"Installer project not found at '{Options.InstallerProject}'."); + } + + if (!Directory.Exists(Options.InstallerOutputFolder)) + { + throw new DirectoryNotFoundException($"Installer output folder does not exists '{Options.InstallerOutputFolder}'."); + } + } + String tempFile = TemporaryManager.CreateFile(); return Task.Factory.StartNew(() => @@ -155,8 +170,33 @@ namespace Tango.MachineStudio.Common.Publish { Version = local_version, Comments = Options.Comments, + WithInstaller = !String.IsNullOrWhiteSpace(Options.InstallerProject), }).Result; + if (!String.IsNullOrWhiteSpace(Options.InstallerProject)) + { + String output_folder = Options.InstallerOutputFolder; + OnPublishProgress(0, 100, $"Building installer project..."); + InstallerBuilder installerBuilder = new InstallerBuilder(Options.InstallerProject); + String installer_name = $"Machine Studio Installer_v{Version.Parse(local_version).ToString(3)}.exe"; + String output_file = Path.Combine(output_folder, installer_name); + installerBuilder.Build(local_version, output_file).Wait(); + + Thread.Sleep(5000); + + OnPublishProgress(0, 100, $"Uploading installer '{installer_name}'..."); + + using (StorageBlobUploader uploader = new StorageBlobUploader(response.InstallerBlobAddress, output_file)) + { + uploader.Progress += (x, e) => + { + OnPublishProgress(e.Current, e.Total, $"Uploading installer {(((double)e.Current / (double)e.Total) * 100d).ToString("0.0")}%...", true); + }; + + uploader.Upload().Wait(); + } + } + OnPublishProgress(0, 100, $"Starting version packaging..."); using (ZipFile zip = new ZipFile()) @@ -188,7 +228,7 @@ namespace Tango.MachineStudio.Common.Publish { uploader.Progress += (x, e) => { - OnPublishProgress(e.Current, e.Total, $"Uploading to storage {(((double)e.Current / (double)e.Total) * 100d).ToString("0.0")}%...", true); + OnPublishProgress(e.Current, e.Total, $"Uploading version {(((double)e.Current / (double)e.Total) * 100d).ToString("0.0")}%...", true); }; uploader.Upload().Wait(); |
