AA2Install.formMain.CheckInstalled C# (CSharp) Method

CheckInstalled() public method

public CheckInstalled ( ) : bool
return bool
        public bool CheckInstalled()
        {
            errorProvider.Clear();
            errorProviderOK.Clear();
            bool exit = true;
            isChecking = true;

            RegistryKey play = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\illusion\AA2Play");
            RegistryKey edit = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\illusion\AA2Edit");

            play.SetValue("PRODUCTNAME", "ジンコウガクエン2", RegistryValueKind.String);
            edit.SetValue("PRODUCTNAME", "ジンコウガクエン2 きゃらめいく", RegistryValueKind.String);

            play.SetValue("VERSION", 0x64, RegistryValueKind.DWord);
            edit.SetValue("VERSION", 0x64, RegistryValueKind.DWord);

            string playdir = txtPLAYreg.Text = (string)play.GetValue("INSTALLDIR", "");
            string editdir = txtEDITreg.Text = (string)edit.GetValue("INSTALLDIR", "");

            if (playdir == "")
            {
                errorProvider.SetError(lblPLAYreg, "Directory is not set.");
                exit = false;
            }
            else if (!Directory.Exists(playdir) ||
                !playdir.EndsWith("\\"))
            {
                errorProvider.SetError(lblPLAYreg, "Directory can not be found / does not end in a \"\\\".");
                exit = false;
            }
            else if (!Directory.Exists(playdir + @"data\"))
            {
                errorProvider.SetError(lblPLAYreg, "Data subdirectory can not be found.");
                exit = false;
            }
            else
            {
                errorProviderOK.SetError(lblPLAYreg, "Detected as OK.");
            }


            if (editdir == "")
            {
                errorProvider.SetError(lblEDITreg, "Directory is not set.");
                exit = false;
            }
            else if (!Directory.Exists(editdir) ||
                !editdir.EndsWith("\\"))
            {
                errorProvider.SetError(lblEDITreg, "Directory can not be found / does not end in a \"\\\".");
                exit = false;
            }
            else if (!Directory.Exists(editdir + @"data\"))
            {
                errorProvider.SetError(lblEDITreg, "Data subdirectory can not be found.");
                exit = false;
            }
            else
            {
                errorProviderOK.SetError(lblEDITreg, "Detected as OK.");
            }

            isChecking = false;
            return exit;
        }