Skip to content

Commit

Permalink
Skip upgrading profile if profile was created in 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchangelWTF committed Jul 8, 2024
1 parent d25224b commit bae1dac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion SPT.ProfileConverter/Converters/ThreeEightToThreeNine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
Expand Down

0 comments on commit bae1dac

Please sign in to comment.