public ValueStorageDictionary(string parentStorageCapsuleID, Dictionary <string, SaveableValueSection> loadedValues) { ParentStorageCapsuleID = parentStorageCapsuleID; _keyToNormalValue = loadedValues; SaveableValueSection keysToKeepSection = GetValueSection(VALUE_KEYS_TO_KEEP_KEY); if (keysToKeepSection.IsValid) { _keysToKeep = new List <string>(SaveableArray.To <string>((SaveableArray)keysToKeepSection.GetValue(typeof(SaveableArray)))); } }
public StorageDictionary(string parentStorageCapsuleID, IStorageAccess storageAccess, Dictionary <string, SaveableValueSection> loadedValues, Dictionary <string, object> loadedRefs) : base(parentStorageCapsuleID, loadedValues) { _storageAccess = storageAccess; _keyToReferenceID = loadedRefs; SaveableValueSection keysToKeepSection = GetValueSection(REF_KEYS_TO_KEEP_KEY); if (keysToKeepSection.IsValid) { _keysToKeep = new List <string>(SaveableArray.To <string>((SaveableArray)keysToKeepSection.GetValue(typeof(SaveableArray)))); } }
public bool LoadStructs <T>(string key, out T[] values) where T : struct { if (LoadStruct(key, out SaveableArray <T> oldSaveableArray)) { values = SaveableArray <T> .To(oldSaveableArray); return(true); } else if (LoadStruct(key, out SaveableArray newSaveableArray)) { values = SaveableArray.To <T>(newSaveableArray); return(true); } values = null; return(false); }
public bool LoadValues <T>(string key, out T[] values) where T : IConvertible, IComparable { ThrowExceptionWhenISaveable("It is forbidden use this method to load an `ISaveable`! Use `LoadRefs` instead!", typeof(T)); if (LoadStruct(key, out SaveableArray <T> oldSaveableArray)) { values = SaveableArray <T> .To(oldSaveableArray); return(true); } else if (LoadStruct(key, out SaveableArray newSaveableArray)) { values = SaveableArray.To <T>(newSaveableArray); return(true); } values = null; return(false); }