FSO.Files.Utils.IoBuffer.ReadPascalString C# (CSharp) Method

ReadPascalString() public method

Reads a pascal string from the current stream, prefixed by a byte.
public ReadPascalString ( ) : string
return string
        public string ReadPascalString()
        {
            var length = ReadByte();
            return Encoding.ASCII.GetString(Reader.ReadBytes(length));
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Reads a property list from a stream.
        /// </summary>
        /// <param name="io">IOBuffer instance used to read an animation.</param>
        /// <returns>A PropertyList instance.</returns>
        private PropertyList ReadPropertyList(IoBuffer io)
        {
            var propsCount = io.ReadUInt32();
            var result = new PropertyListItem[propsCount];

            for (var y = 0; y < propsCount; y++)
            {
                var item = new PropertyListItem();
                var pairsCount = io.ReadUInt32();
                for (var z = 0; z < pairsCount; z++)
                {
                    item.KeyPairs.Add(new KeyValuePair<string, string>(
                        io.ReadPascalString(),
                        io.ReadPascalString()
                    ));
                }
                result[y] = item;
            }

            return new PropertyList {
                Items = result
            };
        }
All Usage Examples Of FSO.Files.Utils.IoBuffer::ReadPascalString