AoMBrgEditor.PssgBinaryReader.ReadPSSGString C# (CSharp) Method

ReadPSSGString() public method

public ReadPSSGString ( int length ) : string
length int
return string
        public string ReadPSSGString(int length)
        {
            return Encoding.UTF8.GetString(this.ReadBytes(length));
        }

Same methods

PssgBinaryReader::ReadPSSGString ( ) : string

Usage Example

Example #1
0
        public PssgFile(System.IO.Stream fileStream)
        {
            using (PssgBinaryReader reader = new PssgBinaryReader(new BigEndianBitConverter(), fileStream))
            {
                magic = reader.ReadPSSGString(4);
                if (magic != "PSSG")
                {
                    throw new Exception("This is not a PSSG file!");
                }
                int size = reader.ReadInt32();
                int attributeInfoCount = reader.ReadInt32();
                int nodeInfoCount = reader.ReadInt32();

                attributeInfo = new PssgAttributeInfo[attributeInfoCount];
                nodeInfo = new PssgNodeInfo[nodeInfoCount];

                for (int i = 0; i < nodeInfoCount; i++)
                {
                    nodeInfo[i] = new PssgNodeInfo(reader, this);
                }
                long positionAfterInfo = reader.BaseStream.Position;

                rootNode = new PssgNode(reader, this, null, true);
                if (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    reader.BaseStream.Position = positionAfterInfo;
                    rootNode = new PssgNode(reader, this, null, false);
                    if (reader.BaseStream.Position < reader.BaseStream.Length)
                    {
                        throw new Exception("This file is improperly saved and not supported by this version of the PSSG editor." + Environment.NewLine + Environment.NewLine +
                            "Get an older version of the program if you wish to take out its contents, but put it back together using this program and the original version of the pssg file.");
                    }
                }
            }
        }
All Usage Examples Of AoMBrgEditor.PssgBinaryReader::ReadPSSGString