123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #region Apache License
- #endregion
- #if !NETCF
- using System;
- using System.Text;
- using System.IO;
- using System.Collections;
- using log4net.Core;
- using log4net.Util;
- using log4net.Repository;
- namespace log4net.Util.PatternStringConverters
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- internal sealed class AppSettingPatternConverter : PatternConverter
- {
- private static IDictionary AppSettingsDictionary
- {
- get
- {
- if (_appSettingsHashTable == null)
- {
- Hashtable h = new Hashtable();
- foreach(string key in System.Configuration.ConfigurationManager.AppSettings)
- {
- h.Add(key, System.Configuration.ConfigurationManager.AppSettings[key]);
- }
- _appSettingsHashTable = h;
- }
- return _appSettingsHashTable;
- }
- }
- private static Hashtable _appSettingsHashTable;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- override protected void Convert(TextWriter writer, object state)
- {
- if (Option != null)
- {
-
- WriteObject(writer, null, System.Configuration.ConfigurationManager.AppSettings[Option]);
- }
- else
- {
-
- WriteDictionary(writer, null, AppSettingsDictionary);
- }
- }
- }
- }
- #endif
|