summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.AssemblyRewriters
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-29 14:02:59 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-29 14:02:59 -0500
commit5470e95bf59e5e3bae249ead6909163390fb2af3 (patch)
tree52d6fd8aabd03b1ee30615aa14f954f3df8ecee5 /src/StardewModdingAPI.AssemblyRewriters
parentb425e320558299bf6dd0c9252efec24e63ad3605 (diff)
downloadSMAPI-5470e95bf59e5e3bae249ead6909163390fb2af3.tar.gz
SMAPI-5470e95bf59e5e3bae249ead6909163390fb2af3.tar.bz2
SMAPI-5470e95bf59e5e3bae249ead6909163390fb2af3.zip
add separate project to support upcoming IL rewriting (#166)
Diffstat (limited to 'src/StardewModdingAPI.AssemblyRewriters')
-rw-r--r--src/StardewModdingAPI.AssemblyRewriters/Platform.cs12
-rw-r--r--src/StardewModdingAPI.AssemblyRewriters/PlatformAssemblyMap.cs35
-rw-r--r--src/StardewModdingAPI.AssemblyRewriters/Properties/AssemblyInfo.cs7
-rw-r--r--src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj90
-rw-r--r--src/StardewModdingAPI.AssemblyRewriters/packages.config4
5 files changed, 148 insertions, 0 deletions
diff --git a/src/StardewModdingAPI.AssemblyRewriters/Platform.cs b/src/StardewModdingAPI.AssemblyRewriters/Platform.cs
new file mode 100644
index 00000000..8888a9a8
--- /dev/null
+++ b/src/StardewModdingAPI.AssemblyRewriters/Platform.cs
@@ -0,0 +1,12 @@
+namespace StardewModdingAPI.AssemblyRewriters
+{
+ /// <summary>The game's platform version.</summary>
+ public enum Platform
+ {
+ /// <summary>The Linux/Mac version of the game.</summary>
+ Mono,
+
+ /// <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.AssemblyRewriters/PlatformAssemblyMap.cs
new file mode 100644
index 00000000..c0855719
--- /dev/null
+++ b/src/StardewModdingAPI.AssemblyRewriters/PlatformAssemblyMap.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+
+namespace StardewModdingAPI.AssemblyRewriters
+{
+ /// <summary>Metadata for mapping assemblies to the current <see cref="Platform"/>.</summary>
+ public class PlatformAssemblyMap
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The target game platform.</summary>
+ public readonly Platform TargetPlatform;
+
+ /// <summary>The short assembly names to remove as assembly reference, and replace with the <see cref="Targets"/>. These should be short names (like "Stardew Valley").</summary>
+ public readonly string[] RemoveNames;
+
+ /// <summary>The assembly filenames to target. Equivalent types should be rewritten to use these assemblies.</summary>
+ public readonly Assembly[] Targets;
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="targetPlatform">The target game platform.</param>
+ /// <param name="removeAssemblyNames">The assembly short names to remove (like <c>Stardew Valley</c>).</param>
+ /// <param name="targetAssemblies">The assemblies to target.</param>
+ public PlatformAssemblyMap(Platform targetPlatform, string[] removeAssemblyNames, Assembly[] targetAssemblies)
+ {
+ this.TargetPlatform = targetPlatform;
+ this.RemoveNames = removeAssemblyNames;
+ this.Targets = targetAssemblies;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/StardewModdingAPI.AssemblyRewriters/Properties/AssemblyInfo.cs b/src/StardewModdingAPI.AssemblyRewriters/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..25fbfef9
--- /dev/null
+++ b/src/StardewModdingAPI.AssemblyRewriters/Properties/AssemblyInfo.cs
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 00000000..d87a48bc
--- /dev/null
+++ b/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj
@@ -0,0 +1,90 @@
+<?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)' == '' ">AnyCPU</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|AnyCPU' ">
+ <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|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x86\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SMAPI_FOR_WINDOWS</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+ <OutputPath>bin\x86\Release\</OutputPath>
+ <DefineConstants>TRACE;SMAPI_FOR_WINDOWS</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <Import Project="$(SolutionDir)\dependencies.targets" />
+ <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="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+ <HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\GlobalAssemblyInfo.cs">
+ <Link>Properties\GlobalAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="Platform.cs" />
+ <Compile Include="PlatformAssemblyMap.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup />
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/src/StardewModdingAPI.AssemblyRewriters/packages.config b/src/StardewModdingAPI.AssemblyRewriters/packages.config
new file mode 100644
index 00000000..88fbc79d
--- /dev/null
+++ b/src/StardewModdingAPI.AssemblyRewriters/packages.config
@@ -0,0 +1,4 @@
+<?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