-
大小: 383KB文件類型: .rar金幣: 2下載: 2 次發(fā)布日期: 2021-12-11
- 語言: C#
- 標(biāo)簽: c#??webService??源代碼??
資源簡介
c#應(yīng)用webService實現(xiàn)自動升級
1、模塊化設(shè)計,獨立于用戶應(yīng)用程序
2、支持下載進度
3、支持用戶程序的版本檢測,并決定是否可升級
4、提供自動產(chǎn)生用戶程序版本工具

代碼片段和文件信息
using?System;
using?System.Web;
using?System.Web.Services;
using?System.Web.Services.Protocols;
using?System.IO;
using?System.xml;
[WebService(Namespace?=?“http://tempuri.org/“)]
[WebServiceBinding(ConformsTo?=?WsiProfiles.BasicProfile1_1)]
public?class?Service?:?System.Web.Services.WebService
{
????private?IAutoUpdateServer?handle?=?new?AutoUpdateServer();
????public?Service?()?{
????????//如果使用設(shè)計的組件,請取消注釋以下行?
????????//InitializeComponent();?
????????//handle.produceVersion(Server.MapPath(@“Bin\updateFile\“)Server.MapPath(@“Bin\update.xml“)?“1.1.0.0“?“升級“);
????}????
????[WebMethod(Description?=?“取得更新版本“)]
????public?string?getVer()
????{????????
????????return(handle.getVer());
????}
????[WebMethod(Description?=?““)]
????public?xmlDocument???getUpdateInfoFile(string?fileNamelong??count)
????{
????????return?handle.getUpdateInfoFile(fileName?count);
????????//int?buffer_size?=?1024?*?1024;//一次讀取的字節(jié)數(shù)
????????//xmlDocument?doc?=?new?xmlDocument();
????????//doc.Load(Server.MapPath(“bin\\download.xml“));
????????//string?path?=?Server.MapPath(“bin\\“);
????????//xmlNode?node?=?doc.SelectSingleNode(“downfile“);
????????//FileStream?fs?=?File.OpenRead(path?+?fileName);
????????//BinaryReader?br?=?new?BinaryReader(fs);
????????//fs.Seek(count?*?buffer_size?SeekOrigin.Begin);
????????//byte[]?buffer?=?br.ReadBytes(buffer_size);
????????//if?(buffer.Length?????????//????node.Attributes[“isComplete“].Value?=?“1“;
????????//else
????????//????node.Attributes[“isComplete“].Value?=?“0“;
????????////這里是文件的實際內(nèi)容,使用了base64String編碼????????
????????//node.Attributes[“value“].InnerText?=?Convert.Tobase64String(buffer?0?buffer.Length);
????????//br.Close();
????????//fs.Close();
????????//return?doc;
????}
????[WebMethod(Description?=?““)]
????public?xmlDocument?getFile(string?fileName?long?count)
????{
????????return?(handle.getFile(fileNamecount?));
????}
????
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2065??2010-11-08?10:45??AutoUpdate\App_Code\Service.cs
?????文件???????4613??2010-11-03?17:52??AutoUpdate\AutoUpdate.sln
????..A..H.?????41472??2010-11-08?14:47??AutoUpdate\AutoUpdate.suo
?????文件????????884??2010-11-04?15:19??AutoUpdate\AutoUpdateClient\app.config
?????文件????????248??2010-11-06?16:58??AutoUpdate\AutoUpdateClient\AutoUpdateClient.cs
?????文件???????4708??2010-11-08?10:47??AutoUpdate\AutoUpdateClient\AutoUpdateClient.csproj
?????文件????????418??2010-11-04?15:21??AutoUpdate\AutoUpdateClient\AutoUpdateClient.csproj.user
?????文件??????32768??2010-11-08?14:44??AutoUpdate\AutoUpdateClient\bin\Debug\AutoUpdateClient.exe
?????文件????????884??2010-11-04?15:19??AutoUpdate\AutoUpdateClient\bin\Debug\AutoUpdateClient.exe.config
?????文件??????44544??2010-11-08?14:44??AutoUpdate\AutoUpdateClient\bin\Debug\AutoUpdateClient.pdb
?????文件???????5632??2005-11-11?22:25??AutoUpdate\AutoUpdateClient\bin\Debug\AutoUpdateClient.vshost.exe
?????文件????????884??2010-11-04?15:19??AutoUpdate\AutoUpdateClient\bin\Debug\AutoUpdateClient.vshost.exe.config
?????文件???????1125??2010-11-08?11:40??AutoUpdate\AutoUpdateClient\bin\Debug\update.xm
?????文件???????1125??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\update1.xm
?????文件?????135168??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\posClient.exe
?????文件???????2885??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\posClient.exe.config
?????文件???????1125??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\update.xm
?????文件??????28672??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Common.dll
?????文件??????24576??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.Authority.dll
?????文件?????212992??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.Calculator.dll
?????文件??????20480??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.Db.dll
?????文件??????20480??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.Goods.dll
?????文件??????16384??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.LineDisplay.dll
?????文件??????16384??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.Printer.dll
?????文件??????45056??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.Sale.dll
?????文件??????16384??2010-11-08?11:59??AutoUpdate\AutoUpdateClient\bin\Debug\updateFiles\Yjg.Pos.Service.Vip.dll
?????文件?????135168??2010-11-06?09:07??AutoUpdate\AutoUpdateClient\bin\Debugview.exe
?????文件???????8706??2010-11-08?14:44??AutoUpdate\AutoUpdateClient\Form1.cs
?????文件???????5912??2010-11-08?11:50??AutoUpdate\AutoUpdateClient\Form1.Designer.cs
?????文件???????5814??2010-11-08?11:50??AutoUpdate\AutoUpdateClient\Form1.resx
............此處省略90個文件信息
評論
共有 條評論