public static Func <bool> BuildIsLoggingEnabled(ICollectionKeyValueStorage storage, bool usePrefix) { CodeContract.RequiresArgumentNotNull <ICollectionKeyValueStorage>(storage, "storage"); string collectionPathPrefix = usePrefix ? "Software\\Coding4Fun\\VisualStudio\\RemoteSettings" : string.Empty; return(() => storage.GetValue(collectionPathPrefix, "LoggingEnabled", 0) == 1); }
public IVersionedRemoteSettingsStorageHandler BuildVersioned(ICollectionKeyValueStorage storage, bool usePrefix, string fileName, IScopeParserFactory scopeParserFactory) { if (!fileNameRegex.IsMatch(fileName)) { throw new ArgumentException("Filename is invalid", "fileName"); } string collectionPathPrefix = (!usePrefix) ? fileName : string.Format("{0}\\{1}", "Software\\Coding4Fun\\VisualStudio\\RemoteSettings", fileName, CultureInfo.InvariantCulture); return(new RemoteSettingsStorageHandler(storage, collectionPathPrefix, scopeParserFactory, true, logger)); }
public RemoteSettingsStorageHandler(ICollectionKeyValueStorage storage, string collectionPathPrefix, IScopeParserFactory scopeParserFactory, bool isVersioned, IRemoteSettingsLogger logger) { CodeContract.RequiresArgumentNotNull <ICollectionKeyValueStorage>(storage, "storage"); CodeContract.RequiresArgumentNotNull <string>(collectionPathPrefix, "collectionPathPrefix"); CodeContract.RequiresArgumentNotNull <IScopeParserFactory>(scopeParserFactory, "scopeParserFactory"); remoteSettingsStorage = storage; CollectionPathPrefix = collectionPathPrefix; this.isVersioned = isVersioned; this.scopeParserFactory = scopeParserFactory; this.logger = logger; }
public IRemoteSettingsStorageHandler Build(ICollectionKeyValueStorage storage, bool usePrefix, RemoteSettingsFilterProvider filterProvider, IScopeParserFactory scopeParserFactory) { CodeContract.RequiresArgumentNotNull <RemoteSettingsFilterProvider>(filterProvider, "filterProvider"); List <string> list = new List <string>(); list.AddIfNotEmpty(filterProvider.GetApplicationName()); list.AddIfNotEmpty(filterProvider.GetApplicationVersion()); list.AddIfNotEmpty(filterProvider.GetBranchBuildFrom()); string text = string.Join("\\", list); string collectionPathPrefix = (!usePrefix) ? text : string.Format("{0}\\{1}", "Software\\Coding4Fun\\VisualStudio\\RemoteSettings", text, CultureInfo.InvariantCulture); return(new RemoteSettingsStorageHandler(storage, collectionPathPrefix, scopeParserFactory, false, logger)); }
public IRemoteSettingsStorageHandler Build(ICollectionKeyValueStorage storage, bool usePrefix, string collectionPath, IScopeParserFactory scopeParserFactory) { string collectionPathPrefix = (!usePrefix) ? collectionPath : string.Format("{0}\\{1}", "Software\\Coding4Fun\\VisualStudio\\RemoteSettings", collectionPath, CultureInfo.InvariantCulture); return(new RemoteSettingsStorageHandler(storage, collectionPathPrefix, scopeParserFactory, false, logger)); }