Exemple #1
0
        public static PlayerFile LoadFromBin(BinaryReader reader)
        {
            PlayerFile result = new PlayerFile();

            result.Header = PlayerFileHeader.LoadFromBin(reader);
            result.Player = Player.LoadFromBin(reader);

            return(result);
        }
        public static void SaveToBin(PlayerFileHeader item, BinaryWriter writer)
        {
            for (int i = 0; i < SIGNATURE_LENGTH; i++)
            {
                writer.Write(PLAYER_SIGNATURE[i]);
            }

            writer.Write(item.FileVersion);
        }
        public static PlayerFileHeader LoadFromBin(BinaryReader reader)
        {
            PlayerFileHeader result = new PlayerFileHeader();

            byte[] signature = new byte[SIGNATURE_LENGTH];

            for (int i = 0; i < SIGNATURE_LENGTH; i++)
            {
                signature[i] = reader.ReadByte();
                if (signature[i] != PLAYER_SIGNATURE[i])
                {
                    throw new Exception(string.Format("Invalid File Format Signature."));
                }
            }

            result.FileVersion = reader.ReadUInt32();

            return(result);
        }
Exemple #4
0
 public static void SaveToBin(PlayerFile item, BinaryWriter writer)
 {
     PlayerFileHeader.SaveToBin(item.Header, writer);
     Player.SaveToBin(item.Player, writer);
 }