Esempio n. 1
0
 public ScopeScopeFilterProvider(IScopesStorageHandler storage, IScopeParserFactory factory)
 {
     CodeContract.RequiresArgumentNotNull <IScopesStorageHandler>(storage, "storage");
     CodeContract.RequiresArgumentNotNull <IScopeParserFactory>(factory, "factory");
     this.storage       = storage;
     scopeParserFactory = factory;
 }
 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 RemoteControlRemoteSettingsProvider(RemoteSettingsInitializer initializer)
     : base(initializer.VersionedRemoteSettingsStorageHandler, initializer.RemoteSettingsLogger)
 {
     remoteSettingsTelemetry      = initializer.Telemetry;
     remoteSettingsStorageHandler = initializer.VersionedRemoteSettingsStorageHandler;
     fileName                = initializer.RemoteSettingsFileName;
     remoteFileReader        = new Lazy <IRemoteFileReader>(() => initializer.RemoteFileReaderFactory.Instance());
     remoteSettingsParser    = initializer.RemoteSettingsParser;
     scopeParserFactory      = initializer.ScopeParserFactory;
     remoteSettingsValidator = initializer.RemoteSettingsValidator;
 }
Esempio n. 4
0
 /// <summary>
 /// Construct a new Remote Setting instance with values taken from the initializer.
 /// </summary>
 /// <param name="initializer">Values with which to initialize</param>
 public RemoteSettings(RemoteSettingsInitializer initializer)
 {
     initializer.FillWithDefaults();
     scopeParserFactory      = initializer.ScopeParserFactory;
     nonScopedStorageHandler = initializer.NonScopedRemoteSettingsStorageHandler;
     foreach (IScopeFilterProvider scopeFilterProvider in initializer.ScopeFilterProviders)
     {
         RegisterFilterProvider(scopeFilterProvider);
     }
     remoteSettingsProviders     = initializer.RemoteSettingsProviders.Select((Func <RemoteSettingsInitializer, IRemoteSettingsProvider> x) => x(initializer)).ToList();
     stableRemoteSettingProvider = initializer.StableRemoteSettingsProvider(initializer);
     isUpdateDisabled            = initializer.IsUpdatedDisabled;
     logger = initializer.RemoteSettingsLogger;
 }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        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));
        }