From 560d3c861d646fd3f0e854a0632859899f4aa896 Mon Sep 17 00:00:00 2001 From: Jeffery Thompson Date: Wed, 18 Jul 2018 13:38:36 -0400 Subject: [PATCH 1/2] fix: try adding _SimplSharp suffix to assembly if GetType fails --- ICD.Common.Utils/Json/JsonItemWrapper.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ICD.Common.Utils/Json/JsonItemWrapper.cs b/ICD.Common.Utils/Json/JsonItemWrapper.cs index 4ca434f..b5d8d8d 100644 --- a/ICD.Common.Utils/Json/JsonItemWrapper.cs +++ b/ICD.Common.Utils/Json/JsonItemWrapper.cs @@ -1,4 +1,5 @@ using System; +using System.Text.RegularExpressions; using ICD.Common.Utils.Extensions; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -70,8 +71,17 @@ namespace ICD.Common.Utils.Json string itemString = (string)token.SelectToken(ITEM_TOKEN); Type type = Type.GetType(typeString); + if (type == null) + typeString = AddSimplSharpSuffix(typeString); return JsonConvert.DeserializeObject(itemString, type); } + + private static string AddSimplSharpSuffix(string typeString) + { + return Regex.Replace(typeString, + "(?'prefix'[^,]+, )(?'assembly'[^,]*)(?'suffix', .*)", + "${prefix}${assembly}_SimplSharp${suffix}"); + } } } From 220e778a76791bfac4f2189b2e0eb7107729020c Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Wed, 18 Jul 2018 13:41:27 -0400 Subject: [PATCH 2/2] fix: Dammit Jeff --- ICD.Common.Utils/Json/JsonItemWrapper.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ICD.Common.Utils/Json/JsonItemWrapper.cs b/ICD.Common.Utils/Json/JsonItemWrapper.cs index b5d8d8d..d455717 100644 --- a/ICD.Common.Utils/Json/JsonItemWrapper.cs +++ b/ICD.Common.Utils/Json/JsonItemWrapper.cs @@ -71,8 +71,12 @@ namespace ICD.Common.Utils.Json string itemString = (string)token.SelectToken(ITEM_TOKEN); Type type = Type.GetType(typeString); + if (type == null) + { typeString = AddSimplSharpSuffix(typeString); + type = Type.GetType(typeString); + } return JsonConvert.DeserializeObject(itemString, type); }