private static bool CheckBooleanValue(string valueName)
        {
            object obj = DatacenterRegistry.ReadRegistryKey("SOFTWARE\\Microsoft\\ExchangeLabs", valueName);

            if (obj == null)
            {
                return(false);
            }
            if (obj is int)
            {
                bool result;
                switch ((int)obj)
                {
                case 0:
                    result = false;
                    break;

                case 1:
                    result = true;
                    break;

                default:
                    throw new DatacenterInvalidRegistryException();
                }
                return(result);
            }
            throw new DatacenterInvalidRegistryException();
        }
 internal static bool IsMicrosoftHostedOnly()
 {
     if (DatacenterRegistry.isMicrosoftHostedOnly == null)
     {
         DatacenterRegistry.isMicrosoftHostedOnly = new bool?(DatacenterRegistry.CheckBooleanValue("DatacenterMode"));
     }
     return(DatacenterRegistry.isMicrosoftHostedOnly.Value);
 }
 internal static bool IsForefrontForOfficeDeployment()
 {
     if (DatacenterRegistry.isFfoDatacenterDeployment == null)
     {
         DatacenterRegistry.isFfoDatacenterDeployment = new bool?(DatacenterRegistry.CheckBooleanValue("FfoDeploymentMode"));
     }
     return(DatacenterRegistry.isFfoDatacenterDeployment.Value);
 }
 internal static bool IsForefrontForOffice()
 {
     if (DatacenterRegistry.isFfoDatacenter == null)
     {
         DatacenterRegistry.isFfoDatacenter = new bool?(DatacenterRegistry.CheckBooleanValue("ForefrontForOfficeMode"));
     }
     return(DatacenterRegistry.isFfoDatacenter.Value);
 }
 internal static bool TreatPreReqErrorsAsWarnings()
 {
     if (DatacenterRegistry.treatPreReqErrorsAsWarningsKey == null)
     {
         DatacenterRegistry.treatPreReqErrorsAsWarningsKey = new bool?(DatacenterRegistry.CheckBooleanValue("TreatPreReqErrorsAsWarnings"));
     }
     return(DatacenterRegistry.treatPreReqErrorsAsWarningsKey.Value);
 }
 internal static bool IsDatacenterDedicated()
 {
     if (DatacenterRegistry.isDatacenterDedicated == null)
     {
         DatacenterRegistry.isDatacenterDedicated = new bool?(DatacenterRegistry.CheckBooleanValue("DatacenterDedicated"));
     }
     return(DatacenterRegistry.isDatacenterDedicated.Value);
 }
 internal static string GetForefrontServiceTag()
 {
     if (DatacenterRegistry.ffoServiceTagValue == null)
     {
         object obj = DatacenterRegistry.ReadRegistryKey("SOFTWARE\\Microsoft\\ExchangeLabs", "ServiceTag");
         DatacenterRegistry.ffoServiceTagValue = ((obj != null) ? obj.ToString() : string.Empty);
     }
     return(DatacenterRegistry.ffoServiceTagValue);
 }
 internal static bool IsPartnerHostedOnly()
 {
     if (DatacenterRegistry.isPartnerHostedOnly == null)
     {
         object obj = DatacenterRegistry.ReadRegistryKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15", "PartnerHostedMode");
         DatacenterRegistry.isPartnerHostedOnly = new bool?(obj is int && (int)obj == 1);
     }
     return(DatacenterRegistry.isPartnerHostedOnly.Value);
 }
 internal static bool IsFFOGallatinDatacenter()
 {
     if (DatacenterRegistry.isFFOGallatinDatacenter == null)
     {
         object obj = DatacenterRegistry.ReadRegistryKey("SOFTWARE\\Microsoft\\ExchangeLabs", "ServiceName");
         string a   = (obj != null) ? obj.ToString() : string.Empty;
         DatacenterRegistry.isFFOGallatinDatacenter = new bool?(string.Equals(a, "FopePRODcn", StringComparison.InvariantCultureIgnoreCase));
     }
     return(DatacenterRegistry.isFFOGallatinDatacenter.Value);
 }
 internal static bool IsDualWriteAllowed()
 {
     if (DatacenterRegistry.isFfoDualWriteAllowed == null)
     {
         if (ExEnvironment.IsTest)
         {
             DatacenterRegistry.isFfoDualWriteAllowed = new bool?(DatacenterRegistry.CheckBooleanValue("FfoDualWriteAllowed"));
         }
         else
         {
             DatacenterRegistry.isFfoDualWriteAllowed = new bool?(true);
         }
     }
     return(DatacenterRegistry.isFfoDualWriteAllowed.Value);
 }
 internal static string GetForefrontArbitrationServiceUrl()
 {
     if (DatacenterRegistry.ffoArbitrationServiceUrlValue == null)
     {
         object obj = DatacenterRegistry.ReadRegistryKey("SOFTWARE\\Microsoft\\ExchangeLabs", "ArbitrationServiceUrl");
         if (obj != null)
         {
             DatacenterRegistry.ffoArbitrationServiceUrlValue = obj.ToString();
         }
         else
         {
             DatacenterRegistry.ffoArbitrationServiceUrlValue = string.Empty;
         }
     }
     return(DatacenterRegistry.ffoArbitrationServiceUrlValue);
 }
 internal static string GetForefrontAlertEmail()
 {
     if (DatacenterRegistry.ffoAlertEmail == null)
     {
         object obj = DatacenterRegistry.ReadRegistryKey("SOFTWARE\\Microsoft\\ExchangeLabs", "AlertEmail");
         if (obj != null)
         {
             DatacenterRegistry.ffoAlertEmail = obj.ToString();
         }
         else
         {
             DatacenterRegistry.ffoAlertEmail = string.Empty;
         }
     }
     return(DatacenterRegistry.ffoAlertEmail);
 }
 internal static string GetForefrontFopeGlobalSite()
 {
     if (DatacenterRegistry.ffoFopeGlobalSiteValue == null)
     {
         object obj = DatacenterRegistry.ReadRegistryKey("SOFTWARE\\Microsoft\\ExchangeLabs", "FopeGlobalSite");
         if (obj != null)
         {
             DatacenterRegistry.ffoFopeGlobalSiteValue = obj.ToString();
         }
         else
         {
             DatacenterRegistry.ffoFopeGlobalSiteValue = string.Empty;
         }
     }
     return(DatacenterRegistry.ffoFopeGlobalSiteValue);
 }