示例#1
0
        /// <summary>
        /// �������ļ���ֵ
        /// </summary>
        /// <param name="sectionName"></param>
        /// <param name="itemName"></param>
        /// <returns></returns>
        public string gsGetConfigPropertyValue(string sectionName, string itemName)
        {
            Assembly SampleAssembly;
            string FilePath;

            try
            {
                SampleAssembly = Assembly.GetExecutingAssembly();
                FilePath=System.IO.Path.GetDirectoryName(SampleAssembly.CodeBase.Substring(8));
                mConfigFile= FilePath + "\\Config.Xml";

                CConfigManager myConfigManager=new CConfigManager(mConfigFile);
                return myConfigManager.getPropertyValue(sectionName,itemName);
            }
            catch(Exception e)
            {
                return "";
            }
        }
示例#2
0
        /// <summary>
        ///��������ֵ 
        /// </summary>
        /// <param name="sectionName"></param>
        /// <param name="itemName"></param>
        /// <param name="itemValue"></param>
        public void gsSetConfigPropertyValue(string sectionName, string itemName, string itemValue)
        {
            Assembly SampleAssembly;
            string FilePath;

            try
            {

                SampleAssembly = Assembly.GetExecutingAssembly();
                FilePath=System.IO.Path.GetDirectoryName(SampleAssembly.CodeBase.Substring(8));
                mConfigFile= FilePath + "\\Config.Xml";

                CConfigManager myConfigManager=new CConfigManager(mConfigFile);
                myConfigManager.setPropertyValue(sectionName,itemName,itemValue);
            }
            catch(Exception e)
            {
                throw new Exception (e.Message );
            }
        }