Beispiel #1
0
        private static List <ShortGUIDDescriptor> ReadDB(byte[] db_content)
        {
            List <ShortGUIDDescriptor> toReturn = new List <ShortGUIDDescriptor>();

            MemoryStream readerStream = new MemoryStream(db_content);
            BinaryReader reader       = new BinaryReader(readerStream);

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                ShortGUIDDescriptor thisDesc = new ShortGUIDDescriptor();
                thisDesc.ID          = reader.ReadBytes(4);
                thisDesc.Description = reader.ReadString();
                toReturn.Add(thisDesc);
            }
            reader.Close();

            return(toReturn);
        }
Beispiel #2
0
        private static List <NodeDBDescriptor> ReadDB(byte[] db_content)
        {
            List <NodeDBDescriptor> toReturn = new List <NodeDBDescriptor>();

            MemoryStream readerStream = new MemoryStream(db_content);
            BinaryReader reader       = new BinaryReader(readerStream);
            int          type         = reader.ReadChar(); //0 = normal db, 1 = enum db

            switch (type)
            {
            case 0:
            {
                while (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    ShortGUIDDescriptor thisDesc = new ShortGUIDDescriptor();
                    thisDesc.ID          = reader.ReadUInt32();
                    thisDesc.Description = reader.ReadString();
                    toReturn.Add(thisDesc);
                }
                break;
            }

            case 1:
            {
                while (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    EnumDescriptor thisDesc = new EnumDescriptor();
                    thisDesc.ID   = reader.ReadUInt32();
                    thisDesc.Name = reader.ReadString();
                    int entryCount = reader.ReadInt32();
                    for (int i = 0; i < entryCount; i++)
                    {
                        thisDesc.Entries.Add(reader.ReadString());
                    }
                    toReturn.Add(thisDesc);
                }
                break;
            }
            }
            reader.Close();

            return(toReturn);
        }