Ejemplo n.º 1
0
        public void read(ref GDBlockReader gdbr)
        {
            GDBlock b = new GDBlock();
            uint    ver;

            if (gdbr.read_block_start(ref b) != 3)
            {
                new IOException();
            }
            ver = gdbr.read_int();
            if (ver < 4)             // version
            {
                new IOException();
            }
            flag = gdbr.read_byte();
            if (flag != 0)
            {
                uint numBags = gdbr.read_int();
                focused  = gdbr.read_int();
                selected = gdbr.read_int();

                Bags = new List <GDStashBag>((int)numBags);

                for (int i = 0; i < numBags; i++)
                {
                    GDStashBag bag = new GDStashBag();
                    bag.Read(gdbr, null, true);
                    bag.Index = i;
                    Bags.Add(bag);
                }

                useAlternate = gdbr.read_byte();

                for (uint i = 0; i < 12; i++)
                {
                    equipment[i].Read(gdbr, true);
                    gdbr.read_byte();
                }

                alternate1 = gdbr.read_byte();

                for (uint i = 0; i < 2; i++)
                {
                    weapon1[i].Read(gdbr, true);
                    gdbr.read_byte();
                }

                alternate2 = gdbr.read_byte();

                for (uint i = 0; i < 2; i++)
                {
                    weapon2[i].Read(gdbr, true);
                    gdbr.read_byte();
                }
            }

            gdbr.read_block_end(ref b);
        }
Ejemplo n.º 2
0
        public void Open(string filename)
        {
            BlockReader = new GDBlockReader();
            using (BlockReader.File = new BinaryReader(File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read), ASCIIEncoding.ASCII))
            {
                FileName = filename;
                UInt32 n, ver;
                BlockReader.read_key();

                if (BlockReader.read_int() != 2)
                {
                    throw new IOException();
                }

                GDBlock b = new GDBlock();

                if (BlockReader.read_block_start(ref b) != 18)
                {
                    throw new IOException();
                }
                ver = BlockReader.read_int();
                if (ver < 4)                 // version
                {
                    throw new IOException("Version Mismatch <4");
                }
                n = BlockReader.next_int();
                if (n != 0)
                {
                    throw new IOException();
                }

                mod = BlockReader.read_str();
                if (ver >= 5)
                {
                    BlockReader.read_byte();
                }
                n    = BlockReader.read_int();
                Bags = new List <GDStashBag>((int)n);

                for (int i = 0; i < n; i++)
                {
                    GDStashBag bag = new GDStashBag();
                    bag.Read(this.BlockReader, this);
                    bag.Index = i;
                    Bags.Add(bag);
                }

                BlockReader.read_block_end(ref b);
            }
        }
Ejemplo n.º 3
0
        public void read(ref GDBlockReader gdbr)
        {
            GDBlock b = new GDBlock();


            if (gdbr.read_block_start(ref b) != 4)
            {
                throw new Exception();
            }
            uint ver = gdbr.read_int();

            if (ver != 5 && ver != 6)             // version
            {
                throw new Exception();
            }

            uint numBags;

            if (ver >= 6)
            {
                numBags = numBags = gdbr.read_int();
            }
            else
            {
                numBags = 1;
            }

            Bags = new List <GDStashBag>((int)numBags);

            for (int i = 0; i < numBags; i++)
            {
                GDStashBag bag = new GDStashBag();
                bag.Read(gdbr);
                bag.Index = i;
                Bags.Add(bag);
            }

            gdbr.read_block_end(ref b);
        }