⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 手机短信息的编程.htm

📁 GPS的资料,上来和大家分享,正做这个的朋友可以看看.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<DIV class=postbody>=========================</DIV>
<DIV class=postbody>大家不用惊慌,.NET 3.0依然搭建在.NET 2.0的运行环境上,最多也就算是.NET 2.5。</DIV>
<DIV class=postbody>RTM包括:</DIV>
<DIV class=postbody>Windows Presentation Foundation <BR>Windows Communication 
Foundation <BR>Windows Workflow Foundation <BR>Windows CardSpace </DIV>
<DIV class=postbody><BR>.NET 3 Runtime 下载:<BR>Download the full x86 
redistributable <BR><A 
href="http://go.microsoft.com/fwlink/?LinkId=70848">http://go.microsoft.com/fwlink/?LinkId=70848</A><BR>Download 
the full x64 redistributable<BR><A 
href="http://go.microsoft.com/fwlink/?LinkId=70849">http://go.microsoft.com/fwlink/?LinkId=70849</A></DIV>
<DIV class=postbody>Windows SDK For .NET Framework 3.0 下载:<BR><A 
href="http://www.microsoft.com/downloads/info.aspx?na=40&amp;p=3&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=10cc340b-f857-4a14-83f5-25634c3bf043&amp;u=http%3a%2f%2fgo.microsoft.com%2ffwlink%2f%3fLinkId%3d74726">http://www.microsoft.com/downloads/info.aspx?na=40&amp;p=3&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=10cc340b-f857-4a14-83f5-25634c3bf043&amp;u=http%3a%2f%2fgo.microsoft.com%2ffwlink%2f%3fLinkId%3d74726</A></DIV>
<DIV class=postbody>Microsoft Visual Studio 2005 Extensions for Windows WorkFlow 
Foundation 下载:<BR><A 
href="http://www.microsoft.com/downloads/info.aspx?na=40&amp;p=4&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=10cc340b-f857-4a14-83f5-25634c3bf043&amp;u=http%3a%2f%2fgo.microsoft.com%2ffwlink%2f%3fLinkId%3d74727">http://www.microsoft.com/downloads/info.aspx?na=40&amp;p=4&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=10cc340b-f857-4a14-83f5-25634c3bf043&amp;u=http%3a%2f%2fgo.microsoft.com%2ffwlink%2f%3fLinkId%3d74727</A></DIV>
<DIV class=postbody>WCF和WPF的VS2005扩展包还没有正式发布。</DIV>
<DIV class=postbody></DIV>
<DIV 
class=postbody>引用于:http://community.csdn.net/Expert/topic/5140/5140038.xml?temp=.7662622</DIV>
<DIV class=postbody></DIV></DIV>&nbsp;<A 
href="http://liujace.itpub.net/post/4284/240967">查看全文</A>
<P></P><BR style="CLEAR: both"></DIV>
<DIV class=contentcomments><A class=commentfoot 
href="http://liujace.itpub.net/post/4284/240967#comments">评论 (0)</A> <A 
class=commentfoot href="http://liujace.itpub.net/trackbacks/4284/240967">引用 
(0)</A> <A class=commentfoot 
href="http://liujace.itpub.net/category/4284/10421">手机编程[3]</A> <A 
class=commentfoot href="http://liujace.itpub.net/category/4284/7950">技术资源[7]</A> 
<A class=commentfoot 
href="http://liujace.itpub.net/category/4284/7956">开源项目[1]</A> <A 
class=commentfoot 
href="http://liujace.itpub.net/category/4284/7955">C#编程[11]</A> <A 
class=commentfoot 
href="http://liujace.itpub.net/category/4284/42845">随心记事[0]</A> </DIV></DIV>
<DIV class=post><!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"                                   xmlns:dc="http://purl.org/dc/elements/1.1/"                                   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"><rdf:Description                             rdf:about="http://liujace.itpub.net/post/4284/240865"                             dc:identifier="http://liujace.itpub.net/post/4284/240865"                             dc:title="MSDN WebCast下载中心"                             trackback:ping="http://blog.itpub.net//trackback.php?id=240865"/></rdf:RDF> -->
<DIV class=contenttitle><A href="http://liujace.itpub.net/post/4284/240865">MSDN 
WebCast下载中心</A></DIV>
<DIV class=contenttime>liujace - by - 15 十二月, 2006 09:05</DIV>
<DIV id=blogbody>
<P>
<P>MSDN WebCast下载中心</P>
<P><A 
href="http://www.microsoft.com/china/msdn/events/webcasts/shared/webcast/downloadarchive.aspx">http://www.microsoft.com/china/msdn/events/webcasts/shared/webcast/downloadarchive.aspx</A></P>&nbsp;<A 
href="http://liujace.itpub.net/post/4284/240865">查看全文</A>
<P></P><BR style="CLEAR: both"></DIV>
<DIV class=contentcomments><A class=commentfoot 
href="http://liujace.itpub.net/post/4284/240865#comments">评论 (0)</A> <A 
class=commentfoot href="http://liujace.itpub.net/trackbacks/4284/240865">引用 
(0)</A> <A class=commentfoot 
href="http://liujace.itpub.net/category/4284/10421">手机编程[3]</A> <A 
class=commentfoot href="http://liujace.itpub.net/category/4284/7950">技术资源[7]</A> 
<A class=commentfoot 
href="http://liujace.itpub.net/category/4284/7956">开源项目[1]</A> <A 
class=commentfoot 
href="http://liujace.itpub.net/category/4284/7955">C#编程[11]</A> <A 
class=commentfoot 
href="http://liujace.itpub.net/category/4284/42845">随心记事[0]</A> </DIV></DIV>
<DIV class=post><!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"                                   xmlns:dc="http://purl.org/dc/elements/1.1/"                                   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"><rdf:Description                             rdf:about="http://liujace.itpub.net/post/4284/240834"                             dc:identifier="http://liujace.itpub.net/post/4284/240834"                             dc:title="手机短信息的编解码类 -转"                             trackback:ping="http://blog.itpub.net//trackback.php?id=240834"/></rdf:RDF> -->
<DIV class=contenttitle><A 
href="http://liujace.itpub.net/post/4284/240834">手机短信息的编解码类 -转</A></DIV>
<DIV class=contenttime>liujace - by - 14 十二月, 2006 22:00</DIV>
<DIV id=blogbody>
<P>
<P>//手机短信息的编解码类 <BR>//作者:未知 来源:转载 发布时间:2006-6-2 12:15:38 发布人:allman <BR>//减小字体 
增大字体 </P>
<P>using System;<BR>using System.Text;</P>
<P>namespace jace.CN.SMSLib<BR>{<BR>/// &lt;summary&gt;<BR>/// By popcorn 
2004.5。<BR>/// <A 
href="mailto:cnpopcorn@hotmail.com">cnpopcorn@hotmail.com</A><BR>/// 
&lt;/summary&gt;<BR>public class CNText<BR>{<BR>public CNText()<BR>{<BR>} 
<BR>/// &lt;summary&gt;<BR>/// 编码格式<BR>/// &lt;/summary&gt;<BR>public enum 
GSMCode<BR>{<BR>Bit7=0,<BR>Bit8=1,<BR>UCS2=2<BR>}</P>
<P>/// &lt;summary&gt;<BR>/// 对整个短信息进行解码<BR>/// &lt;/summary&gt;<BR>/// 
&lt;param name="s"&gt;要解码的信息&lt;/param&gt;<BR>/// &lt;param 
name="phone"&gt;解码后的电话号码&lt;/param&gt;<BR>/// &lt;param 
name="text"&gt;解码后的短信内容&lt;/param&gt;<BR>/// &lt;param 
name="sendTime"&gt;短信时间戳&lt;/param&gt;<BR>/// &lt;param 
name="code"&gt;使用的编码方式&lt;/param&gt;<BR>/// &lt;param 
name="SCA"&gt;短信中心号&lt;/param&gt;<BR>/// 
&lt;returns&gt;成功返回true&lt;/returns&gt;<BR>static public bool DecodingMsg(string 
s,ref string phone,ref string text,ref DateTime sendTime,ref GSMCode code,ref 
string SCA)<BR>{<BR>try<BR>{<BR>//短信息中心<BR>int 
iLength=int.Parse(s.Substring(0,2),System.Globalization.NumberStyles.AllowHexSpecifier);<BR>if(iLength&gt;0)<BR>{<BR>if(s.Substring(2,2)=="91")<BR>{<BR>SCA+="+";<BR>iLength--;<BR>}<BR>for(int 
i=0;i&lt;iLength*2;i+=2)<BR>{<BR>SCA+=s.Substring(5+i,1);<BR>SCA+=s.Substring(4+i,1);<BR>}<BR>if(SCA.EndsWith("F"))SCA=SCA.Remove(SCA.Length-1,1);<BR>}</P>
<P>s=s.Remove(0,iLength*2+6);</P>
<P>//发送方号码<BR>iLength=int.Parse(s.Substring(0,2),System.Globalization.NumberStyles.AllowHexSpecifier);<BR>if(s.Substring(2,2)=="91")<BR>{<BR>phone="+";<BR>} 
<BR>if(iLength%2==1)iLength++;<BR>for(int 
i=0;i&lt;iLength;i+=2)<BR>{<BR>phone+=s.Substring(5+i,1);<BR>phone+=s.Substring(4+i,1);<BR>} 
<BR>if(phone.EndsWith("F"))phone=phone.Remove(phone.Length-1,1);</P>
<P>s=s.Remove(0,iLength+6);<BR>//编码方式<BR>if(s.Substring(0,2)=="08")<BR>code=GSMCode.UCS2;<BR>else 
if(s.Substring(0,2)=="00")<BR>code=GSMCode.Bit7;<BR>else<BR>code=GSMCode.Bit8;</P>
<P>s=s.Remove(0,2);<BR>//时间戳<BR>sendTime=new 
DateTime(int.Parse("20"+s.Substring(1,1)+s.Substring(0,1)),<BR>int.Parse(s.Substring(3,1)+s.Substring(2,1)),<BR>int.Parse(s.Substring(5,1)+s.Substring(4,1)),<BR>int.Parse(s.Substring(7,1)+s.Substring(6,1)),<BR>int.Parse(s.Substring(9,1)+s.Substring(8,1)),<BR>int.Parse(s.Substring(11,1)+s.Substring(10,1)));<BR>s=s.Remove(0,16);</P>
<P>//收到的信息<BR>if(code==GSMCode.Bit7)<BR>{<BR>text=DecodingBit7(s);<BR>}<BR>else 
if(code==GSMCode.UCS2)<BR>{<BR>text=DecodingUCS2(s);<BR>}<BR>else<BR>{<BR>text=DecodingBit8(s);<BR>}<BR>return 
true;<BR>}<BR>catch<BR>{<BR>return false;<BR>}<BR>}</P>
<P>/// &lt;summary&gt;<BR>/// 对短信息中心进行编码<BR>/// &lt;/summary&gt;<BR>/// 
&lt;param name="s"&gt;要编码的号码&lt;/param&gt;<BR>/// 
&lt;returns&gt;编码后的号码&lt;/returns&gt;<BR>static public string EncodingSCA(string 
s)<BR>{<BR>StringBuilder sb=new 
StringBuilder();<BR>if(s.Length==0)<BR>{<BR>sb.Append("00");<BR>return 
sb.ToString();<BR>}<BR>if(s.StartsWith("+"))<BR>{<BR>sb.Append("91"); 
//用国际格式号码(在前面加‘+’)<BR>s=s.Remove(0,1);<BR>}<BR>else<BR>{<BR>sb.Append("C8");<BR>}<BR>if(s.Length%2==1)s+="F";<BR>for(int 
i=0;i&lt;s.Length;i+=2)<BR>{<BR>sb.Append(s.Substring(i+1,1));<BR>sb.Append(s.Substring(i,1));<BR>}<BR>string 
len=(sb.Length/2).ToString("X2");<BR>return len+sb.ToString();<BR>}<BR>/// 
&lt;summary&gt;<BR>/// 对电话号码进行编码<BR>/// &lt;/summary&gt;<BR>/// &lt;param 
name="mobileNo"&gt;要编码的电话号码&lt;/param&gt;<BR>/// 
&lt;returns&gt;编码后的电话号码&lt;/returns&gt;<BR>static public string 
EncodingNumber(string mobileNo)<BR>{<BR>StringBuilder sb=new 
StringBuilder();<BR>if(mobileNo.StartsWith("+"))<BR>{<BR>sb.Append("91");<BR>mobileNo=mobileNo.Remove(0,1);<BR>}<BR>else<BR>{<BR>sb.Append("C8");<BR>}<BR>string 
len=mobileNo.Length.ToString("X2");<BR>if(mobileNo.Length%2==1)mobileNo+="F";<BR>for(int 
i=0;i&lt;mobileNo.Length;i+=2)<BR>{<BR>sb.Append(mobileNo.Substring(i+1,1));<BR>sb.Append(mobileNo.Substring(i,1));<BR>}<BR>return 
len+sb.ToString();<BR>}</P>
<P>/// &lt;summary&gt;<BR>/// 使用7-bit进行编码<BR>/// &lt;/summary&gt;<BR>/// 
&lt;param name="s"&gt;要编码的英文字符串&lt;/param&gt;<BR>/// 
&lt;returns&gt;信息长度及编码后的字符串&lt;/returns&gt;<BR>static public string 
EncodingBit7(string s)<BR>{<BR>int iLeft=0;<BR>string 
sReturn="";<BR>StringBuilder sb=new StringBuilder();<BR>for(int 
i=0;i&lt;s.Length;i++)<BR>{<BR>// 取源字符串的计数值的最低3位<BR>int iChar = i &amp; 7; 
<BR>byte bSrc=(byte)char.Parse(s.Substring(i,1));<BR>// 处理源串的每个字节<BR>if(iChar == 
0)<BR>{<BR>// 组内第一个字节,只是保存起来,待处理下一个字节时使用<BR>iLeft = 
(int)char.Parse(s.Substring(i,1));<BR>}<BR>else<BR>{<BR>// 
组内其它字节,将其右边部分与残余数据相加,得到一个目标编码字节<BR>sReturn=(bSrc &lt;&lt; (8-iChar) | 
iLeft).ToString("X4");<BR>// 将该字节剩下的左边部分,作为残余数据保存起来<BR>iLeft = bSrc &gt;&gt; 
iChar;<BR>// 修改目标串的指针和计数值 pDst++;<BR>sb.Append(sReturn.Substring(2,2));<BR>} 
<BR>}<BR>sb.Append(sReturn.Substring(0,2));<BR>return 
(sb.Length/2).ToString("X2")+sb.ToString();<BR>}<BR>/// &lt;summary&gt;<BR>/// 
对7-bit编码进行解码<BR>/// &lt;/summary&gt;<BR>/// &lt;param 
name="s"&gt;要解码的字符串&lt;/param&gt;<BR>/// 
&lt;returns&gt;解码后的英文字符串&lt;/returns&gt;<BR>static public string 
DecodingBit7(string s)<BR>{<BR>int iByte=0;<BR>int iLeft=0;<BR>// 
将源数据每7个字节分为一组,解压缩成8个字节<BR>// 循环该处理过程,直至源数据被处理完<BR>// 
如果分组不到7字节,也能正确处理<BR>System.Text.StringBuilder sb=new 
System.Text.StringBuilder();<BR>for(int i=0;i&lt;s.Length;i+=2)<BR>{<BR>byte 
bSrc=byte.Parse(s.Substring(i,2),System.Globalization.NumberStyles.AllowHexSpecifier);<BR>// 
将源字节右边部分与残余数据相加,去掉最高位,得到一个目标解码字节<BR>sb.Append((((bSrc &lt;&lt; iByte) | iLeft) 
&amp; 0x7f).ToString("X2"));<BR>// 将该字节剩下的左边部分,作为残余数据保存起来<BR>iLeft = bSrc 
&gt;&gt; (7-iByte);<BR>// 修改字节计数值<BR>iByte++;<BR>// 到了一组的最后一个字节<BR>if(iByte == 
7)<BR>{<BR>// 额外得到一个目标解码字节<BR>sb.Append(iLeft.ToString("X2")); <BR>// 
组内字节序号和残余数据初始化<BR>iByte = 0;<BR>iLeft = 0;<BR>}<BR>}<BR>string 
sReturn=sb.ToString();<BR>byte [] buf=new byte[sReturn.Length/2];<BR>for(int 
i=0;i&lt;sReturn.Length;i+=2)<BR>{<BR>buf[i/2]=byte.Parse(sReturn.Substring(i,2),System.Globalization.NumberStyles.AllowHexSpecifier);<BR>}<BR>return 
System.Text.Encoding.ASCII.GetString(buf);<BR>}<BR>//[dvnews_page]<BR>/// 
&lt;summary&gt;<BR>/// 使用8-bit进行编码<BR>/// &lt;/summary&gt;<BR>/// &lt;param 
name="s"&gt;要编码的字符串&lt;/param&gt;<BR>/// 
&lt;returns&gt;信息长度及编码后的字符串&lt;/returns&gt;<BR>static public string 
EncodingBit8(string s)<BR>{<BR>StringBuilder sb=new StringBuilder();<BR>byte [] 
buf=Encoding.ASCII.GetBytes(s);<BR>sb.Append(buf.Length.ToString("X2"));<BR>for(int 
i=0;i&lt;buf.Length;i++)<BR>{<BR>sb.Append(buf[i].ToString("X2"));<BR>}<BR>return 
sb.ToString();<BR>}<BR>/// &lt;summary&gt;<BR>/// 使用8-bit进行解码<BR>/// 
&lt;/summary&gt;<BR>/// &lt;param name="s"&gt;要解码的字符串&lt;/param&gt;<BR>/// 
&lt;returns&gt;解码后的字符串&lt;/returns&gt;<BR>static public string 
DecodingBit8(string s)<BR>{<BR>byte [] buf=new 
byte[s.Length/2];<BR>StringBuilder sb=new StringBuilder();<BR>for(int 
i=0;i&lt;s.Length;i+=2)<BR>{<BR>buf[i/2]=byte.Parse(s.Substring(i,2),System.Globalization.NumberStyles.AllowHexSpecifier);<BR>}<BR>return 
Encoding.ASCII.GetString(buf);<BR>}</P>
<P>/// &lt;summary&gt;<BR>/// 中文短信息UCS2编码<BR>/// &lt;/summary&gt;<BR>/// 
&lt;param name="s"&gt;要编码的中文字符串&lt;/param&gt;<BR>/// 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -