Check GCMM updates while we're at it
This commit is contained in:
parent
1f413eebda
commit
cb4473de58
2 changed files with 24 additions and 1 deletions
|
@ -24,6 +24,7 @@ namespace GCMM
|
||||||
|
|
||||||
private readonly Dictionary<string, ModInfo> mods = new Dictionary<string, ModInfo>();
|
private readonly Dictionary<string, ModInfo> mods = new Dictionary<string, ModInfo>();
|
||||||
private readonly ModInfo gcipa = new ModInfo { Author = "modtainers", Name = "GCIPA" };
|
private readonly ModInfo gcipa = new ModInfo { Author = "modtainers", Name = "GCIPA" };
|
||||||
|
private readonly ModInfo gcmm = new ModInfo { Author = "NorbiPeti", Name = "GCMM" };
|
||||||
private const string defaultInfo = @"
|
private const string defaultInfo = @"
|
||||||
Gamecraft Mod Manager
|
Gamecraft Mod Manager
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -53,6 +54,19 @@ namespace GCMM
|
||||||
catch (BadImageFormatException)
|
catch (BadImageFormatException)
|
||||||
{ //Not a .NET assembly
|
{ //Not a .NET assembly
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string mmpath = "GCMM.exe";
|
||||||
|
if (File.Exists(mmpath))
|
||||||
|
{
|
||||||
|
var an = AssemblyName.GetAssemblyName(mmpath);
|
||||||
|
gcmm.Version = an.Version;
|
||||||
|
gcmm.LastUpdated = File.GetLastWriteTime(mmpath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (BadImageFormatException)
|
||||||
|
{ //Not a .NET assembly
|
||||||
|
}
|
||||||
return installed;
|
return installed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +89,15 @@ namespace GCMM
|
||||||
AddUpdateModInList(mod);
|
AddUpdateModInList(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await FetchModInfo(gcipa, preview, false);
|
if (gcmm.LatestVersion == null) //Only check once
|
||||||
|
{
|
||||||
|
await FetchModInfo(gcipa, preview, false);
|
||||||
|
await FetchModInfo(gcmm, preview, false);
|
||||||
|
if (gcmm.Updatable)
|
||||||
|
if (MessageBox.Show("There is a GCMM update available! Do you want to download it now? If yes, extract it over this installation.", "Mod Manager update", MessageBoxButtons.YesNo)
|
||||||
|
== DialogResult.Yes)
|
||||||
|
Process.Start(gcmm.DownloadURL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> FetchModInfo(ModInfo mod, bool preview, bool desc)
|
public async Task<bool> FetchModInfo(ModInfo mod, bool preview, bool desc)
|
||||||
|
|
Loading…
Reference in a new issue