Beispiel #1
0
        public static PropertyDatabaseRecord FromBinary(BinaryReader br)
        {
            var recordKey   = PropertyDatabaseRecordKey.FromBinary(br);
            var valid       = br.ReadByte();
            var recordValue = PropertyDatabaseRecordValue.FromBinary(br);

            return(new PropertyDatabaseRecord(recordKey, recordValue, valid));
        }
        public object GetObjectFromRecordValue(PropertyDatabaseRecordValue recordValue, PropertyStringTableView stringTableView)
        {
            if (!IsSupportedPropertyType(recordValue.propertyType))
            {
                throw new ArgumentException($"Property type \"{recordValue.propertyType}\" of {nameof(recordValue)} is not supported.");
            }

            return(PropertyDatabaseSerializerManager.Deserialize(recordValue, stringTableView));
        }
Beispiel #3
0
        public static object Deserialize(PropertyDatabaseRecordValue value, PropertyStringTableView stringTableView)
        {
            var type = (PropertyDatabaseType)value.propertyType;

            if (!s_Deserializers.ContainsKey(type))
            {
                return(PropertyDatabaseRecordValue.invalid);
            }

            var args = new PropertyDatabaseDeserializationArgs(value, stringTableView);

            return(s_Deserializers[type].handler(args));
        }
Beispiel #4
0
        public bool TryLoad(PropertyDatabaseRecordKey recordKey, out PropertyDatabaseRecordValue data)
        {
            if (m_MemoryStoreView.TryLoad(recordKey, out data))
            {
                return(true);
            }
            if (!m_FileStoreView.TryLoad(recordKey, out data))
            {
                return(false);
            }

            // Cache loaded value into memory store.
            var record = CreateRecord(recordKey, data);

            m_MemoryStoreView.Store(record, !m_DelayedSync);
            return(true);
        }
Beispiel #5
0
        public bool TryLoad(PropertyDatabaseRecordKey recordKey, out PropertyDatabaseRecordValue data)
        {
            data = PropertyDatabaseRecordValue.invalid;
            using (LockRead())
            {
                var foundRecord = Find(recordKey, out var index);
                if (!foundRecord)
                {
                    return(false);
                }

                var record = GetRecord(index);
                if (!record.IsValid())
                {
                    return(false);
                }

                data = record.recordValue;
                return(true);
            }
        }
 public object GetObjectFromRecordValue(PropertyDatabaseRecordValue recordValue)
 {
     return(m_PropertyDatabase.GetObjectFromRecordValue(recordValue, m_StringTableView));
 }
Beispiel #7
0
 public PropertyDatabaseRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue, byte valid)
 {
     this.recordKey   = recordKey;
     this.recordValue = recordValue;
     this.valid       = valid;
 }
Beispiel #8
0
 public PropertyDatabaseRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue, bool valid)
 {
     this.recordKey   = recordKey;
     this.recordValue = recordValue;
     this.valid       = valid ? (byte)1 : (byte)0;
 }
Beispiel #9
0
 public PropertyDatabaseRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue)
 {
     this.recordKey   = recordKey;
     this.recordValue = recordValue;
     valid            = 1;
 }
Beispiel #10
0
 public PropertyDatabaseRecord(ulong documentKey, Hash128 propertyKey, PropertyDatabaseRecordValue recordValue)
     : this(new PropertyDatabaseRecordKey(documentKey, propertyKey), recordValue)
 {
 }
Beispiel #11
0
 static byte GetFixedStringLength(PropertyDatabaseRecordValue value)
 {
     return(value[0]);
 }
Beispiel #12
0
 public bool TryLoad(PropertyDatabaseRecordKey recordKey, out PropertyDatabaseRecordValue data)
 {
     using (var view = GetView())
         return(view.TryLoad(recordKey, out data));
 }
 public bool Store(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue value)
 {
     using (var view = GetView())
         return(view.Store(recordKey, value));
 }
 public PropertyDatabaseRecord CreateRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue)
 {
     return(PropertyDatabase.CreateRecord(recordKey, recordValue));
 }
        public bool Store(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue value)
        {
            var record = CreateRecord(recordKey, value);

            return(Store(record));
        }
 public static PropertyDatabaseRecord CreateRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue)
 {
     if (!IsSupportedPropertyType(recordValue.propertyType))
     {
         throw new ArgumentException($"Property type of {nameof(recordValue)} is not supported.");
     }
     return(new PropertyDatabaseRecord(recordKey, recordValue));
 }
 public object GetObjectFromRecordValue(PropertyDatabaseRecordValue recordValue)
 {
     using (var view = m_StringTable.GetView())
         return(GetObjectFromRecordValue(recordValue, view));
 }
Beispiel #18
0
 public PropertyDatabaseDeserializationArgs(PropertyDatabaseRecordValue value, PropertyStringTableView stringTableView)
 {
     this.value           = value;
     this.stringTableView = stringTableView;
 }
Beispiel #19
0
 public bool TryLoad(PropertyDatabaseRecordKey recordKey, out PropertyDatabaseRecordValue data)
 {
     throw new NotSupportedException();
 }