Skip to content

Commit

Permalink
Version check (#10)
Browse files Browse the repository at this point in the history
notifying user when mod is made for wrong version of OWML
  • Loading branch information
amazingalek authored Dec 20, 2019
1 parent 482168d commit c0b0df6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions OWML.Common/IModManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public interface IModManifest
string Author { get; }
string Name { get; }
string Version { get; }
string OWMLVersion { get; }
string AssemblyPath { get; }
string UniqueName { get; }
string FolderPath { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions OWML.Common/ModManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class ModManifest : IModManifest
[JsonProperty("version")]
public string Version { get; private set; }

[JsonProperty("owmlVersion")]
public string OWMLVersion { get; private set; }

[JsonProperty("enabled")]
public bool Enabled { get; private set; }

Expand Down
7 changes: 5 additions & 2 deletions OWML.Launcher/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace OWML.Launcher
{
public class App
{
private const string OWMLVersion = "0.1.3";

private readonly string[] _filesToCopy = { "UnityEngine.CoreModule.dll", "Assembly-CSharp.dll" };

public void Run()
Expand Down Expand Up @@ -83,8 +85,9 @@ private void ShowModList(IModFinder modFinder)
Console.WriteLine("Found mods:");
foreach (var manifest in manifests)
{
var stateText = manifest.Enabled ? "" : " (disabled)";
Console.WriteLine($"* {manifest.UniqueName} ({manifest.Version}){stateText}");
var stateText = manifest.Enabled ? "" : "(disabled)";
var versionCheckText = manifest.OWMLVersion == OWMLVersion ? "" : $"(mod is for OWML {manifest.OWMLVersion} but you are running OWML {OWMLVersion})";
Console.WriteLine($"* {manifest.UniqueName} ({manifest.Version}) {stateText} {versionCheckText}");
}
}

Expand Down
1 change: 1 addition & 0 deletions OWML.SampleMods/OWML.EnableDebugMode/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"name": "EnableDebugMode",
"uniqueName": "Alek.EnableDebugMode",
"version": "0.1",
"owmlVersion": "0.1.3",
"enabled": true
}
1 change: 1 addition & 0 deletions OWML.SampleMods/OWML.TestMod/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"name": "TestMod",
"uniqueName": "Alek.TestMod",
"version": "0.1",
"owmlVersion": "0.1.3",
"enabled": false
}
1 change: 1 addition & 0 deletions OWML.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IO/@EntryIndexedValue">IO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OW/@EntryIndexedValue">OW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OWML/@EntryIndexedValue">OWML</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Filenames/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Behaviours/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=OWML/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit c0b0df6

Please sign in to comment.