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);
 }
示例#2
0
 public AccountService(
     IInternalSettings internalSettings,
     IJsonSerializer jsonSerializer)
 {
     _internalSettings = internalSettings;
     _jsonSerializer   = jsonSerializer;
 }
        public ProcessManager( ISettingsFactory settings, IDataStorageFactory storage ) {
            _storage = storage.Get<List<PasswordedDemonizedProcess>>();

            var source = _storage.Load(path) ?? Enumerable.Empty<PasswordedDemonizedProcess>();

            _processes = source.Select( a => MappingHelper.Instance.Map<PasswordedDemonizedProcess, InternalDemonizedProcess>( a ) ).ToDictionary( process => process.Id, process => process );
            _settings = settings.Get();
        }
示例#4
0
 public SettingsCollection(IAppSettings appSettings, IJiraConnectionSettings jiraConnectionSettings, IUiSettings uiSettings, IInternalSettings internalSettings, IExportSettings exportSettings)
 {
     AppSettings            = appSettings;
     JiraConnectionSettings = jiraConnectionSettings;
     UiSettings             = uiSettings;
     InternalSettings       = internalSettings;
     ExportSettings         = exportSettings;
 }
 public SettingsCollection(IAppSettings appSettings, IJiraConnectionSettings jiraConnectionSettings, IUiSettings uiSettings, IInternalSettings internalSettings, IExportSettings exportSettings)
 {
     AppSettings = appSettings;
     JiraConnectionSettings = jiraConnectionSettings;
     UiSettings = uiSettings;
     InternalSettings = internalSettings;
     ExportSettings = exportSettings;
 }
示例#6
0
 public TrackUsage(IAppSettings appSettings, IInternalSettings internalSettings, InstanceType instanceType)
 {
     this.appSettings = appSettings;
     this.instanceType = instanceType;
     SetTrackingQueryString(internalSettings);
     SetupBrowser();
     TrackAppUsage(TrackingType.AppLoad);
 }
示例#7
0
 public TrackUsage(IAppSettings appSettings, IInternalSettings internalSettings, InstanceType instanceType, AppType appType)
 {
     this.instanceType = instanceType;
     this.appType      = appType;
     trackingEnabled   = appSettings.UsageTracking;
     SetTrackingQueryString(internalSettings);
     SetupBrowser();
     TrackAppUsage(TrackingType.AppLoad);
 }
        public InternalSettingsExtensionsTests()
        {
            _internalSettings = Substitute.For <IInternalSettings>();
            _jsonSerializer   = Substitute.For <IJsonSerializer>();

            _key          = "test_key";
            _nullValue    = null;
            _notNullValue = new TestObject();
            _notEmptyJson = "json";
        }
示例#9
0
        public void UpdateSettings(IAppSettings newAppSettings, IInternalSettings internalSettings)
        {
            SetTrackingQueryString(internalSettings);

            if (appSettings.UsageTracking && !newAppSettings.UsageTracking)
            {
                TrackAppUsage(TrackingType.OptOut);
            }

            appSettings = newAppSettings;
            SetupBrowser();
        }
示例#10
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);
 }
示例#11
0
        public void UpdateSettings(IAppSettings appSettings, IInternalSettings internalSettings)
        {
            SetTrackingQueryString(internalSettings);

            if (trackingEnabled && !appSettings.UsageTracking)
            {
                TrackAppUsage(TrackingType.OptOut);
            }

            trackingEnabled = appSettings.UsageTracking;
            SetupBrowser();
        }
示例#12
0
        public void UpdateSettings(IAppSettings newAppSettings, IInternalSettings internalSettings)
        {
            SetTrackingQueryString(internalSettings);

            if (appSettings.UsageTracking && !newAppSettings.UsageTracking)
            {
                TrackAppUsage(TrackingType.OptOut);
            }

            appSettings = newAppSettings;
            SetupBrowser();
        }
        public static T GetJsonValueOrDefault <T>(
            this IInternalSettings internalSettings,
            IJsonSerializer jsonSerializer,
            string key,
            T defaultValue = default)
        {
            var json = internalSettings.GetValueOrDefault(key, default(string) !);

            return(string.IsNullOrEmpty(json)
                ? defaultValue
                : jsonSerializer.Deserialize <T>(json));
        }
示例#14
0
        public void UpdateSettings(IAppSettings appSettings, IInternalSettings internalSettings)
        {
            SetTrackingQueryString(internalSettings);

            if (trackingEnabled && !appSettings.UsageTracking)
            {
                TrackAppUsage(TrackingType.OptOut);
            }

            trackingEnabled = appSettings.UsageTracking;
            SetupBrowser();
        }
        public static void AddOrUpdateJsonValue <T>(
            this IInternalSettings internalSettings,
            IJsonSerializer jsonSerializer,
            string key,
            T value) where T : notnull
        {
            if (value == null)
            {
                internalSettings.Remove(key);
                return;
            }

            var json = jsonSerializer.Serialize(value);

            internalSettings.AddOrUpdateValue(key, json);
        }
示例#16
0
 public TelemetrySessionSettings(string id, IInternalSettings internalSettings, string appInsightsIKey, string asimovIKey, IProcessCreationTime processCreation)
 {
     CodeContract.RequiresArgumentNotNull <IInternalSettings>(internalSettings, "internalSettings");
     Id = id;
     AppInsightsInstrumentationKey = appInsightsIKey;
     AsimovInstrumentationKey      = asimovIKey;
     ProcessStartTime = processCreation.GetProcessCreationTime();
     if (internalSettings.TryGetTestHostName(out string testHostName))
     {
         HostName = testHostName;
     }
     else
     {
         HostName            = "Default";
         CanOverrideHostName = true;
     }
     if (internalSettings.TryGetTestAppId(out uint testAppId))
     {
         AppId = testAppId;
         return;
     }
     AppId            = 1000u;
     CanOverrideAppId = true;
 }
示例#17
0
        private void SetTrackingQueryString(IInternalSettings internalSettings)
        {
            var versionName = ApplicationDeployment.IsNetworkDeployed ? instanceType.ToString() : "Debug";

            trackingQueryString = string.Format("utm_source=GallifreyApp_{0}&utm_medium={1}&utm_campaign={2}", appType, versionName, internalSettings.LastChangeLogVersion);
        }
示例#18
0
 protected void AddInnerItem(IInternalSettings item)
 {
     item.InternalOnDataChanged += Item_InternalOnDataChanged;
     item.InternalOnDataUpdate  += Item_InternalOnDataUpdate;
 }
示例#19
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()
            });
        }
示例#20
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));
 }
示例#21
0
 private void SetTrackingQueryString(IInternalSettings internalSettings)
 {
     var versionName = ApplicationDeployment.IsNetworkDeployed ? instanceType.ToString() : "Debug";
     
     trackingQueryString = string.Format("utm_source=GallifreyApp_{0}&utm_medium={1}&utm_campaign={2}", appType,versionName, internalSettings.LastChangeLogVersion);
 }
示例#22
0
 public PushTokenStorageService(IInternalSettings internalSettings)
 {
     _internalSettings = internalSettings;
 }
示例#23
0
 public TelemetrySessionSettings(string id, IInternalSettings internalSettings, string appInsightsIKey, string asimovIKey)
     : this(id, internalSettings, appInsightsIKey, asimovIKey, TelemetrySessionInitializer.GetProcessCreationTime())
 {
 }
 public MonoUserInformationProvider(IInternalSettings internalSettings, IEnvironmentTools envTools, ILegacyApi legacyApi, Guid?userId)
     : base(internalSettings, envTools, legacyApi, userId)
 {
 }
示例#25
0
 public RegistryChannelValidator(IInternalSettings internalSettings)
 {
     CodeContract.RequiresArgumentNotNull <IInternalSettings>(internalSettings, "internalSettings");
     this.internalSettings = internalSettings;
 }
示例#26
0
        private void SetTrackingQueryString(IInternalSettings internalSettings)
        {
            var versionName = ApplicationDeployment.IsNetworkDeployed ? instanceType.ToString() : "Debug";

            trackingQueryString = $"utm_source=GallifreyApp_{appType}&utm_medium={versionName}&utm_campaign={internalSettings.LastChangeLogVersion}&uid={internalSettings.InstallationInstaceId}";
        }
示例#27
0
 public LogManager( ISettingsFactory settings ) {
     _settings = settings.Get();
     _repository = new Stack<string>();
     if (_settings.LogPath!=null)
         writer = new StreamWriter( _settings.LogPath ) { AutoFlush = true };
 }
示例#28
0
        private void SetTrackingQueryString(IInternalSettings internalSettings)
        {
            var prem = "Gallifrey";
            if (internalSettings.IsPremium)
            {
                prem = "Gallifrey_Premium";
            }

            trackingQueryString = $"utm_source={prem}&utm_medium={instanceType}&utm_campaign={internalSettings.LastChangeLogVersion}&uid={internalSettings.InstallationInstaceId}";
        }