public static void Write(PUP_File file, string path) { byte[] bytes = file.SaveToBytes(); //Saving File.WriteAllBytes(path, bytes.ToArray()); }
public static PUP_File Load(byte[] bytes) { PUP_File pupFile = new PUP_File(); int count = BitConverter.ToInt32(bytes, 8); int offset = 16; for (int i = 0; i < count; i++) { pupFile.PupEntries.Add(PUP_Entry.Read(bytes, offset)); offset += 152; } return(pupFile); }
public static PUP_File Serialize(string path, bool writeXml) { byte[] rawBytes = File.ReadAllBytes(path); PUP_File file = Load(rawBytes); //Write Xml if (writeXml) { YAXSerializer serializer = new YAXSerializer(typeof(PUP_File)); serializer.SerializeToFile(file, path + ".xml"); } return(file); }