/// <summary> /// /// </summary> /// <returns></returns> public static T LoadGeneralCfg <T>(string path) where T : class { string rootPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; if (HttpContext.Current != null) { rootPath = HttpContext.Current.Server.MapPath("/"); } DefaultConfigFileManager <T> defaultFile = new DefaultConfigFileManager <T>(Path.Combine(rootPath, path)); return((T)defaultFile.LoadConfig()); }
public static bool Save <T>(T cfg, string path) where T : class { string rootPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; if (HttpContext.Current != null) { rootPath = HttpContext.Current.Server.MapPath("/"); } DefaultConfigFileManager <T> defaultFile = new DefaultConfigFileManager <T>(Path.Combine(rootPath, path)); defaultFile.Config = cfg; return(defaultFile.SaveConfig()); }