summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-20 23:22:24 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-20 23:22:24 -0500
commit342fc80394ac2d1bd67fb1b745b8ddec927fac49 (patch)
tree8bfc33ebe6b0556a27eca0f16045e9a48fa67c99
parent49666ac5bcfc0ffb2b8e2b8f2a274f90b67232d2 (diff)
downloadSMAPI-342fc80394ac2d1bd67fb1b745b8ddec927fac49.tar.gz
SMAPI-342fc80394ac2d1bd67fb1b745b8ddec927fac49.tar.bz2
SMAPI-342fc80394ac2d1bd67fb1b745b8ddec927fac49.zip
rewrite C# 9 code not supported in Linux build tools yet
-rw-r--r--src/SMAPI.Toolkit/SemanticVersion.cs12
-rw-r--r--src/SMAPI/Framework/SCore.cs2
-rw-r--r--src/SMAPI/Framework/SMultiplayer.cs4
-rw-r--r--src/SMAPI/Framework/Serialization/KeybindConverter.cs2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/SMAPI.Toolkit/SemanticVersion.cs b/src/SMAPI.Toolkit/SemanticVersion.cs
index d58dce0c..2f3e282b 100644
--- a/src/SMAPI.Toolkit/SemanticVersion.cs
+++ b/src/SMAPI.Toolkit/SemanticVersion.cs
@@ -293,12 +293,12 @@ namespace StardewModdingAPI.Toolkit
return string.Compare(this.ToString(), new SemanticVersion(otherMajor, otherMinor, otherPatch, otherPlatformRelease, otherTag).ToString(), StringComparison.OrdinalIgnoreCase);
}
- return CompareToRaw() switch
- {
- (< 0) => curOlder,
- (> 0) => curNewer,
- _ => same
- };
+ int result = CompareToRaw();
+ if (result < 0)
+ return curOlder;
+ if (result > 0)
+ return curNewer;
+ return same;
}
/// <summary>Assert that the current version is valid.</summary>
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 1ac361cd..cd094ff4 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -132,7 +132,7 @@ namespace StardewModdingAPI.Framework
private readonly ConcurrentQueue<string> RawCommandQueue = new ConcurrentQueue<string>();
/// <summary>A list of commands to execute on each screen.</summary>
- private readonly PerScreen<List<Tuple<Command, string, string[]>>> ScreenCommandQueue = new(() => new());
+ private readonly PerScreen<List<Tuple<Command, string, string[]>>> ScreenCommandQueue = new PerScreen<List<Tuple<Command, string, string[]>>>(() => new List<Tuple<Command, string, string[]>>());
/*********
diff --git a/src/SMAPI/Framework/SMultiplayer.cs b/src/SMAPI/Framework/SMultiplayer.cs
index 8e18cc09..5956b63f 100644
--- a/src/SMAPI/Framework/SMultiplayer.cs
+++ b/src/SMAPI/Framework/SMultiplayer.cs
@@ -56,10 +56,10 @@ namespace StardewModdingAPI.Framework
private readonly bool LogNetworkTraffic;
/// <summary>The backing field for <see cref="Peers"/>.</summary>
- private readonly PerScreen<IDictionary<long, MultiplayerPeer>> PeersImpl = new(() => new Dictionary<long, MultiplayerPeer>());
+ private readonly PerScreen<IDictionary<long, MultiplayerPeer>> PeersImpl = new PerScreen<IDictionary<long, MultiplayerPeer>>(() => new Dictionary<long, MultiplayerPeer>());
/// <summary>The backing field for <see cref="HostPeer"/>.</summary>
- private readonly PerScreen<MultiplayerPeer> HostPeerImpl = new();
+ private readonly PerScreen<MultiplayerPeer> HostPeerImpl = new PerScreen<MultiplayerPeer>();
/*********
diff --git a/src/SMAPI/Framework/Serialization/KeybindConverter.cs b/src/SMAPI/Framework/Serialization/KeybindConverter.cs
index 7c5db3ad..93a274a8 100644
--- a/src/SMAPI/Framework/Serialization/KeybindConverter.cs
+++ b/src/SMAPI/Framework/Serialization/KeybindConverter.cs
@@ -44,7 +44,7 @@ namespace StardewModdingAPI.Framework.Serialization
{
case JsonToken.Null:
return objectType == typeof(Keybind)
- ? new Keybind()
+ ? (object)new Keybind()
: new KeybindList();
case JsonToken.String: