예제 #1
0
 public object Create(object parent, object configContext, System.Xml.XmlNode section)
 {
     CodeNamePairSetting setting = new CodeNamePairSetting();
     if (section != null)
     {
         setting.BaseAbsoluteFolder = GetNodeAttribute(section, "baseFolder");
         setting.AppendItems = GetAppendItems(section, "appendItems", "appendItem");
     }
     if (setting.BaseAbsoluteFolder == null || setting.BaseAbsoluteFolder.Trim().Length <= 0)
     {
         setting.BaseAbsoluteFolder = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Configuration\\CodeNamePairs");
     }
     else
     {
         string p = Path.GetPathRoot(setting.BaseAbsoluteFolder);
         if (p == null || p.Trim().Length <= 0) // 说明是相对路径
         {
             setting.BaseAbsoluteFolder = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, setting.BaseAbsoluteFolder);
         }
     }
     if (setting.AppendItems == null)
     {
         setting.AppendItems = new Dictionary<string, Tuple<string, string>>(0);
     }
     return setting;
 }
예제 #2
0
 internal static CodeNamePairSetting GetSetting()
 {
     if (s_Setting == null)
     {
         lock (s_SyncObj)
         {
             if (s_Setting == null)
             {
                 s_Setting = ConfigurationManager.GetSection("codeNamePair") as CodeNamePairSetting;
             }
         }
     }
     return s_Setting;
 }