Example #1
0
        public void WriteChar(byte stringChar, int index, [NotNull] FirmwareStringMetadata stringMetadata)
        {
            if (stringMetadata == null)
            {
                throw new ArgumentNullException("stringMetadata");
            }
            if (index > stringMetadata.DataLength)
            {
                throw new InvalidDataException("String data does not correspond to the metadata.");
            }

            m_bodyStream.WriteByte((int)stringMetadata.DataOffset + index, stringChar);
        }
Example #2
0
        public void WriteChar(short stringChar, int index, [NotNull] FirmwareStringMetadata stringMetadata)
        {
            if (stringMetadata == null)
            {
                throw new ArgumentNullException("stringMetadata");
            }
            if (index > stringMetadata.DataLength)
            {
                throw new InvalidDataException("String data does not correspond to the metadata.");
            }

            if (stringMetadata.TwoByteChars)
            {
                m_bodyStream.WriteBytes((int)stringMetadata.DataOffset + index * 2, BitConverter.GetBytes(stringChar));
            }
            else
            {
                m_bodyStream.WriteByte((int)stringMetadata.DataOffset + index, (byte)stringChar);
            }
        }