Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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));
 }
Esempio n. 7
0
 public PropertyDatabaseRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue, byte valid)
 {
     this.recordKey   = recordKey;
     this.recordValue = recordValue;
     this.valid       = valid;
 }
Esempio n. 8
0
 public PropertyDatabaseRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue, bool valid)
 {
     this.recordKey   = recordKey;
     this.recordValue = recordValue;
     this.valid       = valid ? (byte)1 : (byte)0;
 }
Esempio n. 9
0
 public PropertyDatabaseRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue)
 {
     this.recordKey   = recordKey;
     this.recordValue = recordValue;
     valid            = 1;
 }
Esempio n. 10
0
 public PropertyDatabaseRecord(ulong documentKey, Hash128 propertyKey, PropertyDatabaseRecordValue recordValue)
     : this(new PropertyDatabaseRecordKey(documentKey, propertyKey), recordValue)
 {
 }
Esempio n. 11
0
 static byte GetFixedStringLength(PropertyDatabaseRecordValue value)
 {
     return(value[0]);
 }
Esempio n. 12
0
 public bool TryLoad(PropertyDatabaseRecordKey recordKey, out PropertyDatabaseRecordValue data)
 {
     using (var view = GetView())
         return(view.TryLoad(recordKey, out data));
 }
Esempio n. 13
0
 public bool Store(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue value)
 {
     using (var view = GetView())
         return(view.Store(recordKey, value));
 }
Esempio n. 14
0
 public PropertyDatabaseRecord CreateRecord(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue recordValue)
 {
     return(PropertyDatabase.CreateRecord(recordKey, recordValue));
 }
Esempio n. 15
0
        public bool Store(PropertyDatabaseRecordKey recordKey, PropertyDatabaseRecordValue value)
        {
            var record = CreateRecord(recordKey, value);

            return(Store(record));
        }
Esempio n. 16
0
 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));
 }
Esempio n. 17
0
 public object GetObjectFromRecordValue(PropertyDatabaseRecordValue recordValue)
 {
     using (var view = m_StringTable.GetView())
         return(GetObjectFromRecordValue(recordValue, view));
 }
Esempio n. 18
0
 public PropertyDatabaseDeserializationArgs(PropertyDatabaseRecordValue value, PropertyStringTableView stringTableView)
 {
     this.value           = value;
     this.stringTableView = stringTableView;
 }
Esempio n. 19
0
 public bool TryLoad(PropertyDatabaseRecordKey recordKey, out PropertyDatabaseRecordValue data)
 {
     throw new NotSupportedException();
 }