C#操作INI文件

摘要: public class Ini { // 声明INI文件的写操作函数 WritePrivateProfileString() [System.Runtime.InteropServices.DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); // 声明INI文件的读操作函数 GetPrivateProfileS... 阅读全文
posted @ 2012-01-13 16:56 千千阙歌 阅读(193) 评论(0) 推荐(0)

winform post xml 并获取返回xml

摘要: public XDocument sendXmlAndGetResponse(XDocument xDocument) { XmlDocument doc = new XmlDocument(); doc.LoadXml(xDocument.Document.ToString()); WebResponse resp; string strUrl = XMLTools.getXmlValue("LFListenerAddress", "Address");// "http://... 阅读全文
posted @ 2012-01-13 16:55 千千阙歌 阅读(409) 评论(0) 推荐(0)

winform异步监听POST请求

摘要: public void listener() { if (!HttpListener.IsSupported) //是否支持本系统 { MessageBox.Show("本系统只支持xp sp2/win2003"); return; } System.Net.HttpListener httplistener = new System.Net.HttpListener(); string s =... 阅读全文
posted @ 2012-01-13 16:49 千千阙歌 阅读(600) 评论(0) 推荐(0)

XDocument转XmlDocument ,XmlDocument转XDocument 静态扩展方法

摘要: //XmlDocument转XDocumentpublic static class XmlDocumentExtensions { public static XDocument ToXDocument(this XmlDocument document) { return document.ToXDocument(LoadOptions.None); } public static XDocument ToXDocument(this XmlDocument document, LoadOptions op... 阅读全文
posted @ 2012-01-13 16:37 千千阙歌 阅读(452) 评论(0) 推荐(0)

C#读取XML节点

摘要: <?xml version="1.0" encoding="utf-8"?><Resp> <H> <Ver>版本号</Ver> <Sc>状态码</Sc> <Msg>返回消息</Msg> </H></Resp>public static void HandleXML() { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("C:\\11.xml"); 阅读全文
posted @ 2012-01-12 11:33 千千阙歌 阅读(203) 评论(0) 推荐(0)

C#读取XML C#写入XML

摘要: /// <summary> /// 返回XMl文件指定元素的指定属性值 /// </summary> /// <param name="xmlElement">指定元素</param> /// <param name="xmlAttribute">指定属性</param> /// <returns></returns> public static string getXmlValue(string xmlElement, string xmlAttribute 阅读全文
posted @ 2012-01-12 11:30 千千阙歌 阅读(755) 评论(0) 推荐(0)

winform异步获取POST过来的XML

摘要: if (!HttpListener.IsSupported) { MessageBox.Show("本系统只支持xp sp2/win2003"); return; } System.Net.HttpListener httplistener = new System.Net.HttpListener(); string s = string.Format(XMLTools.getXmlValue("LCListenerAdd... 阅读全文
posted @ 2012-01-12 11:27 千千阙歌 阅读(387) 评论(0) 推荐(0)

将Stream转换成String,将String转化成Stream

摘要: 1 using System; 2 using System.IO; 3 using System.Text; 4 namespace CSharpConvertString2Stream 5 { 6 class Program 7 { 8 static void Main( string [] args ) 9 { 10 string str = " Testing 1-2-3 " ; // conv... 阅读全文
posted @ 2012-01-11 13:46 千千阙歌 阅读(516) 评论(0) 推荐(0)