Exemplo n.º 1
0
        public void Save(string path)
        {
            using (var binary = new BinaryView(path, true))
            {
                byte saveV = 0;
                binary.WriteByte(saveV);

                binary.WriteString("name");
                binary.WriteString("player");
                binary.WriteSingle(Cam.PosX);
                binary.WriteSingle(Cam.PosY);
                binary.WriteSingle(Cam.Scale);

                int i = 0;
                binary.WriteInt32((int)Resources[i++].Value);
                binary.WriteInt32((int)Resources[i++].Value);
                binary.WriteInt32((int)Resources[i++].Value);
                binary.WriteInt32((int)Resources[i++].Value);

                binary.WriteInt32(World.Width);
                binary.WriteInt32(World.Height);
                binary.WriteArray(World.Ground);
                binary.WriteArray(World.Typ);
                binary.WriteArray(World.Version);
                binary.WriteArray(World.Zone);

                binary.Compress();
            }
        }
Exemplo n.º 2
0
        public override void Open(DockPanel panel)
        {
            _view             = new BinaryView(System.IO.Path.GetFileName(Path));
            _view.ImportFile += FormOnImportFile;
            _view.ExportFile += FormOnExportFile;
            _view.SetFileFilter(Filter);

            UpdateForm();
            _view.Show(panel, DockState.Document);
        }
Exemplo n.º 3
0
 private void ckbSplay_CheckedChanged(object sender, System.EventArgs e)
 {
     if (ckbSplay.Checked)
     {
         AbstractBinaryTree binaryTree = (AbstractBinaryTree)TreeHandler.getInstance().addTree(StructureType.SPLAY, 1);
         BinaryView         splayView  = new BinaryView(binaryTree);
         splayView.MdiParent = this;
         views.Add(splayView);
         insert();
         splayView.Show();
     }
 }
Exemplo n.º 4
0
        public void Load(string path)
        {
            using (var binary = new BinaryView(path, false))
            {
                binary.Decompress();

                byte saveV = binary.ReadByte(); //v

                binary.ReadString();            //name
                binary.ReadString();            //player
                Cam.PosX  = binary.ReadSingle();
                Cam.PosY  = binary.ReadSingle();
                Cam.Scale = binary.ReadSingle();

                int ir = 0;
                Resources[ir++].Value = binary.ReadInt32();
                Resources[ir++].Value = binary.ReadInt32();
                Resources[ir++].Value = binary.ReadInt32();
                Resources[ir++].Value = binary.ReadInt32();

                int width = binary.ReadInt32(), height = binary.ReadInt32();
                World = new World(width, height);

                World.Ground = binary.ReadArray <byte>();
                byte[] newTyp = binary.ReadArray <byte>();
                for (int i = 0; i < World.Width * World.Height; i++)
                {
                    if (newTyp[i] != 0)
                    {
                        World.Typ[i] = newTyp[i];
                    }
                }
                //World.Build(newTyp[i], i);
                World.Version = binary.ReadArray <byte>();
                World.Zone    = binary.ReadArray <byte>();
            }
        }