Beispiel #1
0
        private static void CheckRegistry()
        {
            if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize() || BCLDebug.m_registryChecked)
            {
                return;
            }
            BCLDebug.m_registryChecked = true;
            bool loggingEnabled;
            bool logToConsole;
            int  logLevel;
            int  registryLoggingValues = BCLDebug.GetRegistryLoggingValues(out loggingEnabled, out logToConsole, out logLevel, out BCLDebug.m_perfWarnings, out BCLDebug.m_correctnessWarnings, out BCLDebug.m_safeHandleStackTraces);

            if (!loggingEnabled)
            {
                BCLDebug.m_loggingNotEnabled = true;
            }
            if (!loggingEnabled)
            {
                return;
            }
            if (BCLDebug.levelConversions == null)
            {
                return;
            }
            try
            {
                int num = (int)BCLDebug.levelConversions[logLevel];
                if (registryLoggingValues <= 0)
                {
                    return;
                }
                for (int index = 0; index < BCLDebug.switches.Length; ++index)
                {
                    if ((BCLDebug.switches[index].value & registryLoggingValues) != 0)
                    {
                        new LogSwitch(BCLDebug.switches[index].name, BCLDebug.switches[index].name, Log.GlobalSwitch).MinimumLevel = (LoggingLevels)num;
                    }
                }
                Log.GlobalSwitch.MinimumLevel = (LoggingLevels)num;
                Log.IsConsoleEnabled          = logToConsole;
            }
            catch
            {
            }
        }
        private static void CheckRegistry()
        {
            if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
            {
                return;
            }
            if (BCLDebug.m_registryChecked)
            {
                return;
            }
            BCLDebug.m_registryChecked = true;
            bool flag;
            bool isConsoleEnabled;
            int  num;
            int  registryLoggingValues = BCLDebug.GetRegistryLoggingValues(out flag, out isConsoleEnabled, out num, out BCLDebug.m_perfWarnings, out BCLDebug.m_correctnessWarnings, out BCLDebug.m_safeHandleStackTraces);

            if (!flag)
            {
                BCLDebug.m_loggingNotEnabled = true;
            }
            if (flag && BCLDebug.levelConversions != null)
            {
                try
                {
                    num = (int)BCLDebug.levelConversions[num];
                    if (registryLoggingValues > 0)
                    {
                        for (int i = 0; i < BCLDebug.switches.Length; i++)
                        {
                            if ((BCLDebug.switches[i].value & registryLoggingValues) != 0)
                            {
                                LogSwitch logSwitch = new LogSwitch(BCLDebug.switches[i].name, BCLDebug.switches[i].name, System.Diagnostics.Log.GlobalSwitch);
                                logSwitch.MinimumLevel = (LoggingLevels)num;
                            }
                        }
                        System.Diagnostics.Log.GlobalSwitch.MinimumLevel = (LoggingLevels)num;
                        System.Diagnostics.Log.IsConsoleEnabled          = isConsoleEnabled;
                    }
                }
                catch
                {
                }
            }
        }