Ejemplo n.º 1
0
        public static ZWorldStatus Deserialize(System.IO.BinaryReader reader)
        {
            ZWorldStatus info = new ZWorldStatus();

            info.TypeOfWorld   = reader.ReadInt16();
            info.BoardCount    = reader.ReadInt16();
            info.PlayersAmmo   = reader.ReadInt16();
            info.PlayersGems   = reader.ReadInt16();
            info.PlayersKeys   = reader.ReadBytes(7);
            info.PlayersHealth = reader.ReadInt16();
            info.PlayersBoard  = reader.ReadInt16();
            return(info);
        }
Ejemplo n.º 2
0
        public static ZWorld Load(System.IO.Stream fileStream)
        {
            using (System.IO.BinaryReader binreader = new System.IO.BinaryReader(fileStream))
            {
                ZWorldStatus worldStatus = ZWorldStatus.Deserialize(binreader);
                ZWorld       world       = Deserialize(binreader);

                fileStream.Position = 512;

                var boards = new List <ZBoard>(worldStatus.BoardCount + 1);
                for (int i = 0; i < worldStatus.BoardCount + 1; i++)
                {
                    boards.Add(ZBoard.Deserialize(binreader));
                }

                world.Status = worldStatus;
                world.Boards = boards.ToArray();

                return(world);
            }
        }