This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,160 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace NeosModLoader | ||
{ | ||
public class ConfigurationChangedEvent | ||
{ | ||
/// <summary> | ||
/// The configuration the change occurred in | ||
/// </summary> | ||
public ModConfiguration Config { get; private set; } | ||
|
||
/// <summary> | ||
/// The specific key who's value changed | ||
/// </summary> | ||
public ModConfigurationKey Key { get; private set; } | ||
|
||
/// <summary> | ||
/// A custom label that may be set by whoever changed the configuration | ||
/// </summary> | ||
public string Label { get; private set; } | ||
|
||
internal ConfigurationChangedEvent(ModConfiguration config, ModConfigurationKey key, string label) | ||
{ | ||
Config = config; | ||
Key = key; | ||
Label = label; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
|
||
namespace NeosModLoader | ||
{ | ||
internal class DebugInfo | ||
{ | ||
internal static void Log() | ||
{ | ||
Logger.MsgInternal($"NeosModLoader v{ModLoader.VERSION} starting up!{(ModLoaderConfiguration.get().Debug ? " Debug logs will be shown." : "")}"); | ||
Logger.MsgInternal($"Using Harmony v{GetAssemblyVersion(typeof(HarmonyLib.Harmony))}"); | ||
Logger.MsgInternal($"Using BaseX v{GetAssemblyVersion(typeof(BaseX.floatQ))}"); | ||
Logger.MsgInternal($"Using FrooxEngine v{GetAssemblyVersion(typeof(FrooxEngine.IComponent))}"); | ||
Logger.MsgInternal($"Using Json.NET v{GetAssemblyVersion(typeof(Newtonsoft.Json.JsonSerializer))}"); | ||
} | ||
|
||
private static string GetAssemblyVersion(Type typeFromAssembly) | ||
{ | ||
return typeFromAssembly.Assembly.GetName()?.Version?.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace NeosModLoader | ||
{ | ||
internal static class DelegateExtensions | ||
{ | ||
internal static void SafeInvoke(this Delegate del, params object[] args) | ||
{ | ||
var exceptions = new List<Exception>(); | ||
|
||
foreach (var handler in del.GetInvocationList()) | ||
{ | ||
try | ||
{ | ||
handler.Method.Invoke(handler.Target, args); | ||
} | ||
catch (Exception ex) | ||
{ | ||
exceptions.Add(ex); | ||
} | ||
} | ||
|
||
if (exceptions.Any()) | ||
{ | ||
throw new AggregateException(exceptions); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace NeosModLoader | ||
{ | ||
internal class LoadedNeosMod | ||
{ | ||
internal LoadedNeosMod(NeosMod neosMod, ModAssembly modAssembly) | ||
{ | ||
NeosMod = neosMod; | ||
ModAssembly = modAssembly; | ||
} | ||
|
||
internal NeosMod NeosMod { get; private set; } | ||
internal ModAssembly ModAssembly { get; private set; } | ||
internal ModConfiguration ModConfiguration { get; set; } | ||
internal bool AllowSavingConfiguration = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Reflection; | ||
|
||
namespace NeosModLoader | ||
{ | ||
internal class ModAssembly | ||
{ | ||
internal string File { get; } | ||
internal Assembly Assembly { get; set; } | ||
internal ModAssembly(string file) | ||
{ | ||
File = file; | ||
} | ||
} | ||
} |
Oops, something went wrong.