public Variation GetByName(StringKey name, double weight = 1.0) { if (!_variations.ContainsKey(name.Normalize())) { throw new KeyNotFoundException($"The variation \"{name}\" is not registered."); } return(_variations[name.Normalize()](weight)); }
internal void AddElement(StringKey key) { if (mElementNames.Contains(key.Normalize())) { return; } mElementNames.Add(key.Normalize()); mOriginalNames.Add(key); }
public override IBlobStore GetChildStore(StringKey childStorageKey, bool?isReadOnly = null) { if (!mChildFolders.ContainsKey(childStorageKey.Normalize())) { var childStore = new CompressedBlobStoreSection(mThisFolderName.Concat(childStorageKey), mArchive); AddChildFolder(childStorageKey, childStore); return(childStore); } return(mChildFolders[childStorageKey.Normalize()]); }
internal void AddChildFolder(StringKey key, [NotNull] CompressedBlobStoreSection folder) { if (folder == null) { throw new ArgumentNullException(nameof(folder)); } if (mChildFolders.ContainsKey(key.Normalize())) { mChildFolders[key.Normalize()] = folder; return; } mChildFolders.Add(key.Normalize(), folder); mOriginalChildFolderNames.Add(key); }
protected IKeyValueStore <string> LoadSettingGroup(StringKey settingGroupKey) { if (mSettingGroups.ContainsKey(settingGroupKey.Normalize())) { return(mSettingGroups[settingGroupKey.Normalize()]); } var settingGroupBlobStore = mStore .GetChildStore("Settings", false); var settingGroup = CreateKeyValueStore(settingGroupBlobStore, settingGroupKey); mSettingGroups.AddOrUpdate(settingGroupKey.Normalize(), settingGroup); return(settingGroup); }
protected override object GetValue(StringKey key) { if (mInstance == null) { return(null); } return(mProperties.GetValueByKeyOrDefault(key.Normalize())?.GetValue(mInstance)); }
public void Register([NotNull] Type variationType, StringKey variationName = default) { if (variationType == null) { throw new ArgumentNullException(nameof(variationType)); } if (variationName.IsEmpty) { var attribute = variationType.GetCustomAttribute <VariationAttribute>(); if (attribute == null) { throw new TypeLoadException($"The type \"{variationType.FullName}\" is not decorated with a \"{nameof(VariationAttribute)}\" and no specific variation name has been provided."); } variationName = attribute.Name; } _variations.AddOrUpdate(variationName.Normalize(), d => Create(variationType, d)); _names.AddOrUpdate(variationName.Normalize(), variationName); }
public override bool Exists(StringKey key) { return(mProperties.ContainsKey(key.Normalize())); }
public override bool HasChildStore(StringKey childStorageKey) { return(mChildFolders.ContainsKey(childStorageKey.Normalize())); }
public override bool Exists(StringKey key) { return(mElementNames.Contains(key.Normalize())); }