aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-19 14:52:54 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-19 14:52:54 +0200
commitc3ed01b6c75c44cfeca650b43deb058b1551a9bb (patch)
tree87f8c8391373c3fa50eb7248798ce8fd99fde8c6 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher
parentde762e7e5b346af5a12eff04cbaa0696eec15b8c (diff)
downloadTango-c3ed01b6c75c44cfeca650b43deb058b1551a9bb.tar.gz
Tango-c3ed01b6c75c44cfeca650b43deb058b1551a9bb.zip
Moved machine studio update azure !!!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs40
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/Tango.MachineStudio.Publisher.csproj7
2 files changed, 23 insertions, 24 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs
index ffeefb820..73f3f5bed 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs
@@ -19,6 +19,7 @@ using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Update;
using Tango.Settings;
using Tango.SharedUI;
+using Tango.Transport.Web;
namespace Tango.MachineStudio.Publisher
{
@@ -26,7 +27,6 @@ namespace Tango.MachineStudio.Publisher
{
private BasicHashGenerator _hashGenerator;
private String _appPath = AppDomain.CurrentDomain.BaseDirectory + "..\\Release";
- private ChannelFactory<IMachineStudioUpdateService> _service;
private IMachineStudioUpdateService _client;
private String _email;
@@ -114,14 +114,15 @@ namespace Tango.MachineStudio.Publisher
public MainWindowVM()
{
+ _client = new MachineStudioUpdateService();
+
MaxProgress = 100;
_hashGenerator = new BasicHashGenerator();
PublishCommand = new RelayCommand(Publish, () => Email != null && Password != null && Comments != null && CurrentVersion != null && LatestVersion != null && !IsUpdating && Version.Parse(CurrentVersion) > Version.Parse(LatestVersion));
- _service = UpdateServiceHelper.GetUpdateServiceChannel();
- _client = _service.CreateChannel();
+ var client = new MachineStudioUpdateService();
UpdateVersions();
@@ -136,7 +137,7 @@ namespace Tango.MachineStudio.Publisher
private void UpdateVersions()
{
CurrentVersion = FileVersionInfo.GetVersionInfo(_appPath + "\\Tango.MachineStudio.UI.exe").ProductVersion;
- LatestVersion = _client.GetLatestVersion();
+ LatestVersion = _client.GetLatestVersion(new LatestVersionRequest()).Result.Version;
}
private void Publish()
@@ -152,7 +153,7 @@ namespace Tango.MachineStudio.Publisher
Task.Factory.StartNew(() =>
{
IsUpdating = true;
- String tempFile = String.Empty;
+ String tempFile = TemporaryManager.CreateFile();
try
{
@@ -164,9 +165,7 @@ namespace Tango.MachineStudio.Publisher
Comments = Comments,
ForcedUpdate = ForcedUpdate,
IsStable = IsStable,
- });
-
- tempFile = Path.Combine(Path.GetTempPath(), response.FileName);
+ }).Result;
using (ZipFile zip = new ZipFile())
{
@@ -190,28 +189,23 @@ namespace Tango.MachineStudio.Publisher
Progress = 0;
MaxProgress = 100;
- FileStreamWrapper fs = null;
-
- using (fs = new FileStreamWrapper(tempFile, FileMode.Open, (current) =>
- {
- InvokeUINow(() =>
- {
- Thread.Sleep(10);
- Progress = ((double)current / (double)fs.Length) * 100d;
- });
- }))
+ using (StorageBlobUploader uploader = new StorageBlobUploader(response.BlobAddress,tempFile))
{
- using (FtpClient ftp = new FtpClient(response.FtpHost, response.UserName, response.Password))
+ uploader.Progress += (x, e) =>
{
- ftp.ConnectAsync().Wait();
- ftp.UploadAsync(fs, response.FilePath, FtpExists.Overwrite, true).Wait();
- }
+ InvokeUINow(() =>
+ {
+ Progress = ((double)e.Current / (double)e.Total) * 100d;
+ });
+ };
+
+ uploader.Upload().Wait();
}
_client.NotifyUploadCompleted(new UploadCompletedRequest()
{
Token = response.Token,
- });
+ }).Wait();
Progress = 0;
UpdateVersions();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/Tango.MachineStudio.Publisher.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/Tango.MachineStudio.Publisher.csproj
index c462c21f4..a7e3e045b 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/Tango.MachineStudio.Publisher.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/Tango.MachineStudio.Publisher.csproj
@@ -55,6 +55,7 @@
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
</Reference>
+ <Reference Include="Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
@@ -145,6 +146,10 @@
<Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
<Name>Tango.SharedUI</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.Transport\Tango.Transport.csproj">
+ <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project>
+ <Name>Tango.Transport</Name>
+ </ProjectReference>
<ProjectReference Include="..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj">
<Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project>
<Name>Tango.MachineStudio.Common</Name>
@@ -165,7 +170,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