示例#1
0
        //////////////////////////////////////////////////////////////
        /// <summary>
        ///   This method is used to load all of the confiuration
        ///   settings from the specified IConfigSupplier.
        /// </summary>
        /// <param name="props">the supplier</param>
        //////////////////////////////////////////////////////////////

        public static void LoadSettings(IConfigSupplier props)
        {
            lock (_props)
            {
                if (!_props.Equals(props))
                {
                    foreach (string key in props.Keys)
                    {
                        _props[key] = props[key];
                    }
                }
            }

            // FIXME:  need to eliminate the get bool check
            // cut-n-paste!!!
            string s = props["errortrace.tracefile"];

            if (s != null)
            {
                string a      = props["errortrace.append"];
                bool   append = true;

                if (a != null)
                {
                    char c = a.ToLower()[0];
                    if (c != 'y' && c != 't')
                    {
                        append = false;
                    }
                }
                SetTraceFile(s, append);
            }

            s = props["errortrace.showts"];
            if (s != null)
            {
                char c = s.ToLower()[0];
                if (c != 'y' && c != 't')
                {
                    ShowTimestamp = false;
                }
            }
            s = props["errortrace.showthreadalways"];
            if (s != null)
            {
                char c = s.ToLower()[0];
                if (c != 'y' && c != 't')
                {
                    ShowThreadNameAlways = false;
                }
            }
            s = props["errortrace.tsfmt"];
            if (s != null)
            {
                TimestampFormat = s;
            }

            s = props["errortrace.tracelevel"];
            if (s != null)
            {
                GlobalTraceLevel = int.Parse(s);
            }

            // take care of the instances

            foreach (string key in _tracers.Keys)
            {
                TraceCore tc = (TraceCore)_tracers[key];
                tc.LoadInstanceSettings(key, props);
            }
        }