求XML壓縮和解壓縮源碼,在線等。。。

s_111111 2010-06-23 02:30:27
如題,只要兩個方法的源碼就可以。
1.public string XmlPress(string stra)
{
//...這個是壓縮代碼
return strb;
}
2.public string XmlDePress(string strc)
{
//...這個是解壓縮代碼
return strd;
}
在線等,高手幫忙。。。
...全文
201 20 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
s_111111 2010-06-24
  • 打赏
  • 举报
回复
自己頂下,今天要結束了。
s_111111 2010-06-24
  • 打赏
  • 举报
回复
再頂下,盼望高手的到來,今天就結掉。
xk1126 2010-06-23
  • 打赏
  • 举报
回复
顶!~
帮顶!~~~~~~~~~
s_111111 2010-06-23
  • 打赏
  • 举报
回复
serializable序列化是傳輸數據用的,但是XML還是會很大,所以希望再對他壓縮下。希望高手們能不能再幫幫忙。。。
s_111111 2010-06-23
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 baesky 的回复:]
。。。
那能用xmlserializable么?google下 很多例子的~~~
[/Quote]
好 我去找找看 多謝
Baesky 2010-06-23
  • 打赏
  • 举报
回复
。。。
那能用xmlserializable么?google下 很多例子的~~~
s_111111 2010-06-23
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 baesky 的回复:]
引用 12 楼 s_111111 的回复:

GZipStream 這個對象是來自哪個參考?


System.IO.Compression
[/Quote]
很抱歉呀,題目少個條件。運行環境是在SILVERLIGHT上面。所以System.IO.Compression並不能支持。
當時沒考慮到,非常抱歉。
不知道各位有沒有能在SILVERLIGHT上運行的案例。
Baesky 2010-06-23
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 s_111111 的回复:]

GZipStream 這個對象是來自哪個參考?
[/Quote]

System.IO.Compression
s_111111 2010-06-23
  • 打赏
  • 举报
回复
GZipStream 這個對象是來自哪個參考?
s_111111 2010-06-23
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 baesky 的回复:]
C# code

//如題,只要兩個方法的源碼就可以。
//1.
public string XmlPress(string stra)
{
//...這個是壓縮代碼
MemoryStream inStream = new MemoryStream();
StreamWriter writer = new StreamWriter(inStream);
writ……
[/Quote]

看起來比較精髓,待我運行一下。
s_111111 2010-06-23
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wuyq11 的回复:]
http://topic.csdn.net/u/20100602/16/ebd0fa4b-9c13-4779-878e-74c2b6408854.html
[/Quote]
using ICSharpCode.SharpZipLib.Zip.Compression; 這個參考不能加入到SL裡面,所以可能這個方法不行
Baesky 2010-06-23
  • 打赏
  • 举报
回复


//如題,只要兩個方法的源碼就可以。
//1.
public string XmlPress(string stra)
{
//...這個是壓縮代碼
MemoryStream inStream = new MemoryStream();
StreamWriter writer = new StreamWriter(inStream);
writer.Write(stra);
writer.Flush();
writer.Close();
GZipStream gzOut = new GZipStream(inStream, CompressionMode.Compress);
StreamWriter sw = new StreamWriter(gzOut);
sw.Write(stra);
StreamReader sr = new StreamReader(gzOut);
StringBuilder s = new StringBuilder(sr.ReadToEnd);
sw.Close();
gzOut.Close();
return s.ToString();
}
//2.
public string XmlDePress(string strc)
{
//...這個是解壓縮代碼
MemoryStream inStream = new MemoryStream();
StreamWriter writer = new StreamWriter(inStream);
writer.Write(strc);
writer.Flush();
writer.Close();
GZipStream gzOut = new GZipStream(inStream, CompressionMode.DeCompress);
StreamWriter sw = new StreamWriter(gzOut);
sw.Write(strc);
StreamReader sr = new StreamReader(gzOut);
StringBuilder s = new StringBuilder(sr.ReadToEnd);
sw.Close();
gzOut.Close();
return s.ToString();
}

s_111111 2010-06-23
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wuyq11 的回复:]
http://topic.csdn.net/u/20100602/16/ebd0fa4b-9c13-4779-878e-74c2b6408854.html
[/Quote]
我的問題和這個很像,謝謝,我先看看。
s_111111 2010-06-23
  • 打赏
  • 举报
回复
如果能把壓縮就做成兩個方法就可以了XmlPress,XmlDePress,這樣就夠了。
s_111111 2010-06-23
  • 打赏
  • 举报
回复
公司是台企,最主要的還是入門不久,我把文件下載解壓後,有3個文件夾,其中有一個有APP文件,但是不能運行。不知為何
捷哥1999 2010-06-23
  • 打赏
  • 举报
回复
看你用繁体的,应该是台湾、香港、或者澳门的了,英文应该不是问题吧
s_111111 2010-06-23
  • 打赏
  • 举报
回复
有沒有稍微處理一下的,裡面英文解釋較多,不是太能理解。。。
捷哥1999 2010-06-23
  • 打赏
  • 举报
回复
1、到http://www.mastercsharp.com/article.aspx?ArticleID=86&&TopicID=7页面上下载一个"CompressionExtension" project,这个是一个开源的项目,实现的xml的压缩

2、Adding a compression to your webservice is very easy: include the downloaded project into your solution, reference it in your webservice, and mark your web methods with [CompressionExtension] in the proxy-class code. Also, add the [CompressionExtension] flag in the .asmx component. That's it.

参考:http://www.mastercsharp.com/article.aspx?ArticleID=86&&TopicID=7
s_111111 2010-06-23
  • 打赏
  • 举报
回复
自己頂下,求高手幫忙。。。

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧