Ejemplo n.º 1
0
        public PropertyDatabaseRecordValue CreateRecordValue(object value, PropertyStringTableView stringTableView)
        {
            if (!IsSupportedValue(value))
            {
                throw new ArgumentException($"Type \"{value.GetType()}\" is not supported.");
            }

            return(PropertyDatabaseSerializerManager.Serialize(value, stringTableView));
        }
Ejemplo n.º 2
0
 public PropertyDatabaseView(PropertyDatabase propertyDatabase, PropertyDatabaseVolatileMemoryStore volatileMemoryStore, PropertyDatabaseMemoryStore memoryStore, PropertyDatabaseFileStore fileStore, PropertyStringTable stringTable, bool delayedSync)
 {
     m_PropertyDatabase        = propertyDatabase;
     m_MemoryStore             = memoryStore;
     m_FileStore               = fileStore;
     m_VolatileMemoryStoreView = (PropertyDatabaseVolatileMemoryStoreView)volatileMemoryStore.GetView();
     m_MemoryStoreView         = (PropertyDatabaseMemoryStoreView)memoryStore.GetView();
     m_FileStoreView           = (PropertyDatabaseFileStoreView)fileStore.GetView();
     m_StringTableView         = stringTable.GetView(delayedSync);
     m_Disposed    = false;
     m_DelayedSync = delayedSync;
 }
Ejemplo 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));
        }
Ejemplo n.º 4
0
        public static PropertyDatabaseRecordValue Serialize(object value, PropertyStringTableView stringTableView)
        {
            var type = value.GetType();

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

            var args = new PropertyDatabaseSerializationArgs(value, stringTableView);

            return(s_Serializers[type].handler(args));
        }
Ejemplo n.º 5
0
 public PropertyDatabaseDeserializationArgs(PropertyDatabaseRecordValue value, PropertyStringTableView stringTableView)
 {
     this.value           = value;
     this.stringTableView = stringTableView;
 }
Ejemplo n.º 6
0
 public PropertyDatabaseSerializationArgs(object value, PropertyStringTableView stringTableView)
 {
     this.value           = value;
     this.stringTableView = stringTableView;
 }
Ejemplo n.º 7
0
        public object GetObjectFromRecordValue(IPropertyDatabaseRecordValue recordValue, PropertyStringTableView stringTableView)
        {
            if (recordValue.type != PropertyDatabaseType.Volatile)
            {
                return(GetObjectFromRecordValue((PropertyDatabaseRecordValue)recordValue, stringTableView));
            }

            var volatileRecordValue = (PropertyDatabaseVolatileRecordValue)recordValue;

            return(volatileRecordValue.value);
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
        public PropertyDatabaseRecord CreateRecord(PropertyDatabaseRecordKey recordKey, object value, PropertyStringTableView view)
        {
            var recordValue = CreateRecordValue(value, view);

            return(CreateRecord(recordKey, recordValue));
        }
Ejemplo n.º 10
0
 public PropertyDatabaseRecord CreateRecord(Hash128 propertyPathHash, object value, PropertyStringTableView view)
 {
     return(CreateRecord(0, propertyPathHash, value, view));
 }
Ejemplo n.º 11
0
 public PropertyDatabaseRecord CreateRecord(string propertyPath, object value, PropertyStringTableView view)
 {
     return(CreateRecord(CreatePropertyHash(propertyPath), value, view));
 }
Ejemplo n.º 12
0
        public PropertyDatabaseRecord CreateRecord(ulong documentKey, Hash128 propertyPathHash, object value, PropertyStringTableView view)
        {
            var key = CreateRecordKey(documentKey, propertyPathHash);

            return(CreateRecord(key, value, view));
        }