From 8e4ac7be6bc7659a01347e9fac4cd918b32805bb Mon Sep 17 00:00:00 2001 From: Undeemiss Date: Mon, 25 Apr 2022 20:12:46 -0500 Subject: [PATCH] Save migration for old contract names Rename old "HammingCodes: Integer to encoded Binary" contracts to "HammingCodes: Integer to Encoded Binary" on file load if the save is old. --- src/Constants.ts | 2 +- src/SaveObject.tsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Constants.ts b/src/Constants.ts index 74668dd4c..4c47e9729 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -118,7 +118,7 @@ export const CONSTANTS: { LatestUpdate: string; } = { VersionString: "1.6.4", - VersionNumber: 15, + VersionNumber: 16, // Speed (in ms) at which the main loop is updated _idleSpeed: 200, diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx index 20f8bb8ec..82fd29ba6 100755 --- a/src/SaveObject.tsx +++ b/src/SaveObject.tsx @@ -398,6 +398,19 @@ function evaluateVersionCompatibility(ver: string | number): void { if (ver < 15) { (Settings as any).EditorTheme = { ...defaultMonacoTheme }; } + //Fix contract names + if (ver < 16) { + //Iterate over all contracts on all servers + for (const server of GetAllServers()) { + for (const contract of server.contracts) { + //Rename old "HammingCodes: Integer to encoded Binary" contracts + //to "HammingCodes: Integer to Encoded Binary" + if (contract.type == "HammingCodes: Integer to encoded Binary") { + contract.type = "HammingCodes: Integer to Encoded Binary"; + } + } + } + } } }