看到网上的解决方案,真想说,泥煤啊,为什么要那么麻烦?
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | string xmlPath = dirPath + "AutoUpdater/AutoUpdater.xml" ; WebClient wc = new WebClient(); DataSet ds = new DataSet(); ds.Locale = CultureInfo.InvariantCulture; try { Stream sm = wc.OpenRead(xmlPath); ds.ReadXml(sm); DataTable dt = ds.Tables[ "UpdateFileList" ]; if (ds.Tables[ "UpdateText" ] != null && ds.Tables[ "UpdateText" ].Rows.Count == 1 && ds.Tables[ "UpdateText" ].Rows[0][0].ToString() != "" ) { new UpdateText(ds.Tables[ "UpdateText" ].Rows[0][0].ToString().Replace( "r" , "\r\n" ).Replace( 't' , '\t' )).ShowDialog(); } sm.Close(); } catch (Exception ex) { MeBox(ex.Message); } |
XML:
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?xml version="1.0" encoding="utf-8"?> <configuration> <!--最新版本日期--> <UpdateTime Date="2013-03-10" /> <!--要更新的文件列表--> <!--若需要更新conf.config文件,则真实文件名应该为conf.txt--> <UpdateFileList UpdateFile="conf.config"></UpdateFileList> <UpdateFileList UpdateFile="协同办公系统.exe"></UpdateFileList> <UpdateFileList UpdateFile="AutoUpdater.exe"></UpdateFileList> <!--r为换行,t为Tab缩进--> <UpdateText Text="此次更新内容:rt男男女女难男男女女扭扭捏捏"></UpdateText> </configuration> |
这个解决不好吧 — attribute=”reboot”怎么办?
嗯,我也考虑过这个,不过我做的这个项目用不到英文单词,所以想出了这么一个办法.另外,刚刚把自动更新程序改为可以自我更新,所以如果非要包括rt这两个字母倒是也没有什么太大的麻烦
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
=。=C#似乎很给力啊,改天也去学学
不给力…某框架…..