public MacMACInformationProvider(IPersistentPropertyBag persistentStorage, ILegacyApi legacyApi)
 {
     CodeContract.RequiresArgumentNotNull <IPersistentPropertyBag>(persistentStorage, "persistentStorage");
     CodeContract.RequiresArgumentNotNull <ILegacyApi>(legacyApi, "legacyApi");
     this.persistentStorage = persistentStorage;
     this.legacyApi         = legacyApi;
     persistedMAC           = new Lazy <string>(() => CalculateMACAddressHash(), LazyThreadSafetyMode.ExecutionAndPublication);
 }
 public MachineInformationProvider(ILegacyApi legacyApi, IUserInformationProvider userInformationProvider, IMACInformationProvider macInformationProvider)
 {
     CodeContract.RequiresArgumentNotNull <ILegacyApi>(legacyApi, "legacyApi");
     CodeContract.RequiresArgumentNotNull <IUserInformationProvider>(userInformationProvider, "userInformationProvider");
     CodeContract.RequiresArgumentNotNull <IMACInformationProvider>(macInformationProvider, "macInformationProvider");
     this.legacyApi = legacyApi;
     this.userInformationProvider = userInformationProvider;
     this.macInformationProvider  = macInformationProvider;
     machineId = new Lazy <Guid>(() => CalculateMachineId(), LazyThreadSafetyMode.ExecutionAndPublication);
 }
Beispiel #3
0
 public UserInformationProviderBase(IInternalSettings internalSettings, IEnvironmentTools envTools, ILegacyApi legacyApi, Guid?userId)
 {
     CodeContract.RequiresArgumentNotNull <IInternalSettings>(internalSettings, "internalSettings");
     CodeContract.RequiresArgumentNotNull <IEnvironmentTools>(envTools, "envTools");
     CodeContract.RequiresArgumentNotNull <ILegacyApi>(legacyApi, "legacyApi");
     this.internalSettings        = internalSettings;
     environmentTools             = envTools;
     this.legacyApi               = legacyApi;
     canCollectPrivateInformation = new Lazy <bool>(CalculateCanCollectPrivateInformation, LazyThreadSafetyMode.ExecutionAndPublication);
     isUserMicrosoftInternal      = new Lazy <bool>(CalculateIsInternal, LazyThreadSafetyMode.ExecutionAndPublication);
     this.userId = new Lazy <Guid>(() => (!userId.HasValue) ? this.legacyApi.ReadSharedUserId() : userId.Value, LazyThreadSafetyMode.ExecutionAndPublication);
 }
 public MonoUserInformationProvider(IInternalSettings internalSettings, IEnvironmentTools envTools, ILegacyApi legacyApi, Guid?userId)
     : base(internalSettings, envTools, legacyApi, userId)
 {
 }
Beispiel #5
0
 private static IUserInformationProvider GetUserInformationProvider(IRegistryTools registryTools, IInternalSettings internalSettings, IEnvironmentTools environmentTools, ILegacyApi legacyApi, TelemetrySessionSettings telemetrySessionSettings)
 {
     if (Platform.IsWindows)
     {
         return(new WindowsUserInformationProvider(registryTools, internalSettings, environmentTools, legacyApi, telemetrySessionSettings?.UserId));
     }
     return(new MonoUserInformationProvider(internalSettings, environmentTools, legacyApi, telemetrySessionSettings?.UserId));
 }
Beispiel #6
0
 private static IMACInformationProvider GetMACInformationProvider(IProcessTools processTools, IPersistentPropertyBag persistentStorage, ILegacyApi legacyApi)
 {
     if (Platform.IsWindows)
     {
         return(new WindowsMACInformationProvider(processTools, persistentStorage));
     }
     if (Platform.IsMac)
     {
         return(new MacMACInformationProvider(persistentStorage, legacyApi));
     }
     return(new MonoMACInformationProvider(processTools, persistentStorage));
 }
Beispiel #7
0
        private static TelemetrySessionInitializer BuildInitializer(TelemetrySessionSettings telemetrySessionSettings)
        {
            //IL_0012: Unknown result type (might be due to invalid IL or missing references)
            //IL_0018: Expected O, but got Unknown
            CancellationTokenSource cancellationTokenSource          = new CancellationTokenSource();
            DiagnosticTelemetry     diagnosticTelemetry              = new DiagnosticTelemetry();
            EnvironmentTools        environmentTools                 = new EnvironmentTools();
            RegistryTools           registryTools                    = (RegistryTools)(object)new RegistryTools();
            ProcessTools            processTools                     = new ProcessTools();
            ILegacyApi                   legacyApi                   = GetLegacyApi((IRegistryTools)(object)registryTools);
            IPersistentPropertyBag       persistentStorage           = CreatePersistentPropertyBag(string.Empty);
            IPersistentPropertyBag       persistentPropertyBag       = CreatePersistentPropertyBag("c57a9efce9b74de382d905a89852db71");
            IMACInformationProvider      mACInformationProvider      = GetMACInformationProvider(processTools, persistentStorage, legacyApi);
            IInternalSettings            internalSettings            = GetInternalSettings(diagnosticTelemetry, (IRegistryTools)(object)registryTools);
            IHostInformationProvider     hostInformationProvider     = GetHostInformationProvider();
            IUserInformationProvider     userInformationProvider     = GetUserInformationProvider((IRegistryTools)(object)registryTools, internalSettings, environmentTools, legacyApi, telemetrySessionSettings);
            MachineInformationProvider   machineInformationProvider  = new MachineInformationProvider(legacyApi, userInformationProvider, mACInformationProvider);
            IIdentityInformationProvider identityInformationProvider = GetIdentityInformationProvider();
            IPersistentPropertyBag       persistentPropertyBag2      = CreatePersistentPropertyBag(hostInformationProvider.ProcessName);
            TelemetryScheduler           telemetryScheduler          = new TelemetryScheduler();
            OptOutAction                 optOutAction                = new OptOutAction();

            optOutAction.AddOptOutFriendlyEventName("vs/telemetryapi/session/initialized");
            optOutAction.AddOptOutFriendlyEventName("context/postproperty");
            optOutAction.AddOptOutFriendlyPropertiesList(new List <string>
            {
                "Context.Default.VS.Core.BranchName",
                "Context.Default.VS.Core.BuildNumber",
                "Context.Default.VS.Core.ExeName",
                "Context.Default.VS.Core.ExeVersion",
                "Context.Default.VS.Core.HardwareId",
                "Context.Default.VS.Core.MacAddressHash",
                "Context.Default.VS.Core.Machine.Id",
                "Context.Default.VS.Core.SkuName",
                "Context.Default.VS.Core.OS.Version",
                "Context.Default.VS.Core.ProcessId",
                "Context.Default.VS.Core.User.Id",
                "Context.Default.VS.Core.User.IsMicrosoftInternal",
                "Context.Default.VS.Core.User.IsOptedIn",
                "Context.Default.VS.Core.User.Location.GeoId",
                "Context.Default.VS.Core.User.Type",
                "Context.Default.VS.Core.Version",
                "Reserved.EventId",
                "Reserved.SessionId",
                "Reserved.TimeSinceSessionStart",
                "VS.Core.Locale.Product",
                "VS.Core.Locale.System",
                "VS.Core.Locale.User",
                "VS.Core.Locale.UserUI",
                "VS.Core.SkuId",
                "VS.Sqm.SkuId"
            });
            ClientSideThrottlingAction item = new ClientSideThrottlingAction(new List <string>
            {
                "context/create",
                "context/close",
                "context/postproperty",
                "vs/core/command",
                "vs/core/extension/installed",
                "vs/core/sessionstart",
                "vs/core/sessionend",
                "vs/telemetryapi/session/initialized",
                "vs/telemetryapi/clientsidethrottling",
                "vs/telemetryapi/manifest/load",
                "vs/telemetryapi/piiproperties"
            }, 0.0, 0L);
            PIIPropertyProcessor  pIIPropertyProcessor = new PIIPropertyProcessor();
            PiiAction             item2 = new PiiAction(pIIPropertyProcessor);
            ComplexPropertyAction item3 = new ComplexPropertyAction(new JsonComplexObjectSerializerFactory(), pIIPropertyProcessor);

            return(new TelemetrySessionInitializer
            {
                CancellationTokenSource = cancellationTokenSource,
                SessionId = Guid.NewGuid().ToString(),
                AppInsightsInstrumentationKey = "f144292e-e3b2-4011-ac90-20e5c03fbce5",
                AsimovInstrumentationKey = "AIF-312cbd79-9dbb-4c48-a7da-3cc2a931cb70",
                DiagnosticTelemetry = diagnosticTelemetry,
                IdentityTelemetry = new IdentityTelemetry(identityInformationProvider, telemetryScheduler),
                EnvironmentTools = environmentTools,
                RegistryTools = (IRegistryTools2)(object)registryTools,
                ProcessTools = processTools,
                LegacyApi = legacyApi,
                InternalSettings = internalSettings,
                HostInformationProvider = hostInformationProvider,
                MachineInformationProvider = machineInformationProvider,
                UserInformationProvider = userInformationProvider,
                MACInformationProvider = mACInformationProvider,
                EventProcessorScheduler = telemetryScheduler,
                TelemetryManifestManagerBuilder = new TelemetryManifestManagerBuilder(),
                DefaultContextPropertyManager = new DefaultContextPropertyManager(GetPropertyProviders((IRegistryTools)(object)registryTools, environmentTools, hostInformationProvider, machineInformationProvider, mACInformationProvider, userInformationProvider, persistentPropertyBag, identityInformationProvider)),
                PersistentStorage = persistentStorage,
                PersistentSharedProperties = persistentPropertyBag,
                PersistentPropertyBag = persistentPropertyBag2,
                ChannelValidators = new List <IChannelValidator>
                {
                    new RegistryChannelValidator(internalSettings),
                    new InternalChannelValidator(userInformationProvider),
                    new DisabledTelemetryChannelValidator(internalSettings)
                },
                CustomActionToAdd = new List <IEventProcessorAction>
                {
                    optOutAction,
                    new EnforceAIRestrictionAction(),
                    item2,
                    item3,
                    new MetricAction(),
                    new SettingAction(),
                    item,
                    new SuppressEmptyPostPropertyEventAction()
                },
                EventProcessorChannelBuilder = new EventProcessorChannelBuilder(persistentPropertyBag2, telemetryScheduler),
                WatsonSessionChannelBuilder = new WatsonSessionChannelBuilder(internalSettings.FaultEventWatsonSamplePercent(), internalSettings.FaultEventMaximumWatsonReportsPerSession(), internalSettings.FaultEventMinimumSecondsBetweenWatsonReports(), ChannelProperties.Default),
                OptinStatusReader = GetOptInStatusReader((IRegistryTools2)(object)registryTools),
                ProcessCreationTime = GetProcessCreationTime()
            });
        }
 public WindowsUserInformationProvider(IRegistryTools regTools, IInternalSettings internalSettings, IEnvironmentTools envTools, ILegacyApi legacyApi, Guid?userId)
     : base(internalSettings, envTools, legacyApi, userId)
 {
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(regTools, "regTools");
     registryTools = regTools;
     userType      = new Lazy <UserType>(() => CalculateUserType(), LazyThreadSafetyMode.ExecutionAndPublication);
 }