Пример #1
0
    public void VerifyOfficeUninstalled(SetupEventArgs e)
    {
        string       officePath = null;
        const string regPath    = @"SOFTWARE\Microsoft\Office\ClickToRun\Configuration";

        try
        {
            var officeRegKey = Registry.LocalMachine.OpenSubKey(regPath);
            if (officeRegKey != null)
            {
                officePath = officeRegKey.GetValue("ClientFolder").ToString();
            }
            else
            {
                officePath = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder") ??
                             RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder");
            }
        }
        catch { }

        if (!string.IsNullOrEmpty(officePath))
        {
            e.Result = ActionResult.Failure;
            return;
        }

        e.Result = ActionResult.Success;
    }
Пример #2
0
        private string GetOculusHomeLocation()
        {
            string path = RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Oculus VR, LLC\Oculus\Config", @"InitialAppLibrary");

            if (path != null)
            {
                path = path + @"\Software\hyperbolic-magnetism-beat-saber";
            }
            return(path);
        }
Пример #3
0
        public bool IsBypassed(Uri host)
        {
            String proxyHost = RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "ProxyHost");

            if (proxyHost == null)
            {
                proxyHost = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "ProxyHost");
            }

            // bypass proxy only if there is no proxy host set up
            return(proxyHost == null || proxyHost.Length == 0);
        }
Пример #4
0
        public Uri GetProxy(Uri destination)
        {
            String proxyHost = RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "ProxyHost");

            if (proxyHost == null)
            {
                proxyHost = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "ProxyHost");
            }

            if (proxyHost == null || proxyHost.Length == 0)
            {
                return(null);
            }
            return(new Uri("http://" + proxyHost));
        }
Пример #5
0
    public void RepairOffice(SetupEventArgs e)
    {
        string officePath = null;

        const string regPath = @"SOFTWARE\Microsoft\Office\ClickToRun\Configuration";

        var officeRegKey = Registry.LocalMachine.OpenSubKey(regPath);

        if (officeRegKey != null)
        {
            officePath = officeRegKey.GetValue("ClientFolder").ToString();
        }
        else
        {
            officePath = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder") ??
                         RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder");
        }

        if (officePath == null)
        {
            e.Result = ActionResult.Success;
            return;
        }

        var officeFilePath = officePath + @"\OfficeClickToRun.exe";

        if (!System.IO.File.Exists(officeFilePath))
        {
            e.Result = ActionResult.Success;
            return;
        }

        var p = new Process
        {
            StartInfo = new ProcessStartInfo()
            {
                FileName        = officeFilePath,
                Arguments       = "scenario=Repair DisplayLevel=True",
                CreateNoWindow  = true,
                UseShellExecute = false
            },
        };

        p.Start();
        p.WaitForExit();

        e.Result = ActionResult.Success;
    }
Пример #6
0
        public static string GetAPIKey()
        {
            var logger = new Logger();
            var apiKey = (string)RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "AgentAPIKey");

            if (apiKey == null)
            {
                apiKey = (string)RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "AgentAPIKey");
            }

            if (apiKey == null)
            {
                logger.LogError("CHT Agent API Key is null. is AgentAPIKey value in HKEY_LOCAL_MACHINE\\Software\\CloudHealth Technologies set?");
            }

            return(apiKey);
        }
Пример #7
0
        public static string GetCloudName()
        {
            var logger    = new Logger();
            var cloudName = (string)RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "CloudName");

            if (cloudName == null)
            {
                cloudName = (string)RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\CloudHealth Technologies", "CloudName");
            }

            if (cloudName == null)
            {
                if (!warnedCloudName)
                {
                    logger.LogError("CloudName is null. Defaulting to \"aws\". Is CloudName value in HKEY_LOCAL_MACHINE\\Software\\CloudHealth Technologies set?");
                }
                warnedCloudName = true;
                cloudName       = "aws";
            }
            return(cloudName);
        }