Update ruleset and skin format number. (2)

This commit is contained in:
2022-11-18 00:45:25 +08:00
parent dcc92bb024
commit 79bfd6764c
4 changed files with 7 additions and 3 deletions

View File

@@ -355,7 +355,7 @@ namespace Cryville.Crtr {
skin = JsonConvert.DeserializeObject<Skin>(reader.ReadToEnd(), new JsonSerializerSettings() {
MissingMemberHandling = MissingMemberHandling.Error
});
if (skin.format != 2) throw new FormatException("Invalid skin file version");
if (skin.format != Skin.CURRENT_FORMAT) throw new FormatException("Invalid skin file version");
}
loadThread = new Thread(new ParameterizedThreadStart(Load));
@@ -553,7 +553,7 @@ namespace Cryville.Crtr {
ruleset = JsonConvert.DeserializeObject<Ruleset>(reader.ReadToEnd(), new JsonSerializerSettings() {
MissingMemberHandling = MissingMemberHandling.Error
});
if (ruleset.format != 2) throw new FormatException("Invalid ruleset file version");
if (ruleset.format != Ruleset.CURRENT_FORMAT) throw new FormatException("Invalid ruleset file version");
ruleset.LoadPdt(dir);
pruleset = ruleset.Root;
pruleset.Optimize(etor);

View File

@@ -35,7 +35,7 @@ namespace Cryville.Crtr.Config {
ruleset = JsonConvert.DeserializeObject<Ruleset>(reader.ReadToEnd(), new JsonSerializerSettings() {
MissingMemberHandling = MissingMemberHandling.Error
});
if (ruleset.format != 1) throw new FormatException("Invalid ruleset file version");
if (ruleset.format != Ruleset.CURRENT_FORMAT) throw new FormatException("Invalid ruleset file version");
ruleset.LoadPdt(dir);
}
FileInfo cfgfile = new FileInfo(

View File

@@ -12,6 +12,8 @@ using SIdentifier = Cryville.Common.Identifier;
namespace Cryville.Crtr {
public class Ruleset : MetaInfo {
public const long CURRENT_FORMAT = 2;
[JsonRequired]
public long format;

View File

@@ -12,6 +12,8 @@ using System.Text;
namespace Cryville.Crtr {
public class Skin : MetaInfo {
public const long CURRENT_FORMAT = 2;
[JsonRequired]
public long format;