Пример #1
0
        /// <summary>
        /// Get internal settings for the channel specified by its ID.
        /// There are 3 states could be:
        /// - explicitly enabled
        /// - explicitly disabled
        /// - undefined (no settings available)
        /// </summary>
        /// <param name="channelId"></param>
        /// <returns></returns>
        public virtual ChannelInternalSetting GetChannelSettings(string channelId)
        {
            CodeContract.RequiresArgumentNotNullAndNotEmpty(channelId, "channelId");
            if (!TypeTools.TryConvertToInt(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Coding4Fun\\VisualStudio\\Telemetry\\Channels", channelId, (object)(-1)), out int result))
            {
                result = -1;
            }
            ChannelInternalSetting channelInternalSetting = ChannelInternalSetting.Undefined;

            switch (result)
            {
            case 1:
                channelInternalSetting = ChannelInternalSetting.ExplicitlyEnabled;
                break;

            case 0:
                channelInternalSetting = ChannelInternalSetting.ExplicitlyDisabled;
                break;
            }
            if (channelInternalSetting != ChannelInternalSetting.Undefined)
            {
                diagnosticTelemetry.LogRegistrySettings(string.Format(CultureInfo.InvariantCulture, "Channel.{0}", new object[1]
                {
                    channelId
                }), channelInternalSetting.ToString());
            }
            return(channelInternalSetting);
        }
Пример #2
0
        /// <summary>
        /// Get the default # of seconds between Watson reports from registry
        /// Reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\Telemetry /v FaultEventMinimumSecondsBetweenWatsonReports /t REG_DWORD /d 3600 /f
        /// </summary>
        /// <returns></returns>
        public override int FaultEventMinimumSecondsBetweenWatsonReports()
        {
            int result = 3600;

            TypeTools.TryConvertToInt(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Microsoft\\VisualStudio\\Telemetry", "FaultEventMinimumSecondsBetweenWatsonReports", (object)3600), out result);
            return(result);
        }
Пример #3
0
        /// <summary>
        /// Get the default # of Watson reports per session from registry
        /// Reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\Telemetry /v FaultEventMaximumWatsonReportsPerSession /t REG_DWORD /d 100 /f
        /// </summary>
        /// <returns></returns>
        public override int FaultEventMaximumWatsonReportsPerSession()
        {
            int result = 0;

            TypeTools.TryConvertToInt(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Microsoft\\VisualStudio\\Telemetry", "FaultEventMaximumWatsonReportsPerSession", (object)10), out result);
            return(result);
        }
Пример #4
0
        /// <summary>
        /// Get the sample rate for Fault Events from registry
        /// useful for testing
        /// Reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\Telemetry /v FaultEventWatsonSampleRate /t REG_DWORD /d 100 /f
        /// </summary>
        /// <returns></returns>
        public override int FaultEventWatsonSamplePercent()
        {
            int result = 0;

            TypeTools.TryConvertToInt(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Microsoft\\VisualStudio\\Telemetry", "FaultEventWatsonSampleRate", (object)10), out result);
            return(result);
        }
Пример #5
0
        /// <summary>
        /// Check whether user is forced set as external
        /// </summary>
        /// <returns></returns>
        public bool IsForcedUserExternal()
        {
            TypeTools.TryConvertToInt(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Coding4Fun\\VisualStudio\\Telemetry", "ForceExternalUser", (object)0), out int result);
            bool num = result == 1;

            if (num)
            {
                diagnosticTelemetry.LogRegistrySettings("ForcedExternalUser", "true");
            }
            return(num);
        }
Пример #6
0
        /// <summary>
        /// Check, whether telemetry completely disabled
        /// Reg add HKEY_CURRENT_USER\Software\Coding4Fun\VisualStudio\Telemetry /v TurnOffSwitch /t REG_DWORD /d 1 /f
        /// </summary>
        /// <returns></returns>
        public bool IsTelemetryDisabledCompletely()
        {
            TypeTools.TryConvertToInt(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Coding4Fun\\VisualStudio\\Telemetry", "TurnOffSwitch", (object)0), out int result);
            bool num = result == 1;

            if (num)
            {
                diagnosticTelemetry.LogRegistrySettings("CompletelyDisabledTelemetry", "true");
            }
            return(num);
        }
Пример #7
0
        /// <summary>
        /// Check whether local logger is enabled
        /// </summary>
        /// <returns></returns>
        public bool IsLocalLoggerEnabled()
        {
            bool flag = false;

            if (Platform.IsWindows)
            {
                TypeTools.TryConvertToInt(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Coding4Fun\\VisualStudio\\Telemetry", "LocalLoggerEnabled", (object)0), out int result);
                flag = (result == 1);
            }
            if (flag)
            {
                diagnosticTelemetry.LogRegistrySettings("LocalLoggerEnabled", "true");
            }
            return(flag);
        }