Skip to content

Commit

Permalink
update some versioning stuff, add Lure as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
neomoth committed Oct 28, 2024
1 parent 8e736cd commit 237e447
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
27 changes: 26 additions & 1 deletion NeoQOLPack/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using GDWeave.Godot.Variants;
using NeoQOLPack.Mods;
using Serilog;
using System.IO;

namespace NeoQOLPack;

Expand All @@ -15,7 +16,7 @@ public class Mod : IMod
public Config Config;
public ILogger Logger;

private static readonly string versionTag = "v1.0.2";
private static string versionTag = "v0";
private static readonly string repo = "neomoth/NeoQOLPack";

private bool injectUpdateNotice = false;
Expand Down Expand Up @@ -45,6 +46,30 @@ public Mod(IModInterface modInterface) {
private async Task GetVersion()
{
modInterface.Logger.Information("Neo's QOL Pack loaded!! :3");

try
{
string? currentDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
if (currentDir is null)
throw new NullReferenceException(
"if this gets thrown i have no fucking idea how you managed to do that.");
string jsonPath = Path.Combine(currentDir, "mod.json");
if (!File.Exists(jsonPath))
throw new FileNotFoundException("mod.json was not found in the mod's directory.");
string jsonContent = File.ReadAllText(jsonPath);
JsonDocument document = JsonDocument.Parse(jsonContent);
if (document.RootElement.TryGetProperty("version", out JsonElement version))
{
string? versionAsString = version.GetString();
if (versionAsString is not null) versionTag = $"v{versionAsString}";
}
else throw new Exception("'version' property not found in mod.json.");
}
catch (Exception e)
{
Logger.Error(e.Message);
}

try
{
JsonDocument? githubInfoRaw = await GetLatestRelease(modInterface.Logger);
Expand Down
1 change: 1 addition & 0 deletions NeoQOLPack/NeoQOLPack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<ItemGroup>
<None Include="manifest.json" CopyToOutputDirectory="PreserveNewest"/>
<None Include="mod.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 8 additions & 3 deletions NeoQOLPack/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"Id": "NeoQOLPack",
"AssemblyPath": "NeoQOLPack.dll"
}
"Id": "NeoQOLPack",
"PackPath": "NeoQOLPack.pck",
"AssemblyPath": "NeoQOLPack.dll",
"Dependencies":
[
"Sulayre.Lure"
]
}
6 changes: 6 additions & 0 deletions NeoQOLPack/mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "NeoQOLPack",
"version": "1.0.3",
"description": "A collection of Quality of Life patches",
"author": "neomoth"
}
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NeoQOLPack",
"version": "1.0.2",
"version": "1.0.3",
"description": "A collection of Quality of Life patches",
"author": "neomoth"
}
}

0 comments on commit 237e447

Please sign in to comment.