/// <summary>
 /// Construct experimentation service object using initializer object.
 /// </summary>
 /// <param name="initializer"></param>
 public ExperimentationService(ExperimentationServiceInitializer initializer)
 {
     CodeContract.RequiresArgumentNotNull <ExperimentationServiceInitializer>(initializer, "initializer");
     initializer.FillWithDefaults();
     telemetry                       = initializer.ExperimentationTelemetry;
     filterProvider                  = initializer.ExperimentationFilterProvider;
     flightsProvider                 = initializer.FlightsProvider;
     setFlightsProvider              = initializer.SetFlightsProvider;
     flightsProvider.FlightsUpdated += OnFlightsUpdated;
     SetFlightsTelemetry();
 }
Beispiel #2
0
 /// <summary>
 /// Fill empty properties with default values without overriding initialized fields.
 /// </summary>
 /// <returns>Instance of the experimentation initializer</returns>
 public ExperimentationServiceInitializer FillWithDefaults()
 {
     //IL_0009: Unknown result type (might be due to invalid IL or missing references)
     //IL_0013: Expected O, but got Unknown
     if (RegistryTools == null)
     {
         RegistryTools = (IRegistryTools3)(object)new RegistryTools();
     }
     if (ExperimentationFilterProvider == null)
     {
         ExperimentationFilterProvider = new DefaultExperimentationFilterProvider(TelemetryService.DefaultSession);
     }
     if (ExperimentationTelemetry == null)
     {
         ExperimentationTelemetry = new DefaultExperimentationTelemetry(TelemetryService.DefaultSession);
     }
     if (KeyValueStorage == null)
     {
         KeyValueStorage = new DefaultRegistryKeyValueStorage(RegistryTools);
     }
     if (ShippedRemoteFileReaderFactory == null)
     {
         ShippedRemoteFileReaderFactory = new ShippedFlightsRemoteFileReaderFactory();
     }
     if (DisabledSetRemoteFileReaderFactory == null)
     {
         DisabledSetRemoteFileReaderFactory = new DisabledFlightsRemoteFileReaderFactory();
     }
     if (FlightsStreamParser == null)
     {
         FlightsStreamParser = new JsonFlightsStreamParser();
     }
     if (HttpWebRequestFactory == null)
     {
         HttpWebRequestFactory = new HttpWebRequestFactory();
     }
     if (ExperimentationOptinStatusReader == null)
     {
         ExperimentationOptinStatusReader = new DefaultExperimentationOptinStatusReader(TelemetryService.DefaultSession, (IRegistryTools)(object)RegistryTools);
     }
     if (SetFlightsProvider == null)
     {
         SetFlightsProvider = new SetFlightsProvider(KeyValueStorage, setFlightsKey);
     }
     if (FlightsProvider == null)
     {
         RemoteFlightsProvider <ShippedFlightsData> remoteFlightsProvider = new RemoteFlightsProvider <ShippedFlightsData>(KeyValueStorage, shippedFlightsKey, ShippedRemoteFileReaderFactory, FlightsStreamParser);
         FlightsProvider = new MasterFlightsProvider(new IFlightsProvider[4]
         {
             new LocalFlightsProvider(KeyValueStorage, localTestFlightsPathSuffix + enabledFlightsKey),
             remoteFlightsProvider,
             new AFDFlightsProvider(KeyValueStorage, enabledFlightsKey, FlightsStreamParser, ExperimentationFilterProvider, HttpWebRequestFactory),
             SetFlightsProvider
         }, new IFlightsProvider[2]
         {
             new LocalFlightsProvider(KeyValueStorage, localTestFlightsPathSuffix + disabledFlightsKey),
             new RemoteFlightsProvider <DisabledFlightsData>(KeyValueStorage, disabledFlightsKey, DisabledSetRemoteFileReaderFactory, FlightsStreamParser)
         }, remoteFlightsProvider, ExperimentationOptinStatusReader);
     }
     return(this);
 }