From f27102800119c8041fa438390521d89ef8df3d15 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 19 Aug 2020 00:32:39 +0200 Subject: [PATCH] Set version and fix patch detection --- GCMM/GCMM.csproj | 8 ++++++++ GCMM/MainPatcher.cs | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/GCMM/GCMM.csproj b/GCMM/GCMM.csproj index c8c2435..d5c7ab8 100644 --- a/GCMM/GCMM.csproj +++ b/GCMM/GCMM.csproj @@ -4,6 +4,14 @@ WinExe net461 true + false + favicon.ico + 1.2.0.0 + 1.2.0.0 + 1.2.0 + NorbiPeti + ExMods + A mod manager for Gamecraft. It automatically downloads and runs GCIPA and allows the user to install mods. diff --git a/GCMM/MainPatcher.cs b/GCMM/MainPatcher.cs index af7955c..0928ab5 100644 --- a/GCMM/MainPatcher.cs +++ b/GCMM/MainPatcher.cs @@ -38,7 +38,7 @@ namespace GCMM playbtn.Text = pnp; 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) { status.Text = nopatch; @@ -85,13 +85,14 @@ namespace GCMM { url = JArray.Parse(await client.DownloadStringTaskAsync(releases)).First["assets"].First["browser_download_url"].ToString(); 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; } - if (status != GameState.NotFound && status != GameState.NoPatcher) - status = CheckIfPatched(); switch (status) { case GameState.NoPatcher: //Make sure it actually worked