From bae1dac61031a5c49184e4ec327548de4b9d0e83 Mon Sep 17 00:00:00 2001 From: Archangel Date: Mon, 8 Jul 2024 20:46:36 +0200 Subject: [PATCH] Skip upgrading profile if profile was created in 3.9 --- .../Converters/ThreeEightToThreeNine.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SPT.ProfileConverter/Converters/ThreeEightToThreeNine.cs b/SPT.ProfileConverter/Converters/ThreeEightToThreeNine.cs index 5152f85..0545574 100644 --- a/SPT.ProfileConverter/Converters/ThreeEightToThreeNine.cs +++ b/SPT.ProfileConverter/Converters/ThreeEightToThreeNine.cs @@ -9,7 +9,7 @@ public override ConversionStatus ConvertProfile(string FullFilePath) { // Read the JSON file, immediately convert to correct PMC types. var reader = new JsonTextReader(new StringReader(ConvertPMCTypes(File.ReadAllText(FullFilePath)))); - //Handle Float parsing as decimal, leaving this as default brought a whole load of unnecessary changes. + // Handle Float parsing as decimal, leaving this as default brought a whole load of unnecessary changes. reader.FloatParseHandling = FloatParseHandling.Decimal; var jsonObj = JObject.Load(reader); @@ -18,6 +18,16 @@ public override ConversionStatus ConvertProfile(string FullFilePath) return new ConversionStatus { Successful = false, Result = "This profile has already been converted!" }; } + if (jsonObj["spt"]?["version"] != null) + { + string SPTVersion = jsonObj["spt"]["version"].ToString(); + + if(SPTVersion.Contains("3.9")) + { + return new ConversionStatus { Successful = false, Result = "This profile was created in 3.9, skipping conversion" }; + } + } + // Add profile converted marker to the info object. var info = jsonObj["info"]; if (info != null)