ReadByte() public method

public ReadByte ( ) : byte
return byte
示例#1
0
        public User(NibbleReader nibbleReader)
        {
            UniqueID = new byte[10];

            UniqueID[0] = nibbleReader.ReadByte();
            UniqueID[1] = nibbleReader.ReadByte();
            Name = nibbleReader.ReadString(20);
            UniqueID[2] = nibbleReader.ReadByte();
            UniqueID[3] = nibbleReader.ReadByte();
            Town = nibbleReader.ReadString(16);

            // This group seems to be 00 00 00 00 in Japan, and
            //  00 00 01 00 in the US. All 4 bytes are saved just
            //  in case.
            UniqueID[6] = nibbleReader.ReadByte();
            UniqueID[7] = nibbleReader.ReadByte();
            UniqueID[8] = nibbleReader.ReadByte();
            UniqueID[9] = nibbleReader.ReadByte();

            UniqueID[4] = nibbleReader.ReadByte();
            UniqueID[5] = nibbleReader.ReadByte();
        }
示例#2
0
 public Palette(NibbleReader nibbleReader)
     : this()
 {
     for (int i = 0; i < 15; i++)
         Colors[i] = nibbleReader.ReadByte();
 }
示例#3
0
        private void LoadFromStream(Stream stream)
        {
            BinaryReader binaryReader = new BinaryReader(stream);
            NibbleReader nibbleReader = new NibbleReader(binaryReader);

            byte type = nibbleReader.ReadByte();
            if (type != 0x40)
                throw new NotImplementedException();

            int size = nibbleReader.ReadByte();
            size = (size << 4) | nibbleReader.ReadNibble();
            if (size != 0x26C)
                throw new InvalidDataException("Size is invalid.");

            Title = nibbleReader.ReadString(42);
            Author = new User(nibbleReader);

            ColorPalette = new Palette(nibbleReader);

            nibbleReader.ReadByte(); // Unknown
            nibbleReader.ReadByte(); // Unknown, 0x0A
            Type = (PatternType)nibbleReader.ReadByte();
            nibbleReader.ReadByte(); // Unknown, 0x00
            nibbleReader.ReadByte(); // Unknown, 0x00

            for (int j = 0; j < Data.GetLength(1); j++)
                for (int i = 0; i < Data.GetLength(0); i += 2)
                {
                    Data[i + 1, j] = nibbleReader.ReadNibble();
                    Data[i, j] = nibbleReader.ReadNibble();
                }
        }