diff options
30 files changed, 68 insertions, 162 deletions
@@ -110,7 +110,6 @@ on the wiki for the first-time setup. Mono.Cecil.dll Newtonsoft.Json.dll StardewModdingAPI - StardewModdingAPI.AssemblyRewriters.dll StardewModdingAPI.config.json StardewModdingAPI.exe StardewModdingAPI.pdb @@ -123,7 +122,6 @@ on the wiki for the first-time setup. Mods/* Mono.Cecil.dll Newtonsoft.Json.dll - StardewModdingAPI.AssemblyRewriters.dll StardewModdingAPI.config.json StardewModdingAPI.exe StardewModdingAPI.pdb diff --git a/src/StardewModdingAPI.AssemblyRewriters/Properties/AssemblyInfo.cs b/src/StardewModdingAPI.AssemblyRewriters/Properties/AssemblyInfo.cs deleted file mode 100644 index 25fbfef9..00000000 --- a/src/StardewModdingAPI.AssemblyRewriters/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("StardewModdingAPI.AssemblyRewriters")] -[assembly: AssemblyDescription("Contains internal SMAPI code for converting mods between Linux/Mac and Windows. This assembly is used by SMAPI internally and shouldn't be referenced directly by mods.")] -[assembly: AssemblyProduct("StardewModdingAPI.CrossplatformRewriters")] -[assembly: Guid("10db0676-9fc1-4771-a2c8-e2519f091e49")] diff --git a/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj b/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj deleted file mode 100644 index 8416bd51..00000000 --- a/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">x86</Platform> - <ProjectGuid>{10DB0676-9FC1-4771-A2C8-E2519F091E49}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>StardewModdingAPI.AssemblyRewriters</RootNamespace> - <AssemblyName>StardewModdingAPI.AssemblyRewriters</AssemblyName> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> - <HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath> - <Private>True</Private> - </Reference> - <Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> - <HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll</HintPath> - <Private>True</Private> - </Reference> - <Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> - <HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll</HintPath> - <Private>True</Private> - </Reference> - <Reference Include="System" /> - </ItemGroup> - <ItemGroup> - <Compile Include="..\GlobalAssemblyInfo.cs"> - <Link>Properties\GlobalAssemblyInfo.cs</Link> - </Compile> - <Compile Include="Finders\EventFinder.cs" /> - <Compile Include="Finders\PropertyFinder.cs" /> - <Compile Include="Finders\FieldFinder.cs" /> - <Compile Include="Finders\MethodFinder.cs" /> - <Compile Include="Finders\TypeFinder.cs" /> - <Compile Include="IncompatibleInstructionException.cs" /> - <Compile Include="RewriteHelper.cs" /> - <Compile Include="IInstructionRewriter.cs" /> - <Compile Include="Platform.cs" /> - <Compile Include="PlatformAssemblyMap.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Rewriters\TypeReferenceRewriter.cs" /> - <Compile Include="Rewriters\FieldReplaceRewriter.cs" /> - <Compile Include="Rewriters\FieldToPropertyRewriter.cs" /> - <Compile Include="Rewriters\MethodParentRewriter.cs" /> - <Compile Include="Rewriters\Wrappers\SpriteBatchWrapper.cs" /> - </ItemGroup> - <ItemGroup> - <None Include="packages.config" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <Import Project="$(SolutionDir)\common.targets" /> -</Project>
\ No newline at end of file diff --git a/src/StardewModdingAPI.AssemblyRewriters/packages.config b/src/StardewModdingAPI.AssemblyRewriters/packages.config deleted file mode 100644 index 88fbc79d..00000000 --- a/src/StardewModdingAPI.AssemblyRewriters/packages.config +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> - <package id="Mono.Cecil" version="0.9.6.4" targetFramework="net452" /> -</packages>
\ No newline at end of file diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs index 01288f33..b52529a6 100644 --- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs +++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -81,7 +81,6 @@ namespace StardewModdingApi.Installer yield return GetInstallPath("StardewModdingAPI.exe"); yield return GetInstallPath("StardewModdingAPI.config.json"); yield return GetInstallPath("StardewModdingAPI.data.json"); - yield return GetInstallPath("StardewModdingAPI.AssemblyRewriters.dll"); yield return GetInstallPath("System.ValueTuple.dll"); yield return GetInstallPath("steam_appid.txt"); @@ -98,7 +97,8 @@ namespace StardewModdingApi.Installer // obsolete yield return GetInstallPath("Mods/.cache"); // 1.3-1.4 yield return GetInstallPath("Mono.Cecil.Rocks.dll"); // 1.3–1.8 - yield return GetInstallPath("StardewModdingAPI-settings.json"); // 1.0-1.4 + yield return GetInstallPath("StardewModdingAPI-settings.json"); // 1.0–1.4 + yield return GetInstallPath("StardewModdingAPI.AssemblyRewriters.dll"); // 1.3–1.15.4 if (modsDir.Exists) { foreach (DirectoryInfo modDir in modsDir.EnumerateDirectories()) diff --git a/src/StardewModdingAPI.sln b/src/StardewModdingAPI.sln index 9c3f18f8..a2e0ec44 100644 --- a/src/StardewModdingAPI.sln +++ b/src/StardewModdingAPI.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 +VisualStudioVersion = 15.0.26730.15 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrainerMod", "TrainerMod\TrainerMod.csproj", "{28480467-1A48-46A7-99F8-236D95225359}" EndProject @@ -27,8 +27,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewModdingAPI.Installer {F1A573B0-F436-472C-AE29-0B91EA6B9F8F} = {F1A573B0-F436-472C-AE29-0B91EA6B9F8F} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewModdingAPI.AssemblyRewriters", "StardewModdingAPI.AssemblyRewriters\StardewModdingAPI.AssemblyRewriters.csproj", "{10DB0676-9FC1-4771-A2C8-E2519F091E49}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewModdingAPI.Tests", "StardewModdingAPI.Tests\StardewModdingAPI.Tests.csproj", "{36CCB19E-92EB-48C7-9615-98EEFD45109B}" EndProject Global @@ -71,16 +69,6 @@ Global {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Mixed Platforms.Build.0 = Release|x86 {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.ActiveCfg = Release|x86 {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.Build.0 = Release|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Any CPU.ActiveCfg = Debug|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|x86.ActiveCfg = Debug|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|x86.Build.0 = Debug|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Any CPU.ActiveCfg = Release|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Mixed Platforms.Build.0 = Release|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|x86.ActiveCfg = Release|x86 - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|x86.Build.0 = Release|x86 {36CCB19E-92EB-48C7-9615-98EEFD45109B}.Debug|Any CPU.ActiveCfg = Debug|x86 {36CCB19E-92EB-48C7-9615-98EEFD45109B}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {36CCB19E-92EB-48C7-9615-98EEFD45109B}.Debug|Mixed Platforms.Build.0 = Debug|x86 diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs index fea9377a..4bbd7328 100644 --- a/src/StardewModdingAPI/Constants.cs +++ b/src/StardewModdingAPI/Constants.cs @@ -4,12 +4,12 @@ using System.IO; using System.Linq; using System.Reflection; using Microsoft.Xna.Framework.Graphics; -using StardewModdingAPI.AssemblyRewriters; -using StardewModdingAPI.AssemblyRewriters.Finders; -using StardewModdingAPI.AssemblyRewriters.Rewriters; -using StardewModdingAPI.AssemblyRewriters.Rewriters.Wrappers; using StardewModdingAPI.Events; using StardewModdingAPI.Framework; +using StardewModdingAPI.Framework.ModLoading; +using StardewModdingAPI.Framework.ModLoading.Finders; +using StardewModdingAPI.Framework.ModLoading.Rewriters; +using StardewModdingAPI.Framework.ModLoading.Rewriters.Wrappers; using StardewValley; namespace StardewModdingAPI diff --git a/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs b/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs index 9c642bef..27a81038 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Reflection; using Mono.Cecil; using Mono.Cecil.Cil; -using StardewModdingAPI.AssemblyRewriters; using StardewModdingAPI.Framework.Exceptions; namespace StardewModdingAPI.Framework.ModLoading @@ -270,8 +269,7 @@ namespace StardewModdingAPI.Framework.ModLoading return; // get assembly - Assembly assembly; - if (!this.TypeAssemblies.TryGetValue(type.FullName, out assembly)) + if (!this.TypeAssemblies.TryGetValue(type.FullName, out Assembly assembly)) return; // replace scope diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/EventFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/EventFinder.cs index c0051469..ce234e39 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/EventFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/EventFinder.cs @@ -1,10 +1,10 @@ -using Mono.Cecil; +using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters.Finders +namespace StardewModdingAPI.Framework.ModLoading.Finders { /// <summary>Finds incompatible CIL instructions that reference a given event and throws an <see cref="IncompatibleInstructionException"/>.</summary> - public class EventFinder : IInstructionRewriter + internal class EventFinder : IInstructionRewriter { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/FieldFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/FieldFinder.cs index b44883e9..2feaf2e6 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/FieldFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/FieldFinder.cs @@ -1,10 +1,10 @@ using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters.Finders +namespace StardewModdingAPI.Framework.ModLoading.Finders { /// <summary>Finds incompatible CIL instructions that reference a given field and throws an <see cref="IncompatibleInstructionException"/>.</summary> - public class FieldFinder : IInstructionRewriter + internal class FieldFinder : IInstructionRewriter { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/MethodFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/MethodFinder.cs index 19dda58a..c3bb36e3 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/MethodFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/MethodFinder.cs @@ -1,10 +1,10 @@ -using Mono.Cecil; +using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters.Finders +namespace StardewModdingAPI.Framework.ModLoading.Finders { /// <summary>Finds incompatible CIL instructions that reference a given method and throws an <see cref="IncompatibleInstructionException"/>.</summary> - public class MethodFinder : IInstructionRewriter + internal class MethodFinder : IInstructionRewriter { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/PropertyFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/PropertyFinder.cs index 441f15f2..d1fed84b 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/PropertyFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/PropertyFinder.cs @@ -1,10 +1,10 @@ using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters.Finders +namespace StardewModdingAPI.Framework.ModLoading.Finders { /// <summary>Finds incompatible CIL instructions that reference a given property and throws an <see cref="IncompatibleInstructionException"/>.</summary> - public class PropertyFinder : IInstructionRewriter + internal class PropertyFinder : IInstructionRewriter { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/TypeFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/TypeFinder.cs index 0560e38e..e67e6766 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/TypeFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/TypeFinder.cs @@ -2,10 +2,10 @@ using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters.Finders +namespace StardewModdingAPI.Framework.ModLoading.Finders { /// <summary>Finds incompatible CIL instructions that reference a given type and throws an <see cref="IncompatibleInstructionException"/>.</summary> - public class TypeFinder : IInstructionRewriter + internal class TypeFinder : IInstructionRewriter { /********* ** Accessors diff --git a/src/StardewModdingAPI.AssemblyRewriters/IInstructionRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs index 2f16b23d..9b35cdae 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/IInstructionRewriter.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs @@ -1,10 +1,10 @@ -using Mono.Cecil; +using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters +namespace StardewModdingAPI.Framework.ModLoading { /// <summary>Rewrites CIL instructions for compatibility.</summary> - public interface IInstructionRewriter + internal interface IInstructionRewriter { /********* ** Accessors diff --git a/src/StardewModdingAPI.AssemblyRewriters/IncompatibleInstructionException.cs b/src/StardewModdingAPI/Framework/ModLoading/IncompatibleInstructionException.cs index f7e6bd8f..17ec24b1 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/IncompatibleInstructionException.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/IncompatibleInstructionException.cs @@ -1,9 +1,9 @@ -using System; +using System; -namespace StardewModdingAPI.AssemblyRewriters +namespace StardewModdingAPI.Framework.ModLoading { /// <summary>An exception raised when an incompatible instruction is found while loading a mod assembly.</summary> - public class IncompatibleInstructionException : Exception + internal class IncompatibleInstructionException : Exception { /********* ** Accessors diff --git a/src/StardewModdingAPI/Framework/ModLoading/InvalidModStateException.cs b/src/StardewModdingAPI/Framework/ModLoading/InvalidModStateException.cs index ab11272a..075e237a 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/InvalidModStateException.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/InvalidModStateException.cs @@ -1,9 +1,9 @@ -using System; +using System; namespace StardewModdingAPI.Framework.ModLoading { /// <summary>An exception which indicates that something went seriously wrong while loading mods, and SMAPI should abort outright.</summary> - public class InvalidModStateException : Exception + internal class InvalidModStateException : Exception { /// <summary>Construct an instance.</summary> /// <param name="message">The error message.</param> diff --git a/src/StardewModdingAPI/Framework/ModLoading/ModMetadataStatus.cs b/src/StardewModdingAPI/Framework/ModLoading/ModMetadataStatus.cs index 1b2b0b55..ab65f7b4 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/ModMetadataStatus.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/ModMetadataStatus.cs @@ -1,4 +1,4 @@ -namespace StardewModdingAPI.Framework.ModLoading +namespace StardewModdingAPI.Framework.ModLoading { /// <summary>Indicates the status of a mod's metadata resolution.</summary> internal enum ModMetadataStatus @@ -9,4 +9,4 @@ /// <summary>The mod cannot be loaded.</summary> Failed } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI.AssemblyRewriters/Platform.cs b/src/StardewModdingAPI/Framework/ModLoading/Platform.cs index 8888a9a8..45e881c4 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Platform.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Platform.cs @@ -1,7 +1,7 @@ -namespace StardewModdingAPI.AssemblyRewriters +namespace StardewModdingAPI.Framework.ModLoading { /// <summary>The game's platform version.</summary> - public enum Platform + internal enum Platform { /// <summary>The Linux/Mac version of the game.</summary> Mono, @@ -9,4 +9,4 @@ namespace StardewModdingAPI.AssemblyRewriters /// <summary>The Windows version of the game.</summary> Windows } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI.AssemblyRewriters/PlatformAssemblyMap.cs b/src/StardewModdingAPI/Framework/ModLoading/PlatformAssemblyMap.cs index fce2b187..463f45e8 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/PlatformAssemblyMap.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/PlatformAssemblyMap.cs @@ -3,10 +3,10 @@ using System.Linq; using System.Reflection; using Mono.Cecil; -namespace StardewModdingAPI.AssemblyRewriters +namespace StardewModdingAPI.Framework.ModLoading { /// <summary>Metadata for mapping assemblies to the current <see cref="Platform"/>.</summary> - public class PlatformAssemblyMap + internal class PlatformAssemblyMap { /********* ** Accessors diff --git a/src/StardewModdingAPI.AssemblyRewriters/RewriteHelper.cs b/src/StardewModdingAPI/Framework/ModLoading/RewriteHelper.cs index cfb330dd..56a60a72 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/RewriteHelper.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/RewriteHelper.cs @@ -4,7 +4,7 @@ using System.Reflection; using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters +namespace StardewModdingAPI.Framework.ModLoading { /// <summary>Provides helper methods for field rewriters.</summary> internal static class RewriteHelper diff --git a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/FieldReplaceRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs index 73844073..7b838f13 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/FieldReplaceRewriter.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs @@ -2,12 +2,12 @@ using System; using System.Reflection; using Mono.Cecil; using Mono.Cecil.Cil; -using StardewModdingAPI.AssemblyRewriters.Finders; +using StardewModdingAPI.Framework.ModLoading.Finders; -namespace StardewModdingAPI.AssemblyRewriters.Rewriters +namespace StardewModdingAPI.Framework.ModLoading.Rewriters { /// <summary>Rewrites references to one field with another.</summary> - public class FieldReplaceRewriter : FieldFinder + internal class FieldReplaceRewriter : FieldFinder { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/FieldToPropertyRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldToPropertyRewriter.cs index 3f57042d..8ef14103 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/FieldToPropertyRewriter.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldToPropertyRewriter.cs @@ -1,12 +1,12 @@ using System; using Mono.Cecil; using Mono.Cecil.Cil; -using StardewModdingAPI.AssemblyRewriters.Finders; +using StardewModdingAPI.Framework.ModLoading.Finders; -namespace StardewModdingAPI.AssemblyRewriters.Rewriters +namespace StardewModdingAPI.Framework.ModLoading.Rewriters { /// <summary>Rewrites field references into property references.</summary> - public class FieldToPropertyRewriter : FieldFinder + internal class FieldToPropertyRewriter : FieldFinder { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/MethodParentRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs index 035ef211..1b95b83b 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/MethodParentRewriter.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs @@ -2,10 +2,10 @@ using System; using Mono.Cecil; using Mono.Cecil.Cil; -namespace StardewModdingAPI.AssemblyRewriters.Rewriters +namespace StardewModdingAPI.Framework.ModLoading.Rewriters { /// <summary>Rewrites method references from one parent type to another if the signatures match.</summary> - public class MethodParentRewriter : IInstructionRewriter + internal class MethodParentRewriter : IInstructionRewriter { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/TypeReferenceRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs index da6d9bc9..2c444b64 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/TypeReferenceRewriter.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs @@ -1,12 +1,12 @@ using System; using Mono.Cecil; using Mono.Cecil.Cil; -using StardewModdingAPI.AssemblyRewriters.Finders; +using StardewModdingAPI.Framework.ModLoading.Finders; -namespace StardewModdingAPI.AssemblyRewriters.Rewriters +namespace StardewModdingAPI.Framework.ModLoading.Rewriters { /// <summary>Rewrites all references to a type.</summary> - public class TypeReferenceRewriter : TypeFinder + internal class TypeReferenceRewriter : TypeFinder { /********* ** Properties diff --git a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/Wrappers/SpriteBatchWrapper.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/Wrappers/SpriteBatchWrapper.cs index ee68f1d5..7a631f69 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/Wrappers/SpriteBatchWrapper.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/Wrappers/SpriteBatchWrapper.cs @@ -2,10 +2,10 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -namespace StardewModdingAPI.AssemblyRewriters.Rewriters.Wrappers +namespace StardewModdingAPI.Framework.ModLoading.Rewriters.Wrappers { /// <summary>Wraps <see cref="SpriteBatch"/> methods that are incompatible when converting compiled code between MonoGame and XNA.</summary> - public class SpriteBatchWrapper : SpriteBatch + internal class SpriteBatchWrapper : SpriteBatch { /********* ** Public methods @@ -56,4 +56,4 @@ namespace StardewModdingAPI.AssemblyRewriters.Rewriters.Wrappers base.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, transformMatrix); } } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI/Framework/SContentManager.cs b/src/StardewModdingAPI/Framework/SContentManager.cs index 9553e79f..33403841 100644 --- a/src/StardewModdingAPI/Framework/SContentManager.cs +++ b/src/StardewModdingAPI/Framework/SContentManager.cs @@ -6,8 +6,8 @@ using System.Linq; using System.Reflection; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; -using StardewModdingAPI.AssemblyRewriters; using StardewModdingAPI.Framework.Content; +using StardewModdingAPI.Framework.ModLoading; using StardewModdingAPI.Framework.Reflection; using StardewModdingAPI.Framework.Utilities; using StardewModdingAPI.Metadata; diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index ad873598..c1165216 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -12,7 +12,6 @@ using System.Management; using System.Windows.Forms; #endif using Newtonsoft.Json; -using StardewModdingAPI.AssemblyRewriters; using StardewModdingAPI.Events; using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.Exceptions; diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj index 8daf21b7..5f59d125 100644 --- a/src/StardewModdingAPI/StardewModdingAPI.csproj +++ b/src/StardewModdingAPI/StardewModdingAPI.csproj @@ -91,9 +91,25 @@ <Link>Properties\GlobalAssemblyInfo.cs</Link> </Compile> <Compile Include="Command.cs" /> + <Compile Include="Framework\ModLoading\Finders\EventFinder.cs" /> + <Compile Include="Framework\ModLoading\Finders\FieldFinder.cs" /> + <Compile Include="Framework\ModLoading\Finders\MethodFinder.cs" /> + <Compile Include="Framework\ModLoading\Finders\PropertyFinder.cs" /> + <Compile Include="Framework\ModLoading\Finders\TypeFinder.cs" /> + <Compile Include="Framework\ModLoading\IInstructionRewriter.cs" /> + <Compile Include="Framework\ModLoading\IncompatibleInstructionException.cs" /> + <Compile Include="Framework\ModLoading\Platform.cs" /> + <Compile Include="Framework\ModLoading\PlatformAssemblyMap.cs" /> + <Compile Include="Framework\ModLoading\RewriteHelper.cs" /> + <Compile Include="Framework\ModLoading\Rewriters\FieldReplaceRewriter.cs" /> + <Compile Include="Framework\ModLoading\Rewriters\FieldToPropertyRewriter.cs" /> + <Compile Include="Framework\ModLoading\Rewriters\MethodParentRewriter.cs" /> + <Compile Include="Framework\ModLoading\Rewriters\TypeReferenceRewriter.cs" /> + <Compile Include="Framework\ModLoading\Rewriters\Wrappers\SpriteBatchWrapper.cs" /> <Compile Include="Framework\ContentManagerShim.cs" /> <Compile Include="Framework\Exceptions\SAssemblyLoadFailedException.cs" /> <Compile Include="Framework\ModLoading\AssemblyLoadStatus.cs" /> + <Compile Include="Framework\ModLoading\DangerousCodeWarner.cs" /> <Compile Include="Framework\Utilities\ContextHash.cs" /> <Compile Include="Metadata\CoreAssets.cs" /> <Compile Include="ContentSource.cs" /> @@ -257,12 +273,6 @@ <Install>false</Install> </BootstrapperPackage> </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\StardewModdingAPI.AssemblyRewriters\StardewModdingAPI.AssemblyRewriters.csproj"> - <Project>{10db0676-9fc1-4771-a2c8-e2519f091e49}</Project> - <Name>StardewModdingAPI.AssemblyRewriters</Name> - </ProjectReference> - </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(SolutionDir)\common.targets" /> </Project>
\ No newline at end of file diff --git a/src/common.targets b/src/common.targets index ee138524..c450b3a5 100644 --- a/src/common.targets +++ b/src/common.targets @@ -83,7 +83,6 @@ <Target Name="CopySMAPI" Condition="'$(MSBuildProjectName)' == 'StardewModdingAPI'"> <Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFolder="$(GamePath)" /> <Copy SourceFiles="$(TargetDir)\$(TargetName).config.json" DestinationFolder="$(GamePath)" /> - <Copy SourceFiles="$(TargetDir)\StardewModdingAPI.AssemblyRewriters.dll" DestinationFolder="$(GamePath)" /> <Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(GamePath)" /> <Copy SourceFiles="$(TargetDir)\$(TargetName).xml" DestinationFolder="$(GamePath)" /> <Copy SourceFiles="$(TargetDir)\Newtonsoft.Json.dll" DestinationFolder="$(GamePath)" /> diff --git a/src/prepare-install-package.targets b/src/prepare-install-package.targets index f2a2b23c..44997fef 100644 --- a/src/prepare-install-package.targets +++ b/src/prepare-install-package.targets @@ -27,7 +27,6 @@ <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.exe" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.pdb" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.xml" DestinationFolder="$(PackageInternalPath)\Mono" /> - <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.AssemblyRewriters.dll" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.config.json" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\System.Numerics.dll" DestinationFolder="$(PackageInternalPath)\Mono" /> <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\System.Runtime.Caching.dll" DestinationFolder="$(PackageInternalPath)\Mono" /> @@ -41,7 +40,6 @@ <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.exe" DestinationFolder="$(PackageInternalPath)\Windows" /> <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.pdb" DestinationFolder="$(PackageInternalPath)\Windows" /> <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.xml" DestinationFolder="$(PackageInternalPath)\Windows" /> - <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.AssemblyRewriters.dll" DestinationFolder="$(PackageInternalPath)\Windows" /> <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\StardewModdingAPI.config.json" DestinationFolder="$(PackageInternalPath)\Windows" /> <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\steam_appid.txt" DestinationFolder="$(PackageInternalPath)\Windows" /> <Copy Condition="$(OS) == 'Windows_NT'" SourceFiles="@(CompiledMods)" DestinationFolder="$(PackageInternalPath)\Windows\Mods\%(RecursiveDir)" /> |