mirror of
https://github.com/whoswhip/RhythiaLib.git
synced 2026-12-05 09:18:42 +00:00
feat: add rhr version validation
This commit is contained in:
@@ -17,6 +17,7 @@ namespace RhythiaLib.Rhr.Internal
|
||||
try
|
||||
{
|
||||
int version = reader.ReadInt32();
|
||||
RhrVersions.Validate(version);
|
||||
|
||||
RhrScoreData scoreData = RhrScoreDataCodec.Read(reader, version);
|
||||
|
||||
|
||||
@@ -10,5 +10,16 @@ namespace RhythiaLib.Rhr
|
||||
public const int FailTime = 2026_02_22;
|
||||
public const int Int32Time = 2026_05_10;
|
||||
public const int BeatmapHash = 2026_05_17;
|
||||
|
||||
public const int LatestSupported = BeatmapHash;
|
||||
|
||||
public static void Validate(int version)
|
||||
{
|
||||
// oldest version isnt validated since idk when the format was made and if it breaks before 2026/01/18
|
||||
if (version <= 0)
|
||||
throw new InvalidRhrFormatException($"Invalid RHR version: {version}.");
|
||||
else if (version > LatestSupported)
|
||||
throw new InvalidRhrFormatException($"RHR version {version} is newer than the latest supported version, {version}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user