コード例 #1
0
        /// <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());
        }
コード例 #2
0
        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());
        }