WriteString() public method

public WriteString ( string value, int rawLength ) : void
value string
rawLength int
return void
示例#1
0
        public void Write(NibbleWriter nibbleWriter)
        {
            nibbleWriter.WriteByte(UniqueID[0]);
            nibbleWriter.WriteByte(UniqueID[1]);
            nibbleWriter.WriteString(Name, 20);
            nibbleWriter.WriteByte(UniqueID[2]);
            nibbleWriter.WriteByte(UniqueID[3]);
            nibbleWriter.WriteString(Town, 16);

            nibbleWriter.WriteByte(UniqueID[6]);
            nibbleWriter.WriteByte(UniqueID[7]);
            nibbleWriter.WriteByte(UniqueID[8]);
            nibbleWriter.WriteByte(UniqueID[9]);

            nibbleWriter.WriteByte(UniqueID[4]);
            nibbleWriter.WriteByte(UniqueID[5]);
        }
示例#2
0
        public byte[] GetRawData()
        {
            MemoryStream memoryStream = new MemoryStream();
            BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
            NibbleWriter nibbleWriter = new NibbleWriter(binaryWriter);

            nibbleWriter.WriteString(Title, 42);
            Author.Write(nibbleWriter);

            ColorPalette.Write(nibbleWriter);

            nibbleWriter.WriteByte(0x00);
            nibbleWriter.WriteByte(0x0A);
            nibbleWriter.WriteByte((byte)Type);
            nibbleWriter.WriteByte(0x00);
            nibbleWriter.WriteByte(0x00);

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

            byte[] result = memoryStream.ToArray();
            memoryStream.Close();

            return result;
        }