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);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Main constructor that requests all required classes.
 /// </summary>
 /// <param name="diagnosticTelemetry"></param>
 /// <param name="registryTools"></param>
 public InternalSettingsBase(IDiagnosticTelemetry diagnosticTelemetry, IRegistryTools registryTools)
 {
     CodeContract.RequiresArgumentNotNull <IDiagnosticTelemetry>(diagnosticTelemetry, "diagnosticTelemetry");
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(registryTools, "registryTools");
     this.registryTools       = registryTools;
     this.diagnosticTelemetry = diagnosticTelemetry;
 }
Ejemplo n.º 3
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));
 }
Ejemplo n.º 4
0
 public DefaultExperimentationOptinStatusReader(TelemetrySession telemetrySession, IRegistryTools registryTools)
 {
     CodeContract.RequiresArgumentNotNull <TelemetrySession>(telemetrySession, "telemetrySession");
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(registryTools, "registryTools");
     this.telemetrySession = telemetrySession;
     this.registryTools    = registryTools;
     isOptedIn             = new Lazy <bool>(() => GetIsOptedIn());
 }
Ejemplo n.º 5
0
 private static ILegacyApi GetLegacyApi(IRegistryTools registryTools)
 {
     if (Platform.IsWindows)
     {
         return(new LegacyApi(registryTools));
     }
     return(new MonoLegacyApi(registryTools));
 }
Ejemplo n.º 6
0
        public WindowsInternalSettings(IDiagnosticTelemetry diagnosticTelemetry, IRegistryTools registryTools)
            : base(diagnosticTelemetry, registryTools)
        {
            string userEventTag = GetUserEventTag();

            if (!string.IsNullOrEmpty(userEventTag))
            {
                diagnosticTelemetry.LogRegistrySettings("EventTag", userEventTag);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Only for testing. Testing "fake" IE Cache or "fake" server response
 /// </summary>
 /// <param name="requestor"></param>
 /// <param name="theRegistryTools"></param>
 /// <param name="hostId"></param>
 /// <param name="baseUrl"></param>
 /// <param name="relativePath"></param>
 /// <param name="pollingIntervalMins"></param>
 /// <param name="httpRequestTimeoutSeconds"></param>
 /// <param name="maxRandomDownloadDelaySeconds"></param>
 internal RemoteControlClient(IRemoteControlHTTPRequestor requestor, IRegistryTools theRegistryTools, string hostId, string baseUrl, string relativePath, int pollingIntervalMins = 1380, int httpRequestTimeoutSeconds = 60, int maxRandomDownloadDelaySeconds = 0)
     : this(theRegistryTools, hostId, baseUrl, relativePath, pollingIntervalMins)
 {
     this.maxRandomDownloadDelaySeconds = maxRandomDownloadDelaySeconds;
     this.requestor   = requestor;
     cacheUpdateTimer = new Timer(delegate(object o)
     {
         CacheUpdateTimerCallback(o, cancellationToken.Token).SwallowException();
     }, null, -1, -1);
 }
Ejemplo n.º 8
0
 public LegacyApi(IRegistryTools registryTools)
 {
     //IL_0009: Unknown result type (might be due to invalid IL or missing references)
     //IL_0010: Expected O, but got Unknown
     if (registryTools == null)
     {
         registryTools = (IRegistryTools)(object)new RegistryTools();
     }
     this.registryTools = registryTools;
 }
Ejemplo n.º 9
0
 public WindowsMachinePropertyProvider(IMachineInformationProvider machineInformationProvider, IRegistryTools regTools, IMACInformationProvider macInformationProvider)
 {
     CodeContract.RequiresArgumentNotNull <IMachineInformationProvider>(machineInformationProvider, "machineInformationProvider");
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(regTools, "regTools");
     CodeContract.RequiresArgumentNotNull <IMACInformationProvider>(macInformationProvider, "macInformationProvider");
     this.machineInformationProvider = machineInformationProvider;
     registryTools = regTools;
     this.macInformationProvider = macInformationProvider;
     memoryInformation           = new Lazy <NativeMethods.MemoryStatus>(() => InitializeOSMemoryInformation(), false);
     systemInformation           = new Lazy <NativeMethods.SystemInfo>(() => InitializeSystemInformation(), false);
     processorDescription        = new Lazy <string>(() => InitializeProcessorDescription(), false);
     processorFrequency          = new Lazy <int?>(() => registryTools.GetRegistryIntValueFromLocalMachineRoot("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "~MHz", (int?)null), false);
     azureVMImageName            = new Lazy <string>(() => InitializeAzureVMImageName(), false);
 }
Ejemplo n.º 10
0
        private RemoteControlClient(IRegistryTools registryTools, string hostId, string baseUrl, string relativePath, int pollingIntervalMins)
        {
            Uri = RemoteControlUri.Create(registryTools, hostId, baseUrl, relativePath);
            PollingIntervalMins = Math.Max(5, pollingIntervalMins);
            int num = 0;

            try
            {
                num = Convert.ToInt32(registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Coding4Fun\\VisualStudio\\RemoteControl", "TurnOffSwitch", 0));
            }
            catch
            {
            }
            isDisabled = (num == 1);
        }
Ejemplo n.º 11
0
 public WindowsOSPropertyProvider(IEnvironmentTools envTools, IRegistryTools regTools)
 {
     CodeContract.RequiresArgumentNotNull <IEnvironmentTools>(envTools, "envTools");
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(regTools, "regTools");
     environmentTools           = envTools;
     registryTools              = regTools;
     buildLabInfo               = new Lazy <string>(() => InitializeBuildLabInfo(), false);
     displayInfo                = new Lazy <DisplayInformation>(() => InitializeDisplayInfo(), false);
     operatingSystemVersionInfo = new Lazy <OSVersionInfo>(() => InitializeOSVersionInfo(), false);
     productNameInfo            = new Lazy <string>(() => InitializeProductNameInfo(), false);
     rootDriveInfo              = new Lazy <RootDriveInfo>(() => InitializeRootDriveInfo(), false);
     totalVolumesSize           = new Lazy <long?>(() => InitializeTotalVolumeSize(), false);
     clrInstalledVersion        = new Lazy <int>(() => InitializeClrInstalledVersion(), false);
     clrRunningVersion          = new Lazy <string>(() => InitializeClrRunningVersion(), false);
 }
Ejemplo n.º 12
0
        private static IEnumerable <IPropertyProvider> GetPropertyProviders(IRegistryTools registryTools, IEnvironmentTools environmentTools, IHostInformationProvider host, IMachineInformationProvider machine, IMACInformationProvider macAddress, IUserInformationProvider user, IPersistentPropertyBag sharedProperties, IIdentityInformationProvider identity)
        {
            yield return(new IdentityPropertyProvider());

            if (Platform.IsMac)
            {
                yield return(new MacHostPropertyProvider(host, new NsBundleInformationProvider()));

                yield return(new AssemblyPropertyProvider());

                yield return(new MacLocalePropertyProvider());

                yield return(new MacMachinePropertyProvider(machine, registryTools, macAddress));

                yield return(new MacOSPropertyProvider(environmentTools));

                yield return(new MacUserPropertyProvider(user));

                yield return(new PersistentSharedPropertyProvider(sharedProperties));
            }
            else if (Platform.IsLinux)
            {
                yield return(new LinuxHostPropertyProvider(host));

                yield return(new AssemblyPropertyProvider());

                yield return(new LinuxLocalePropertyProvider());

                yield return(new PersistentSharedPropertyProvider(sharedProperties));
            }
            else
            {
                yield return(new WindowsHostPropertyProvider(host));

                yield return(new AssemblyPropertyProvider());

                yield return(new WindowsLocalePropertyProvider(registryTools));

                yield return(new WindowsMachinePropertyProvider(machine, registryTools, macAddress));

                yield return(new WindowsOSPropertyProvider(environmentTools, registryTools));

                yield return(new WindowsUserPropertyProvider(user));

                yield return(new PersistentSharedPropertyProvider(sharedProperties));
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Creates a new URI with optional redirect.
        /// </summary>
        /// <param name="registryTools"></param>
        /// <param name="hostId"></param>
        /// <param name="baseUrl"></param>
        /// <param name="relativePath"></param>
        /// <returns></returns>
        public static RemoteControlUri Create(IRegistryTools registryTools, string hostId, string baseUrl, string relativePath)
        {
            registryTools.RequiresArgumentNotNull("registryTools");
            hostId.RequiresArgumentNotNullAndNotEmpty("hostId");
            baseUrl.RequiresArgumentNotNullAndNotEmpty("baseUrl");
            relativePath.RequiresArgumentNotNullAndNotEmpty("relativePath");
            Uri uri = new Uri(baseUrl).AddSegment(hostId).AddSegment(relativePath);
            Tuple <Uri, string> tuple = uri.SplitLastSegment();
            string absoluteUri        = tuple.Item1.AbsoluteUri;
            object registryValueFromCurrentUserRoot = registryTools.GetRegistryValueFromCurrentUserRoot("Software\\Coding4Fun\\VisualStudio\\RemoteControl\\TestUrlMapping", absoluteUri);

            if (registryValueFromCurrentUserRoot != null)
            {
                uri = new Uri(registryValueFromCurrentUserRoot.ToString()).AddSegment(tuple.Item2);
            }
            return(new RemoteControlUri(uri, hostId));
        }
Ejemplo n.º 14
0
 public OSInformationProvider(IRegistryTools registryTools)
 {
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(registryTools, "registryTools");
     this.registryTools = registryTools;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Only for testing. Testing local functionality
 /// </summary>
 /// <param name="theRegistryTools"></param>
 /// <param name="theFileReader"></param>
 /// <param name="hostId"></param>
 /// <param name="baseUrl"></param>
 /// <param name="relativePath"></param>
 internal RemoteControlClient(IRegistryTools theRegistryTools, IFileReader theFileReader, string hostId, string baseUrl, string relativePath)
     : this(theRegistryTools, hostId, baseUrl, relativePath, 1380)
 {
     fileReader = theFileReader;
 }
Ejemplo n.º 16
0
 protected virtual bool SaveMachineIdToRegistry(IRegistryTools registry, string regPath, string regKey, string machineId)
 {
     return(registry.SetRegistryFromLocalMachineRoot(regPath, regKey, (object)machineId, true));
 }
Ejemplo n.º 17
0
 public WindowsLocalePropertyProvider(IRegistryTools regTools)
 {
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(regTools, "regTools");
     registryTools = regTools;
     systemInfo    = new Lazy <CultureInfo>(() => InitializeSystemInformation(), false);
 }
Ejemplo n.º 18
0
 public MonoInternalSettings(IDiagnosticTelemetry diagnosticTelemetry, IRegistryTools registryTools)
     : base(diagnosticTelemetry, registryTools)
 {
     LoadChannelSettings();
 }
Ejemplo n.º 19
0
 protected override string ReadMachineIdFromRegistry(IRegistryTools registry, string regPath, string regKey)
 {
     return((string)registry.GetRegistryValueFromCurrentUserRoot(regPath, regKey, (object)null));
 }
Ejemplo n.º 20
0
 public MacMachinePropertyProvider(IMachineInformationProvider machineInformationProvider, IRegistryTools regTools, IMACInformationProvider macInformationProvider)
 {
     CodeContract.RequiresArgumentNotNull <IMachineInformationProvider>(machineInformationProvider, "machineInformationProvider");
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(regTools, "regTools");
     CodeContract.RequiresArgumentNotNull <IMACInformationProvider>(macInformationProvider, "macInformationProvider");
     this.machineInformationProvider = machineInformationProvider;
     this.macInformationProvider     = macInformationProvider;
     memoryInformation = new Lazy <PerformanceCounter>(() => InitializeOSMemoryInformation(), false);
     systemInformation = new Lazy <SystemInfo>(() => InitializeSystemInformation(), false);
 }
Ejemplo n.º 21
0
 protected override bool SaveMachineIdToRegistry(IRegistryTools registry, string regPath, string regKey, string machineId)
 {
     return(registry.SetRegistryFromCurrentUserRoot(regPath, regKey, (object)machineId));
 }
Ejemplo n.º 22
0
 protected virtual string ReadMachineIdFromRegistry(IRegistryTools registry, string regPath, string regKey)
 {
     return((string)registry.GetRegistryValueFromLocalMachineRoot(regPath, regKey, true, (object)null));
 }
Ejemplo n.º 23
0
 private static IInternalSettings GetInternalSettings(IDiagnosticTelemetry diagnosticTelemetry, IRegistryTools registryTools)
 {
     if (Platform.IsWindows)
     {
         return(new WindowsInternalSettings(diagnosticTelemetry, registryTools));
     }
     return(new MonoInternalSettings(diagnosticTelemetry, registryTools));
 }
Ejemplo n.º 24
0
 public MonoLegacyApi(IRegistryTools registryTools)
     : base(registryTools)
 {
 }