diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
9 files changed, 95 insertions, 6 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(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs index 047d7c0b4..c5db355b1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs @@ -73,6 +73,14 @@ namespace Tango.MachineStudio.Common.Publish set { _installerProject = value; RaisePropertyChangedAuto(); } } + private String _installerOutputFolder; + [Option("installer-output-folder", HelpText = "Specifies where to save the installer application.", Required = false)] + public String InstallerOutputFolder + { + get { return _installerOutputFolder; } + set { _installerOutputFolder = value; RaisePropertyChangedAuto(); } + } + public PublishOptions() { BasePath = AppDomain.CurrentDomain.BaseDirectory + "..\\"; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 3f9133d43..5d9c48cd4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -230,6 +230,10 @@ <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> <Name>Tango.AutoComplete</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.AdvancedInstaller\Tango.AdvancedInstaller.csproj"> + <Project>{c5df1816-34e5-4700-824c-29623a1baa22}</Project> + <Name>Tango.AdvancedInstaller</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> @@ -326,7 +330,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionRequest.cs index d27f48648..394658813 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionRequest.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionRequest.cs @@ -13,5 +13,7 @@ namespace Tango.MachineStudio.Common.Web public String Version { get; set; } public String Comments { get; set; } + + public bool WithInstaller { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionResponse.cs index 9fb3ab94d..a5c5f8e56 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionResponse.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/UploadVersionResponse.cs @@ -13,5 +13,7 @@ namespace Tango.MachineStudio.Common.Web public String Token { get; set; } public String BlobAddress { get; set; } + + public String InstallerBlobAddress { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml index b860994fd..0687ffed7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml @@ -7,7 +7,7 @@ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:web="clr-namespace:Tango.Web;assembly=Tango.Web" mc:Ignorable="d" - Title="Machine Studio Publisher" Height="482" Width="700" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize" Foreground="#202020" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> + Title="Machine Studio Publisher" Height="520" Width="700" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize" Foreground="#202020" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> <Window.Resources> <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> @@ -67,8 +67,18 @@ <TextBox Margin="5 0 0 0" Width="200" BorderThickness="0 0 0 1" Text="{Binding Options.Password,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> </StackPanel> + <StackPanel Margin="0 10 0 0" Orientation="Horizontal"> + <TextBlock FontSize="16">Installer Project:</TextBlock> + <TextBox Margin="5 0 0 0" Width="500" BorderThickness="0 0 0 1" Text="{Binding Options.InstallerProject,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> + </StackPanel> + + <StackPanel Margin="0 10 0 0" Orientation="Horizontal"> + <TextBlock FontSize="16">Installer Output Folder:</TextBlock> + <TextBox Margin="5 0 0 0" Width="500" BorderThickness="0 0 0 1" Text="{Binding Options.InstallerOutputFolder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> + </StackPanel> + <TextBlock FontSize="16" Margin="0 20 0 0">Comments</TextBlock> - <TextBox Height="70" Margin="0 5 0 0" Width="500" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding Options.Comments,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> + <TextBox HorizontalAlignment="Left" Height="70" Margin="0 5 0 0" Width="500" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding Options.Comments,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs index e227c0904..479a657d6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs @@ -63,7 +63,7 @@ namespace Tango.MachineStudio.Publisher.UI { PublishCommand = new RelayCommand(Publish, () => Options.Email != null && Options.Password != null && Options.Comments != null && LocalVersion != null && RemoteVersion != null && IsFree); - Options = new PublishOptions(); + Options = SettingsManager.Default.GetOrCreate<PublisherSettings>().Options; _publisher = new MachineStudioPublisher(Options); _publisher.PublishProgress += _publisher_PublishProgress; @@ -93,6 +93,8 @@ namespace Tango.MachineStudio.Publisher.UI private async void Publish() { + SettingsManager.Default.Save(); + if (!ShowQuestion("Did you remember to synchronize production database ?")) { return; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/PublisherSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/PublisherSettings.cs new file mode 100644 index 000000000..dda722765 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/PublisherSettings.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Publish; +using Tango.Settings; + +namespace Tango.MachineStudio.Publisher.UI +{ + public class PublisherSettings : SettingsBase + { + public PublishOptions Options { get; set; } + + public PublisherSettings() + { + Options = new PublishOptions(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj index f7b753e02..edcdfb567 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj @@ -82,6 +82,7 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </ApplicationDefinition> + <Compile Include="PublisherSettings.cs" /> <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -174,7 +175,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file |
