public static List <LevelMetaData> Parse(string path) { using (BinaryReader b = new BinaryReader(File.Open(path, FileMode.Open))) { var res = new List <LevelMetaData>(); while (b.BaseStream.Position != b.BaseStream.Length) { var m = new LevelMetaData(); for (int i = 0; i < 20; i++) { m.randomRectsCoords[i] = RandomRectCoords.Parse(b); } for (int i = 0; i < 20; i++) { m.TimesIn10k[i] = b.ReadInt16().SwapBytes(); } for (int i = 0; i < 20; i++) { m.BattleRange[i] = RandomRectBattleRange.Parse(b); } for (int i = 0; i < 20; i++) { for (int j = 0; j < 3; j++) { m.XapNum[i, j] = b.ReadInt16().SwapBytes(); } } for (int i = 0; i < 20; i++) { for (int j = 0; j < 3; j++) { m.XapChance[i, j] = b.ReadInt16().SwapBytes(); } } m.LandType = b.ReadByte(); m.unknown = b.ReadBytes(0x16); m.PercentOption = b.ReadBytes(20); m.unused = b.ReadByte(); for (int i = 0; i < 20; i++) { m.sound[i] = b.ReadInt16().SwapBytes(); } for (int i = 0; i < 20; i++) { m.text[i] = b.ReadInt16().SwapBytes(); } res.Add(m); } return(res); } }
internal static RandomRectCoords Parse(BinaryReader b) { var r = new RandomRectCoords { Top = b.ReadInt16().SwapBytes(), Left = b.ReadInt16().SwapBytes(), Bottom = b.ReadInt16().SwapBytes(), Right = b.ReadInt16().SwapBytes() }; return(r); }