예제 #1
0
        /// <summary>
        /// 获取或设置
        /// </summary>
        public static _Configuration CreateInstance(string p_FileName, DirectoryInfo p_AppFolder)
        {
            _Configuration cfg  = null;
            FileInfo       info = new FileInfo(p_FileName);

            if (info.Exists)
            {
                //存对象文件
                try
                {
                    cfg = CFiles.Deserialize(p_FileName) as _Configuration;
                }
                catch (Exception ex)
                {
                    cfg = new _Configuration();
                }
            }
            else
            {
                cfg           = new _Configuration();
                cfg.AppFolder = p_AppFolder;
            }
            cfg.ConfigPath = p_FileName;
            return(cfg);
        }
예제 #2
0
파일: _Global.cs 프로젝트: shansheng/QDJJ
        /// <summary>
        /// 初始化全局配置对象
        /// </summary>
        private void initConfiguration()
        {
            //配置文件是否存在
            //1.不存在,构造一个新的配置文件
            string fn = string.Format("{0}config\\{1}", this.m_AppFolder.FullName, _Configuration.ConfigName);

            this.m_Configuration = _Configuration.CreateInstance(fn, m_AppFolder);
        }