コード例 #1
0
ファイル: Globals.cs プロジェクト: YHZX2013/exchange_diff
        internal static T GetEnumValueFromRegistry <T>(string registryPath, string valueName, T defaultValue, Microsoft.Exchange.Diagnostics.Trace tracer) where T : struct
        {
            string valueFromRegistry = Globals.GetValueFromRegistry <string>(registryPath, valueName, defaultValue.ToString(), tracer);
            T      result;

            if (Enum.TryParse <T>(valueFromRegistry, out result))
            {
                tracer.TraceDebug <string, string>(0L, "Using enum {0} = {1} (from registry)", valueName, valueFromRegistry);
                return(result);
            }
            tracer.TraceError <string, string, T>(0L, "{0} has wrong enum value: {1}, using {2}.", valueName, valueFromRegistry, defaultValue);
            return(defaultValue);
        }
コード例 #2
0
ファイル: Globals.cs プロジェクト: YHZX2013/exchange_diff
 static Globals()
 {
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         Globals.processName              = currentProcess.MainModule.ModuleName;
         Globals.processId                = currentProcess.Id;
         Globals.processProcessName       = currentProcess.ProcessName;
         Globals.isExchangeTestExecutable = Globals.CheckExchangeTestExecutables(Globals.processProcessName);
     }
     Globals.SetProcessNameAppName();
     Globals.logger = new ExEventLog(Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.TopologyProviderTracer.Category, "MSExchange ADAccess");
     Globals.logger.SetEventPeriod(Globals.GetIntValueFromRegistry("LogPeriod", 900, 0));
     Globals.isDatacenterFlag              = Datacenter.IsMultiTenancyEnabled();
     Globals.isMicrosoftHostedOnly         = Datacenter.IsMicrosoftHostedOnly(true);
     Globals.testPassTypeValue             = Globals.GetValueFromRegistry <string>("SOFTWARE\\Microsoft\\Exchange_Test\\v15", "TestPassType", string.Empty, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.forceLdapLatency              = (Globals.GetValueFromRegistry <int>("SOFTWARE\\Microsoft\\Exchange_Test\\v15", "ForceLdapLatency", 0, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer) > 0);
     Globals.TenantInfoCacheTime           = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "TenantInfoCacheTime", 1800, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.RecipientInfoCacheTime        = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "RecipientInfoCacheTime", 300, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.RecipientTokenGroupsCacheTime = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "RecipientTokenGroupsCacheTime", 900, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.EnableNotification            = (Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "EnableNotification", 1, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer) == 0);
     Globals.LdapConnectionPoolSize        = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "LdapConnectionPoolSize", 5, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
 }