Skip to content

Commit

Permalink
remove downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
JensKrumsieck committed Mar 9, 2022
1 parent bd09ccf commit 2a7ba45
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 23 deletions.
4 changes: 2 additions & 2 deletions PorphyStruct.Test/PorphyStruct.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="coverlet.collector" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion PorphyStruct.WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel x:Name="UpdateMsg" Visibility="Collapsed" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5 5 20 5" Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Text="Update available" />
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Text="Update available" MouseDown="Update_Click" />
<Button Style="{DynamicResource RoundedIconButton}" Content="&#xECC5;" ToolTip="Download Update" Click="Update_Click"/>
</StackPanel>
<TabControl Grid.RowSpan="2" ItemsSource="{Binding Items}" Grid.Row="0" Grid.Column="0" Margin="0" BorderThickness="0" Padding="0"
Expand Down
3 changes: 1 addition & 2 deletions PorphyStruct.WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ private async void CheckUpdate(bool force = false)
else if (force) MessageBox.Show($"You already have the latest Version of PorphyStruct ({u.Latest})");
if (!current && force)
{
MessageBox.Show("Download started!");
u.DownloadLatest();
Process.Start(new ProcessStartInfo("http://github.com/jenskrumsieck/porphystruct/releases/latest") { UseShellExecute = true });
UpdateMsg.Visibility = Visibility.Collapsed;
}
}
Expand Down
18 changes: 2 additions & 16 deletions PorphyStruct.WPF/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System.Net.Http.Headers;
using System.Reflection;
using System.Text.Json;
using System.Windows;

namespace PorphyStruct.WPF;

public class Updater
{
public string Latest = "v0.0.0";
public string Latest = "0.0.0";


/// <summary>
/// Returns Instance asynchronously
Expand Down Expand Up @@ -59,18 +59,4 @@ public async Task<bool> CheckVersion()
//return true if no response could be made
return true;
}

public async void DownloadLatest()
{
using var client = new HttpClient();
using var req = new HttpRequestMessage(HttpMethod.Get, $"https://github.com/JensKrumsieck/PorphyStruct/releases/download/v{Latest}/PorphyStruct.exe");
using var contentStream = await (await client.SendAsync(req)).Content.ReadAsStreamAsync();
using var stream = new FileStream(Core.Constants.SettingsFolder + "/PorphyStruct.exe", FileMode.Create, FileAccess.Write, FileShare.None, 262144, true);
await contentStream.CopyToAsync(stream).ContinueWith((_) => Client_DownloadFileCompleted());
}
private static void Client_DownloadFileCompleted()
{
MessageBox.Show("Download complete!");
Process.Start("explorer.exe", Core.Constants.SettingsFolder);
}
}
4 changes: 2 additions & 2 deletions PorphyStruct.Web/PorphyStruct.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
<ItemGroup>
<PackageReference Include="ChemSharp.Molecules.Blazor" Version="1.0.15" />
<PackageReference Include="Microsoft.AspNetCore.ClientAssets" Version="0.1.0-alpha.21528.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="OxyPlot.SkiaSharp.Blazor" Version="1.0.0-beta.2" />
<PackageReference Include="Tewr.Blazor.FileReader" Version="3.3.1.21360" />
</ItemGroup>
Expand Down

1 comment on commit 2a7ba45

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for porphystruct ready!

✅ Preview
https://porphystruct-51qjah9ub-jenskrumsieck.vercel.app

Built with commit 2a7ba45.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.