Set version and fix patch detection

This commit is contained in:
Norbi Peti 2020-08-19 00:32:39 +02:00
parent e80e3d9870
commit f271028001
2 changed files with 13 additions and 4 deletions

View file

@ -4,6 +4,14 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net461</TargetFramework> <TargetFramework>net461</TargetFramework>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<SignAssembly>false</SignAssembly>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
<Version>1.2.0</Version>
<Authors>NorbiPeti</Authors>
<Company>ExMods</Company>
<Description>A mod manager for Gamecraft. It automatically downloads and runs GCIPA and allows the user to install mods.</Description>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View file

@ -38,7 +38,7 @@ namespace GCMM
playbtn.Text = pnp; playbtn.Text = pnp;
return GameState.Unpatched; return GameState.Unpatched;
} }
string backup = Directory.EnumerateDirectories(backups).OrderByDescending(s => s).FirstOrDefault(); string backup = Directory.EnumerateDirectories(backups).OrderByDescending(name => Directory.GetLastWriteTimeUtc(name)).FirstOrDefault();
if (backup == null) if (backup == null)
{ {
status.Text = nopatch; status.Text = nopatch;
@ -85,13 +85,14 @@ namespace GCMM
{ {
url = JArray.Parse(await client.DownloadStringTaskAsync(releases)).First["assets"].First["browser_download_url"].ToString(); url = JArray.Parse(await client.DownloadStringTaskAsync(releases)).First["assets"].First["browser_download_url"].ToString();
await client.DownloadFileTaskAsync(url, "IPA.zip"); await client.DownloadFileTaskAsync(url, "IPA.zip");
ZipFile.ExtractToDirectory("IPA.zip", Settings.Default.GamePath); using (var fs = new FileStream("IPA.zip", FileMode.Open))
using (var za = new ZipArchive(fs))
za.ExtractToDirectory(Settings.Default.GamePath, true); //Overwrite files that were left from a previous install of the patcher
} }
} }
status = CheckIfPatched();
break; break;
} }
if (status != GameState.NotFound && status != GameState.NoPatcher)
status = CheckIfPatched();
switch (status) switch (status)
{ {
case GameState.NoPatcher: //Make sure it actually worked case GameState.NoPatcher: //Make sure it actually worked