diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI/Constants.cs | 5 | ||||
-rw-r--r-- | src/SMAPI/Framework/Content/ContentCache.cs | 2 | ||||
-rw-r--r-- | src/SMAPI/Framework/Monitor.cs | 2 | ||||
-rw-r--r-- | src/SMAPI/GamePlatform.cs | 17 | ||||
-rw-r--r-- | src/SMAPI/Program.cs | 4 | ||||
-rw-r--r-- | src/SMAPI/StardewModdingAPI.csproj | 1 |
6 files changed, 26 insertions, 5 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 0116ac42..2ef26704 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -46,6 +46,9 @@ namespace StardewModdingAPI /// <summary>The maximum supported version of Stardew Valley.</summary> public static ISemanticVersion MaximumGameVersion { get; } = null; + /// <summary>The target game platform.</summary> + public static GamePlatform TargetPlatform => (GamePlatform)Constants.Platform; + /// <summary>The path to the game folder.</summary> public static string ExecutionPath { get; } = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); @@ -92,7 +95,7 @@ namespace StardewModdingAPI internal static ISemanticVersion GameVersion { get; } = new GameVersion(Constants.GetGameVersion()); /// <summary>The target game platform.</summary> - internal static Platform TargetPlatform { get; } = EnvironmentUtility.DetectPlatform(); + internal static Platform Platform { get; } = EnvironmentUtility.DetectPlatform(); /********* diff --git a/src/SMAPI/Framework/Content/ContentCache.cs b/src/SMAPI/Framework/Content/ContentCache.cs index 8851fc7d..c2818cdd 100644 --- a/src/SMAPI/Framework/Content/ContentCache.cs +++ b/src/SMAPI/Framework/Content/ContentCache.cs @@ -53,7 +53,7 @@ namespace StardewModdingAPI.Framework.Content this.Cache = reflection.GetField<Dictionary<string, object>>(contentManager, "loadedAssets").GetValue(); // get key normalisation logic - if (Constants.TargetPlatform == Platform.Windows) + if (Constants.Platform == Platform.Windows) { IReflectedMethod method = reflection.GetMethod(typeof(TitleContainer), "GetCleanPath"); this.NormaliseAssetNameForPlatform = path => method.Invoke<string>(path); diff --git a/src/SMAPI/Framework/Monitor.cs b/src/SMAPI/Framework/Monitor.cs index 73915824..8df2e59b 100644 --- a/src/SMAPI/Framework/Monitor.cs +++ b/src/SMAPI/Framework/Monitor.cs @@ -167,7 +167,7 @@ namespace StardewModdingAPI.Framework // auto detect color scheme if (colorScheme == MonitorColorScheme.AutoDetect) { - if (Constants.TargetPlatform == Platform.Mac) + if (Constants.Platform == Platform.Mac) colorScheme = MonitorColorScheme.LightBackground; // MacOS doesn't provide console background color info, but it's usually white. else colorScheme = Monitor.IsDark(Console.BackgroundColor) ? MonitorColorScheme.DarkBackground : MonitorColorScheme.LightBackground; diff --git a/src/SMAPI/GamePlatform.cs b/src/SMAPI/GamePlatform.cs new file mode 100644 index 00000000..3bd74462 --- /dev/null +++ b/src/SMAPI/GamePlatform.cs @@ -0,0 +1,17 @@ +using StardewModdingAPI.Internal; + +namespace StardewModdingAPI +{ + /// <summary>The game's platform version.</summary> + public enum GamePlatform + { + /// <summary>The Linux version of the game.</summary> + Linux = Platform.Linux, + + /// <summary>The Mac version of the game.</summary> + Mac = Platform.Mac, + + /// <summary>The Windows version of the game.</summary> + Windows = Platform.Windows + } +} diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 6b7c1ad3..ba3e238d 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -172,7 +172,7 @@ namespace StardewModdingAPI try { // init logging - this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.TargetPlatform)}", LogLevel.Info); + this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info); this.Monitor.Log($"Mods go here: {Constants.ModPath}"); this.Monitor.Log($"Log started at {DateTime.UtcNow:s} UTC", LogLevel.Trace); @@ -741,7 +741,7 @@ namespace StardewModdingAPI ); // get assembly loaders - AssemblyLoader modAssemblyLoader = new AssemblyLoader(Constants.TargetPlatform, this.Monitor, this.Settings.DeveloperMode); + AssemblyLoader modAssemblyLoader = new AssemblyLoader(Constants.Platform, this.Monitor, this.Settings.DeveloperMode); AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => modAssemblyLoader.ResolveAssembly(e.Name); InterfaceProxyFactory proxyFactory = new InterfaceProxyFactory(); diff --git a/src/SMAPI/StardewModdingAPI.csproj b/src/SMAPI/StardewModdingAPI.csproj index a06056f9..31bfd6fd 100644 --- a/src/SMAPI/StardewModdingAPI.csproj +++ b/src/SMAPI/StardewModdingAPI.csproj @@ -262,6 +262,7 @@ <Compile Include="Metadata\InstructionMetadata.cs" /> <Compile Include="Mod.cs" /> <Compile Include="PatchMode.cs" /> + <Compile Include="GamePlatform.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Framework\SGame.cs" /> |