Ejemplo n.º 1
0
        public static void SetRegKeyValue(BMCInstallationType installationType,
                                          string keyName, string valueName,
                                          RegistryValueKind valueType, object value)
        {
            string fullKeyName = string.Empty;

            switch (ActiveInstallationType)
            {
            case BMCCategorizedInstallationTypes.Exchange:
                fullKeyName = DB_CON_EXC;
                break;

            case BMCCategorizedInstallationTypes.Enterprise:
                fullKeyName = DB_CON_ENT;
                break;

            default:
                throw new InvalidDataException("Registry key does not Exist.  Please check if Registry key is set.");
            }

            if (!string.IsNullOrEmpty(fullKeyName) &&
                !string.IsNullOrEmpty(keyName))
            {
                fullKeyName += "\\" + keyName;
            }
            SetRegKeyValue(fullKeyName, valueName, valueType, value);
        }
Ejemplo n.º 2
0
        public static string GetRegKeyValue(BMCInstallationType installationType,
                                            string keyName, string valueName, object defaultValue)
        {
            string fullKeyName = string.Empty;

            switch (installationType)
            {
            case BMCInstallationType.ExchangeServer:
            case BMCInstallationType.ExchangeClient:
                fullKeyName = DB_CON_EXC;
                break;

            case BMCInstallationType.EnterpriseServer:
            case BMCInstallationType.EnterpriseClient:
                fullKeyName = DB_CON_ENT;
                break;

            default:
                throw new InvalidDataException("Registry key does not Exist.  Please check if Registry key is set.");
            }

            if (!string.IsNullOrEmpty(fullKeyName) &&
                !string.IsNullOrEmpty(keyName))
            {
                fullKeyName += "\\" + keyName;
            }
            return(GetRegKeyValue(fullKeyName, valueName, defaultValue));
        }
Ejemplo n.º 3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            cboInstallationTypes.Items.Clear();
            cboInstallationTypes.DisplayMember = "Text";
            cboInstallationTypes.ValueMember   = "Value";

            var configInterfaces = ConfigApplicationFactory.AvailableInterfaces;

            foreach (var configInterface in configInterfaces)
            {
                ComboBoxItem <string> cbItem = new ComboBoxItem <string>()
                {
                    Text  = configInterface.Value,
                    Value = configInterface.Key
                };
                cboInstallationTypes.Items.Add(cbItem);
            }

            BMCInstallationType installationType = BMCRegistryHelper.InstallationType;
            string mapName = _mappings[installationType];
            var    item    = (from a in cboInstallationTypes.Items.OfType <ComboBoxItem <string> >()
                              where a.Value.IgnoreCaseCompare(mapName)
                              select a).FirstOrDefault();

            if (item != null)
            {
                cboInstallationTypes.SelectedItem = item;
            }
            else
            {
                cboInstallationTypes.SelectedIndex = 0;
            }
        }
Ejemplo n.º 4
0
        public static void SetRegKeyValueEncrypt(BMCInstallationType installationType,
                                                 string keyName, string valueName,
                                                 RegistryValueKind valueType, object value)
        {
            string encrypted = Security.CryptEncode.Encrypt(value.ToString());

            SetRegKeyValue(installationType, keyName, valueName, valueType, encrypted);
        }
Ejemplo n.º 5
0
 public static string GetRegKeyValueDecrypt(BMCInstallationType installationType,
                                            string keyName, string valueName)
 {
     try
     {
         return(Security.CryptEncode.Decrypt(GetRegKeyValue(installationType, keyName, valueName, string.Empty)));
     }
     catch
     {
         return(string.Empty);
     }
 }
Ejemplo n.º 6
0
        public static BMCInstallationType GetInstallationType()
        {
            BMCInstallationType insType = BMCInstallationType.None;

            try
            {
                string installationType = ConfigApplicationFactory.GetValue("Honeyframe", "InstallationType").ToUpper();
                switch (installationType)
                {
                case "EXCHANGECLIENT":
                    insType = BMCInstallationType.ExchangeClient;
                    break;

                case "EXCHANGESERVER":
                    insType = BMCInstallationType.ExchangeServer;
                    break;

                case "ENTERPRISECLIENT":
                    insType = BMCInstallationType.EnterpriseClient;
                    break;

                case "ENTERPRISESERVER":
                    insType = BMCInstallationType.EnterpriseServer;
                    break;

                default:
                    break;
                }

                ActualInstallationType = ((insType == BMCInstallationType.EnterpriseServer) || (insType == BMCInstallationType.EnterpriseClient) ?
                                          BMCCategorizedInstallationTypes.Enterprise : BMCCategorizedInstallationTypes.Exchange);
                ActualApplicationType = ((insType == BMCInstallationType.EnterpriseServer) || (insType == BMCInstallationType.ExchangeServer) ?
                                         BMCCategoriedApplicationTypes.Server : BMCCategoriedApplicationTypes.Client);

                if (ActiveInstallationType == BMCCategorizedInstallationTypes.None)
                {
                    ActiveInstallationType = ActualInstallationType;
                }
                BMC.Common.LogManagement.LogManager.WriteLog("GetInstallationType returns : " + insType.ToString(), BMC.Common.LogManagement.LogManager.enumLogLevel.Debug);
                BMC.Common.LogManagement.LogManager.WriteLog("ActiveInstallationType  returns : " + ActiveInstallationType.ToString(), BMC.Common.LogManagement.LogManager.enumLogLevel.Debug);
            }
            catch { }

            if (insType == BMCInstallationType.None)
            {
                Environment.FailFast("Installation Type does not available.");
            }
            return(insType);
        }
 public static string GetRegKeyValueDecrypt(BMCInstallationType installationType,
                                             string keyName, string valueName)
 {
     try
     {
         return Security.CryptEncode.Decrypt(GetRegKeyValue(installationType, keyName, valueName, string.Empty));
     }
     catch
     {
         return string.Empty;
     }
 }
 public static void SetRegKeyValueEncrypt(BMCInstallationType installationType,
                                              string keyName, string valueName,
                                             RegistryValueKind valueType, object value)
 {
     string encrypted = Security.CryptEncode.Encrypt(value.ToString());
     SetRegKeyValue(installationType, keyName, valueName, valueType, encrypted);
 }
        public static string GetRegKeyValue(BMCInstallationType installationType,
                                            string keyName, string valueName, object defaultValue)
        {
            string fullKeyName = string.Empty;

            switch (installationType)
            {
                case BMCInstallationType.ExchangeServer:
                case BMCInstallationType.ExchangeClient:
                    fullKeyName = DB_CON_EXC;
                    break;

                case BMCInstallationType.EnterpriseServer:
                case BMCInstallationType.EnterpriseClient:
                    fullKeyName = DB_CON_ENT;
                    break;

                default:
                    throw new InvalidDataException("Registry key does not Exist.  Please check if Registry key is set.");
            }

            if (!string.IsNullOrEmpty(fullKeyName) &&
                !string.IsNullOrEmpty(keyName))
            {
                fullKeyName += "\\" + keyName;
            }
            return GetRegKeyValue(fullKeyName, valueName, defaultValue);
        }
Ejemplo n.º 10
0
        public static void SetRegKeyValue(BMCInstallationType installationType,
                                            string keyName, string valueName,
                                            RegistryValueKind valueType, object value)
        {
            string fullKeyName = string.Empty;

            switch (ActiveInstallationType)
            {
                case BMCCategorizedInstallationTypes.Exchange:
                    fullKeyName = DB_CON_EXC;
                    break;

                case BMCCategorizedInstallationTypes.Enterprise:
                    fullKeyName = DB_CON_ENT;
                    break;

                default:
                    throw new InvalidDataException("Registry key does not Exist.  Please check if Registry key is set.");
            }

            if (!string.IsNullOrEmpty(fullKeyName) &&
                !string.IsNullOrEmpty(keyName))
            {
                fullKeyName += "\\" + keyName;
            }
            SetRegKeyValue(fullKeyName, valueName, valueType, value);
        }