示例#1
0
        /// <summary>
        /// Loads a <see cref="DatabaseInfo"/> from stream.
        /// </summary>
        /// <param name="stream"></param>
        public DatabaseInfo(BinaryStreamBase stream)
        {
            byte version = stream.ReadUInt8();

            switch (version)
            {
            case 1:
                DatabaseName = stream.ReadString();
                KeyTypeID    = stream.ReadGuid();
                ValueTypeID  = stream.ReadGuid();
                int count = stream.ReadInt32();
                EncodingDefinition[] definitions = new EncodingDefinition[count];
                for (int x = 0; x < count; x++)
                {
                    definitions[x] = new EncodingDefinition(stream);
                }
                SupportedStreamingModes = new ReadOnlyCollection <EncodingDefinition>(definitions);
                KeyType   = Library.GetSortedTreeType(KeyTypeID);
                ValueType = Library.GetSortedTreeType(ValueTypeID);
                break;

            default:
                throw new VersionNotFoundException("Unknown version code.");
            }
        }