summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/Serialisation/SelectiveStringEnumConverter.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-10-07 23:20:36 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-10-07 23:20:36 -0400
commitd0dd2f7ba729de6be749d326a2fed78988ba9d7b (patch)
treea22127da6a8900e9f29bbb847bfd5d3347f6b952 /src/StardewModdingAPI/Framework/Serialisation/SelectiveStringEnumConverter.cs
parent7889676ea24cafc945899bf25608784e3f5bc9e0 (diff)
parent5928f5f86c4493ddb6b89bce0b7d0fb73a884c09 (diff)
downloadSMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.tar.gz
SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.tar.bz2
SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.zip
Merge branch 'add-mod-build-config' into develop
Diffstat (limited to 'src/StardewModdingAPI/Framework/Serialisation/SelectiveStringEnumConverter.cs')
-rw-r--r--src/StardewModdingAPI/Framework/Serialisation/SelectiveStringEnumConverter.cs37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/StardewModdingAPI/Framework/Serialisation/SelectiveStringEnumConverter.cs b/src/StardewModdingAPI/Framework/Serialisation/SelectiveStringEnumConverter.cs
deleted file mode 100644
index 37108556..00000000
--- a/src/StardewModdingAPI/Framework/Serialisation/SelectiveStringEnumConverter.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Newtonsoft.Json.Converters;
-
-namespace StardewModdingAPI.Framework.Serialisation
-{
- /// <summary>A variant of <see cref="StringEnumConverter"/> which only converts certain enums.</summary>
- internal class SelectiveStringEnumConverter : StringEnumConverter
- {
- /*********
- ** Properties
- *********/
- /// <summary>The enum type names to convert.</summary>
- private readonly HashSet<string> Types;
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="types">The enum types to convert.</param>
- public SelectiveStringEnumConverter(params Type[] types)
- {
- this.Types = new HashSet<string>(types.Select(p => p.FullName));
- }
-
- /// <summary>Get whether this instance can convert the specified object type.</summary>
- /// <param name="type">The object type.</param>
- public override bool CanConvert(Type type)
- {
- return
- base.CanConvert(type)
- && this.Types.Contains((Nullable.GetUnderlyingType(type) ?? type).FullName);
- }
- }
-}