상속: DataBlock
예제 #1
0
파일: SaveFile.cs 프로젝트: seefo/PD2SE
        public SaveFile(String filePath, bool encrypted = true)
        {
            this.filePath = filePath;

            byte[] file = File.ReadAllBytes(filePath);
            byte[] data = encrypted ? Encryption.TransformData(file) : file;

            // Open save to process
            BinaryReader br = new BinaryReader(new MemoryStream(data));

            // Validate that file is a supported save format
            int version = br.ReadInt32();
            if (version != SAVE_VERSION)
            {
                throw new Exception(String.Format("Unsupported save version: {0}", version.ToString("X4")));
            }

            // Process blocks
            this.header = new DataBlock(br);
            this.gamedata = new GameDataBlock(br);
            this.footer = new DataBlock(br);

            // We're done with our reader
            br.Close();
        }
예제 #2
0
파일: SaveFile.cs 프로젝트: lawsama/PD2SE
        public SaveFile(String filePath, bool encrypted = true)
        {
            this.filePath = filePath;

            byte[] file = File.ReadAllBytes(filePath);
            byte[] data = encrypted ? Encryption.TransformData(file) : file;

            // Open save to process
            BinaryReader br = new BinaryReader(new MemoryStream(data));

            // Validate that file is a supported save format
            int version = br.ReadInt32();

            if (version != SAVE_VERSION)
            {
                throw new Exception(String.Format("Unsupported save version: {0}", version.ToString("X4")));
            }

            // Process blocks
            this.header   = new DataBlock(br);
            this.gamedata = new GameDataBlock(br);
            this.footer   = new DataBlock(br);

            // We're done with our reader
            br.Close();
        }