summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-07-03 01:29:56 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-07-03 01:29:56 -0400
commit136525b40df5d47b8e398a394af081e19efcf86c (patch)
tree4ed33b821b9491c8a865d060eac09ab37086f36a /src
parent771263299cae11d464c25c5291e59507c639e822 (diff)
downloadSMAPI-136525b40df5d47b8e398a394af081e19efcf86c.tar.gz
SMAPI-136525b40df5d47b8e398a394af081e19efcf86c.tar.bz2
SMAPI-136525b40df5d47b8e398a394af081e19efcf86c.zip
remove System.ValueTuple
This caused reference errors on Linux/Mac, and there aren't enough use cases to look into it further for now.
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI.Tests/StardewModdingAPI.Tests.csproj3
-rw-r--r--src/StardewModdingAPI.Tests/packages.config1
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs2
-rw-r--r--src/StardewModdingAPI/Framework/SContentManager.cs24
-rw-r--r--src/StardewModdingAPI/StardewModdingAPI.csproj3
-rw-r--r--src/StardewModdingAPI/packages.config1
-rw-r--r--src/prepare-install-package.targets1
7 files changed, 13 insertions, 22 deletions
diff --git a/src/StardewModdingAPI.Tests/StardewModdingAPI.Tests.csproj b/src/StardewModdingAPI.Tests/StardewModdingAPI.Tests.csproj
index 7129cfb7..9bfd7567 100644
--- a/src/StardewModdingAPI.Tests/StardewModdingAPI.Tests.csproj
+++ b/src/StardewModdingAPI.Tests/StardewModdingAPI.Tests.csproj
@@ -43,9 +43,6 @@
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
- <Reference Include="System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
- <HintPath>..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyInfo.cs">
diff --git a/src/StardewModdingAPI.Tests/packages.config b/src/StardewModdingAPI.Tests/packages.config
index 7ba8c7b2..ba954308 100644
--- a/src/StardewModdingAPI.Tests/packages.config
+++ b/src/StardewModdingAPI.Tests/packages.config
@@ -4,5 +4,4 @@
<package id="Moq" version="4.7.10" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NUnit" version="3.6.1" targetFramework="net452" />
- <package id="System.ValueTuple" version="4.3.1" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
index ceb51bbb..9c56aaa4 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
@@ -228,7 +228,7 @@ namespace StardewModdingAPI.Framework.ModLoading
from entry in mod.Manifest.Dependencies
let dependencyMod = mods.FirstOrDefault(m => string.Equals(m.Manifest?.UniqueID, entry.UniqueID, StringComparison.InvariantCultureIgnoreCase))
orderby entry.UniqueID
- select (ID: entry.UniqueID, MinVersion: entry.MinimumVersion, Mod: dependencyMod)
+ select new { ID = entry.UniqueID, MinVersion = entry.MinimumVersion, Mod = dependencyMod }
)
.ToArray();
diff --git a/src/StardewModdingAPI/Framework/SContentManager.cs b/src/StardewModdingAPI/Framework/SContentManager.cs
index 5707aab1..ebf1c8a5 100644
--- a/src/StardewModdingAPI/Framework/SContentManager.cs
+++ b/src/StardewModdingAPI/Framework/SContentManager.cs
@@ -232,11 +232,11 @@ namespace StardewModdingAPI.Framework
{
try
{
- return entry.Interceptor.CanLoad<T>(info);
+ return entry.Value.CanLoad<T>(info);
}
catch (Exception ex)
{
- this.Monitor.Log($"{entry.Mod.DisplayName} crashed when checking whether it could load asset '{info.AssetName}', and will be ignored. Error details:\n{ex.GetLogSummary()}", LogLevel.Error);
+ this.Monitor.Log($"{entry.Key.DisplayName} crashed when checking whether it could load asset '{info.AssetName}', and will be ignored. Error details:\n{ex.GetLogSummary()}", LogLevel.Error);
return false;
}
})
@@ -247,14 +247,14 @@ namespace StardewModdingAPI.Framework
return null;
if (loaders.Length > 1)
{
- string[] loaderNames = loaders.Select(p => p.Mod.DisplayName).ToArray();
+ string[] loaderNames = loaders.Select(p => p.Key.DisplayName).ToArray();
this.Monitor.Log($"Multiple mods want to provide the '{info.AssetName}' asset ({string.Join(", ", loaderNames)}), but an asset can't be loaded multiple times. SMAPI will use the default asset instead; uninstall one of the mods to fix this. (Message for modders: you should usually use {typeof(IAssetEditor)} instead to avoid conflicts.)", LogLevel.Warn);
return null;
}
// fetch asset from loader
- IModMetadata mod = loaders[0].Mod;
- IAssetLoader loader = loaders[0].Interceptor;
+ IModMetadata mod = loaders[0].Key;
+ IAssetLoader loader = loaders[0].Value;
T data;
try
{
@@ -290,8 +290,8 @@ namespace StardewModdingAPI.Framework
foreach (var entry in this.GetInterceptors(this.Editors))
{
// check for match
- IModMetadata mod = entry.Mod;
- IAssetEditor editor = entry.Interceptor;
+ IModMetadata mod = entry.Key;
+ IAssetEditor editor = entry.Value;
try
{
if (!editor.CanEdit<T>(info))
@@ -299,7 +299,7 @@ namespace StardewModdingAPI.Framework
}
catch (Exception ex)
{
- this.Monitor.Log($"{entry.Mod.DisplayName} crashed when checking whether it could edit asset '{info.AssetName}', and will be ignored. Error details:\n{ex.GetLogSummary()}", LogLevel.Error);
+ this.Monitor.Log($"{mod.DisplayName} crashed when checking whether it could edit asset '{info.AssetName}', and will be ignored. Error details:\n{ex.GetLogSummary()}", LogLevel.Error);
continue;
}
@@ -312,7 +312,7 @@ namespace StardewModdingAPI.Framework
}
catch (Exception ex)
{
- this.Monitor.Log($"{entry.Mod.DisplayName} crashed when editing asset '{info.AssetName}', which may cause errors in-game. Error details:\n{ex.GetLogSummary()}", LogLevel.Error);
+ this.Monitor.Log($"{mod.DisplayName} crashed when editing asset '{info.AssetName}', which may cause errors in-game. Error details:\n{ex.GetLogSummary()}", LogLevel.Error);
}
// validate edit
@@ -333,7 +333,7 @@ namespace StardewModdingAPI.Framework
}
/// <summary>Get all registered interceptors from a list.</summary>
- private IEnumerable<(IModMetadata Mod, T Interceptor)> GetInterceptors<T>(IDictionary<IModMetadata, IList<T>> entries)
+ private IEnumerable<KeyValuePair<IModMetadata, T>> GetInterceptors<T>(IDictionary<IModMetadata, IList<T>> entries)
{
foreach (var entry in entries)
{
@@ -342,11 +342,11 @@ namespace StardewModdingAPI.Framework
// special case if mod is an interceptor
if (metadata.Mod is T modAsInterceptor)
- yield return (metadata, modAsInterceptor);
+ yield return new KeyValuePair<IModMetadata, T>(metadata, modAsInterceptor);
// registered editors
foreach (T interceptor in interceptors)
- yield return (metadata, interceptor);
+ yield return new KeyValuePair<IModMetadata, T>(metadata, interceptor);
}
}
}
diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj
index 4d65b1af..bf1c43d1 100644
--- a/src/StardewModdingAPI/StardewModdingAPI.csproj
+++ b/src/StardewModdingAPI/StardewModdingAPI.csproj
@@ -79,9 +79,6 @@
<Reference Include="System.Runtime.Caching">
<Private>True</Private>
</Reference>
- <Reference Include="System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
- <HintPath>..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
- </Reference>
<Reference Include="System.Windows.Forms" Condition="$(OS) == 'Windows_NT'" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
diff --git a/src/StardewModdingAPI/packages.config b/src/StardewModdingAPI/packages.config
index 6a2a8d1b..e5fa3c3a 100644
--- a/src/StardewModdingAPI/packages.config
+++ b/src/StardewModdingAPI/packages.config
@@ -2,5 +2,4 @@
<packages>
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net461" />
- <package id="System.ValueTuple" version="4.3.1" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/src/prepare-install-package.targets b/src/prepare-install-package.targets
index df8bb100..f0debdd2 100644
--- a/src/prepare-install-package.targets
+++ b/src/prepare-install-package.targets
@@ -31,7 +31,6 @@
<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" />
- <Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\System.ValueTuple.dll" DestinationFolder="$(PackageInternalPath)\Mono" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\unix-launcher.sh" DestinationFiles="$(PackageInternalPath)\Mono\StardewModdingAPI" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="$(CompiledSmapiPath)\steam_appid.txt" DestinationFolder="$(PackageInternalPath)\Mono" />
<Copy Condition="$(OS) != 'Windows_NT'" SourceFiles="@(CompiledMods)" DestinationFolder="$(PackageInternalPath)\Mono\Mods\%(RecursiveDir)" />