public static PAL_File Parse(string path, bool writeXml) { PAL_File palFile = Parse(File.ReadAllBytes(path)); if (writeXml) { YAXSerializer serializer = new YAXSerializer(typeof(PAL_File)); serializer.SerializeToFile(palFile, path + ".xml"); } return(palFile); }
public static PAL_File Parse(byte[] bytes) { PAL_File palFile = new PAL_File(); palFile.I_06 = BitConverter.ToUInt16(bytes, 6); int count = BitConverter.ToInt32(bytes, 8); int offset = BitConverter.ToInt32(bytes, 12); palFile.PalEntries = PalEntry.ReadAll(bytes, offset, count); List <Equipment> equipments = Equipment.ReadAll(bytes, offset + (10 * count), count); List <Stats> stats = Stats.ReadAll(bytes, offset + (10 * count) + (78 * count), count); for (int i = 0; i < palFile.PalEntries.Count; i++) { palFile.PalEntries[i].Equipment = equipments[i]; palFile.PalEntries[i].Stats = stats[i]; } return(palFile); }