diff options
-rw-r--r-- | StardewModdingAPI/Constants.cs | 2 | ||||
-rw-r--r-- | StardewModdingAPI/FodyWeavers.xml | 5 | ||||
-rw-r--r-- | StardewModdingAPI/Program.cs | 66 | ||||
-rw-r--r-- | StardewModdingAPI/StardewModdingAPI.csproj | 14 | ||||
-rw-r--r-- | StardewModdingAPI/packages.config | 2 | ||||
-rw-r--r-- | TrainerMod/FodyWeavers.xml | 4 | ||||
-rw-r--r-- | TrainerMod/TrainerMod.csproj | 11 |
7 files changed, 63 insertions, 41 deletions
diff --git a/StardewModdingAPI/Constants.cs b/StardewModdingAPI/Constants.cs index 6812fbee..071f0435 100644 --- a/StardewModdingAPI/Constants.cs +++ b/StardewModdingAPI/Constants.cs @@ -35,7 +35,7 @@ namespace StardewModdingAPI public const int MinorVersion = 38; - public const int PatchVersion = 0; + public const int PatchVersion = 1; public const string Build = "Alpha"; diff --git a/StardewModdingAPI/FodyWeavers.xml b/StardewModdingAPI/FodyWeavers.xml new file mode 100644 index 00000000..2e6d4a7a --- /dev/null +++ b/StardewModdingAPI/FodyWeavers.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<Weavers> + <Costura/> + +</Weavers>
\ No newline at end of file diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index bb863ca4..cde2dfbc 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -342,41 +342,41 @@ namespace StardewModdingAPI /// </summary>
public static void LoadMods_OldWay()
{
- StardewModdingAPI.Log.Verbose("LOADING MODS (OLD WAY - DEPRECATED. ANY MODS LOADED THIS WAY NEED TO UPDATE)"); - int loadedMods = 0; - foreach (string ModPath in _modPaths) - { - foreach (String s in Directory.GetFiles(ModPath, "*.dll")) - { - if (s.Contains("StardewInjector")) - continue; - StardewModdingAPI.Log.Success("Found DLL: " + s); - try - { - Assembly mod = Assembly.UnsafeLoadFrom(s); //to combat internet-downloaded DLLs - - if (mod.DefinedTypes.Count(x => x.BaseType == typeof(Mod)) > 0) - { - StardewModdingAPI.Log.Verbose("Loading Mod DLL..."); - TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof(Mod)); + StardewModdingAPI.Log.Verbose("LOADING MODS (OLD WAY - DEPRECATED. ANY MODS LOADED THIS WAY NEED TO UPDATE)");
+ int loadedMods = 0;
+ foreach (string ModPath in _modPaths)
+ {
+ foreach (String s in Directory.GetFiles(ModPath, "*.dll"))
+ {
+ if (s.Contains("StardewInjector"))
+ continue;
+ StardewModdingAPI.Log.Success("Found DLL: " + s);
+ try
+ {
+ Assembly mod = Assembly.UnsafeLoadFrom(s); //to combat internet-downloaded DLLs
+
+ if (mod.DefinedTypes.Count(x => x.BaseType == typeof(Mod)) > 0)
+ {
+ StardewModdingAPI.Log.Verbose("Loading Mod DLL...");
+ TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof(Mod));
Mod m = (Mod)mod.CreateInstance(tar.ToString());
m.Manifest = null;
- m.PathOnDisk = Path.GetDirectoryName(s); - Console.WriteLine("LOADED MOD: {0} by {1} - Version {2} | Description: {3}", m.Name, m.Authour, m.Version, m.Description); - loadedMods += 1; - m.Entry(); - } - else - { - StardewModdingAPI.Log.Error("Invalid Mod DLL"); - } - } - catch (Exception ex) - { - StardewModdingAPI.Log.Error("Failed to load mod '{0}'. Exception details:\n" + ex, s); - } - } - } + m.PathOnDisk = Path.GetDirectoryName(s);
+ Console.WriteLine("LOADED MOD: {0} by {1} - Version {2} | Description: {3}", m.Name, m.Authour, m.Version, m.Description);
+ loadedMods += 1;
+ m.Entry();
+ }
+ else
+ {
+ StardewModdingAPI.Log.Error("Invalid Mod DLL");
+ }
+ }
+ catch (Exception ex)
+ {
+ StardewModdingAPI.Log.Error("Failed to load mod '{0}'. Exception details:\n" + ex, s);
+ }
+ }
+ }
StardewModdingAPI.Log.Success("LOADED {0} MODS THAT NEED TO UPDATE", loadedMods);
}
diff --git a/StardewModdingAPI/StardewModdingAPI.csproj b/StardewModdingAPI/StardewModdingAPI.csproj index c2f286ce..2f217795 100644 --- a/StardewModdingAPI/StardewModdingAPI.csproj +++ b/StardewModdingAPI/StardewModdingAPI.csproj @@ -19,6 +19,8 @@ </SccAuxPath>
<SccProvider>
</SccProvider>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -31,10 +33,10 @@ <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
- <TargetFrameworkProfile />
+ <NuGetPackageImportStamp>
+ </NuGetPackageImportStamp>
</PropertyGroup>
<Choose>
<When Condition="'$(SteamInstallPath)' != ''">
@@ -162,6 +164,7 @@ <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
+ <Content Include="FodyWeavers.xml" />
<Content Include="icon.ico" />
<Content Include="steam_appid.txt" />
</ItemGroup>
@@ -182,6 +185,13 @@ <PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
+ <Import Project="..\packages\Fody.1.28.3\build\Fody.targets" Condition="Exists('..\packages\Fody.1.28.3\build\Fody.targets')" />
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('..\packages\Fody.1.28.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.28.3\build\Fody.targets'))" />
+ </Target>
<!-- 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"> diff --git a/StardewModdingAPI/packages.config b/StardewModdingAPI/packages.config index 583acbdf..28d59862 100644 --- a/StardewModdingAPI/packages.config +++ b/StardewModdingAPI/packages.config @@ -1,4 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> + <package id="Costura.Fody" version="1.3.3.0" targetFramework="net45" developmentDependency="true" /> + <package id="Fody" version="1.28.3" targetFramework="net45" developmentDependency="true" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/TrainerMod/FodyWeavers.xml b/TrainerMod/FodyWeavers.xml new file mode 100644 index 00000000..52e39c5e --- /dev/null +++ b/TrainerMod/FodyWeavers.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Weavers> + +</Weavers>
\ No newline at end of file diff --git a/TrainerMod/TrainerMod.csproj b/TrainerMod/TrainerMod.csproj index 8f1a494f..1638a3c8 100644 --- a/TrainerMod/TrainerMod.csproj +++ b/TrainerMod/TrainerMod.csproj @@ -12,12 +12,14 @@ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
+ <NuGetPackageImportStamp>
+ </NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>..\StardewModdingAPI\bin\x86\Debug\Mods\</OutputPath>
+ <OutputPath>..\StardewModdingAPI\bin\x86\Debug\Mods\TrainerMod\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -52,10 +54,6 @@ <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
- <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="Stardew Valley">
<HintPath>$(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
<Private>False</Private>
@@ -90,6 +88,9 @@ </None>
<None Include="packages.config" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="FodyWeavers.xml" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
|