摘要: 最近我做的一些项目,经常需要用到对应用程序的配置文件操作,如app.config和web.config的配置文件,特别是对配置文件中的[appSettings]和[connectionStrings]两个节点常常进行新增、修改、删除和读取相关的操作的,所以,我自己就亲手把这些相关的操作都封装到一个配置文件管理器中,用静态的方法来调用便可,以下是我的实现,以资参考. 1 using System; 2 using System.Data; 3 using System.Configuration; 4 using System.Web; 5 using System.Collectio... 阅读全文
posted @ 2013-07-03 14:42 PowerZhang 阅读(856) 评论(0) 推荐(0) 编辑
摘要: 以下是app.config或web.config的定义,定义了一个参数,键为Isinit,值为false 以下是读和写config文件的方法定义:写入:1 internal void settingApp_write(string key, string val) 2 { 3 System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); 4 config.AppSettings.Settings["IsInit... 阅读全文
posted @ 2013-07-03 14:27 PowerZhang 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 编码解码、图片与byte[]、日志文件写入和读取 1 /// 2 /// 将字符串编码为Base64字符串 3 /// 4 /// 5 /// 6 public static string Base64Encode(string str) 7 { 8 byte[] barray; 9 barray = Encoding.Default.GetBytes(str);10 return Convert.ToBase6... 阅读全文
posted @ 2013-07-03 11:22 PowerZhang 阅读(1832) 评论(0) 推荐(0) 编辑