using Semver as versioning
This commit is contained in:
parent
9669636a17
commit
fd7c8b244f
|
@ -143,6 +143,9 @@
|
||||||
<PackageReference Include="ModernWpfUI">
|
<PackageReference Include="ModernWpfUI">
|
||||||
<Version>0.9.4</Version>
|
<Version>0.9.4</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="semver">
|
||||||
|
<Version>2.0.6</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="circle_new.ico" />
|
<Resource Include="circle_new.ico" />
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
ui:WindowHelper.UseModernWindowStyle="True" ResizeMode="CanMinimize" Icon="circle_new.ico" Topmost="True" WindowStartupLocation="CenterScreen">
|
ui:WindowHelper.UseModernWindowStyle="True" ResizeMode="CanMinimize" Icon="circle_new.ico" Topmost="True" WindowStartupLocation="CenterScreen">
|
||||||
<ui:SimpleStackPanel Margin="12" Spacing="24">
|
<ui:SimpleStackPanel Margin="12" Spacing="24">
|
||||||
<CheckBox x:Name="linkFoldersCheckbox" Content="Link Song and Skins Folder" HorizontalAlignment="Stretch" Height="32" VerticalAlignment="Top" Margin="150,125,150,-125" IsChecked="True" />
|
<CheckBox x:Name="linkFoldersCheckbox" Content="Link Song and Skins Folder" HorizontalAlignment="Stretch" Height="32" VerticalAlignment="Top" Margin="150,125,150,-125" IsChecked="True" />
|
||||||
<TextBox x:Name="folderTextbox" HorizontalAlignment="Left" Height="32" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="422" Margin="10,-27,0,-5" IsReadOnly="true"/>
|
<TextBox x:Name="folderTextbox" HorizontalAlignment="Left" Height="32" TextWrapping="Wrap" Text="trying to locate osu! location..." VerticalAlignment="Top" Width="422" Margin="10,-27,0,-5" IsReadOnly="true"/>
|
||||||
<Button x:Name="InstallButton" Content="Install" HorizontalAlignment="Stretch" Height="32" VerticalAlignment="Bottom" Margin="176,0,176,-114" Style="{StaticResource AccentButtonStyle}" Click="Install_Click"/>
|
<Button x:Name="InstallButton" Content="Install" HorizontalAlignment="Stretch" Height="32" VerticalAlignment="Bottom" Margin="176,0,176,-114" Style="{StaticResource AccentButtonStyle}" Click="Install_Click"/>
|
||||||
<Button x:Name="BrowseButton" Content="..." HorizontalAlignment="Stretch" Height="32" VerticalAlignment="Top" Margin="437,-75,10,0" Click="Browse_Click"/>
|
<Button x:Name="BrowseButton" Content="..." HorizontalAlignment="Stretch" Height="32" VerticalAlignment="Top" Margin="437,-75,10,0" Click="Browse_Click"/>
|
||||||
<Button x:Name="Uninstall_Button" Content="Uninstall" HorizontalAlignment="Stretch" Height="31" VerticalAlignment="Bottom" Margin="176,0,176,-100" Click="Uninstall_Button_Click" Foreground="White" Visibility="Hidden" IsCancel="True"/>
|
<Button x:Name="Uninstall_Button" Content="Uninstall" HorizontalAlignment="Stretch" Height="31" VerticalAlignment="Bottom" Margin="176,0,176,-100" Click="Uninstall_Button_Click" Foreground="White" Visibility="Hidden" IsCancel="True"/>
|
||||||
|
|
|
@ -15,6 +15,8 @@ using Path = System.IO.Path;
|
||||||
using File = System.IO.File;
|
using File = System.IO.File;
|
||||||
using EZPPClient_Installer.Utils;
|
using EZPPClient_Installer.Utils;
|
||||||
using IWshRuntimeLibrary;
|
using IWshRuntimeLibrary;
|
||||||
|
using System.Windows.Forms.VisualStyles;
|
||||||
|
using Semver;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
using MessageBox = System.Windows.MessageBox;
|
using MessageBox = System.Windows.MessageBox;
|
||||||
|
@ -33,7 +35,7 @@ namespace EZPPClient_Installer
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
private static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, SymbolicLink dwFlags);
|
private static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, SymbolicLink dwFlags);
|
||||||
|
|
||||||
private static double VERSION = 1.6;
|
private static SemVersion VERSION = new SemVersion(1, 1, 0);
|
||||||
|
|
||||||
public static string RELEASESTREAM;
|
public static string RELEASESTREAM;
|
||||||
|
|
||||||
|
@ -76,6 +78,9 @@ namespace EZPPClient_Installer
|
||||||
bool isValidFolder = await isValidOsuFolder(osuPath);
|
bool isValidFolder = await isValidOsuFolder(osuPath);
|
||||||
UpdateInstallButton(!string.IsNullOrEmpty(osuPath));
|
UpdateInstallButton(!string.IsNullOrEmpty(osuPath));
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(osuPath))
|
||||||
|
folderTextbox.Text = "";
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(osuPath) && isValidFolder)
|
if (!string.IsNullOrEmpty(osuPath) && isValidFolder)
|
||||||
{
|
{
|
||||||
bool foundInstall = isEZPPClientInstallationFound(osuPath);
|
bool foundInstall = isEZPPClientInstallationFound(osuPath);
|
||||||
|
@ -134,16 +139,19 @@ namespace EZPPClient_Installer
|
||||||
{
|
{
|
||||||
client.Headers.Add("user-agent", "EZPPClientInstaller");
|
client.Headers.Add("user-agent", "EZPPClientInstaller");
|
||||||
string newVersionString = await client.DownloadStringTaskAsync("https://new.ez-pp.farm/ezppclient?version");
|
string newVersionString = await client.DownloadStringTaskAsync("https://new.ez-pp.farm/ezppclient?version");
|
||||||
double ver = 0;
|
SemVersion newVersion = new SemVersion(9, 9, 9);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ver = double.Parse(newVersionString, CultureInfo.InvariantCulture);
|
newVersion = SemVersion.Parse(newVersionString);
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (Exception e){
|
||||||
{
|
ShowErrorDialog(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ver > VERSION)
|
int versionsBehind = newVersion.CompareTo(VERSION);
|
||||||
|
|
||||||
|
if (versionsBehind > 0)
|
||||||
return UpdateState.UpdateFound;
|
return UpdateState.UpdateFound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user