Browse Source

Check GCMM updates while we're at it

tags/v1.3.0
NorbiPeti 4 years ago
parent
commit
cb4473de58
2 changed files with 24 additions and 1 deletions
  1. +1
    -0
      GCMM/MainForm.cs
  2. +23
    -1
      GCMM/MainModList.cs

+ 1
- 0
GCMM/MainForm.cs View File

@@ -24,6 +24,7 @@ namespace GCMM

private readonly Dictionary<string, ModInfo> mods = new Dictionary<string, ModInfo>();
private readonly ModInfo gcipa = new ModInfo { Author = "modtainers", Name = "GCIPA" };
private readonly ModInfo gcmm = new ModInfo { Author = "NorbiPeti", Name = "GCMM" };
private const string defaultInfo = @"
Gamecraft Mod Manager



+ 23
- 1
GCMM/MainModList.cs View File

@@ -2,6 +2,7 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
@@ -53,6 +54,19 @@ namespace GCMM
catch (BadImageFormatException)
{ //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;
}

@@ -75,7 +89,15 @@ namespace GCMM
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)


Loading…
Cancel
Save