VB.Net程序设计:AutoUpdater软件自动更新-源代码。
界面和配置文件参考:
http://blog.csdn.net/linjimu/archive/2009/10/27/4733283.aspx
XmlFiles.vb
- Imports System
- Imports System.IO
- Imports System.Xml
- Public Class XmlFiles
- Inherits XmlDocument
- Private _xmlFileName As String
- Public Property XmlFileName() As String
- Get
- Return _xmlFileName
- End Get
- Set(ByVal value As String)
- _xmlFileName = value
- End Set
- End Property
- Public Sub New(ByVal xmlFile As String)
- XmlFileName = xmlFile
- Me.Load(XmlFileName)
- End Sub
- '''<summary>
- '''给定一个节点的xPath表达式并返回一个节点
- '''</summary>
- '''<param name="xPath"></param>
- '''<returns></returns>
- Public Function FindNode(ByVal xPath As String) As XmlNode
- Dim xmlNode As XmlNode = Me.SelectSingleNode(xPath)
- Return xmlNode
- End Function
- '''<summary>
- '''给定一个节点的xPath表达式返回其值
- '''</summary>
- '''<param name="xPath"></param>
- '''<returns></returns>
- Public Function GetNodeValue(ByVal xPath As String) As String
- Dim xmlNode As XmlNode = Me.SelectSingleNode(xPath)
- Return xmlNode.InnerText
- End Function
- '''<summary>
- '''给定一个节点的表达式返回此节点下的孩子节点列表
- '''</summary>
- '''<param name="xPath"></param>
- '''<returns></returns>
- Public Function GetNodeList(ByVal xPath As String) As XmlNodeList
- Dim nodeList As XmlNodeList = Me.SelectSingleNode(xPath).ChildNodes
- Return nodeList
- End Function
- End Class
DownloadFileInfo.vb
- Public Class DownloadFileInfo
- Private m_fileName As String = ""
- Private m_lastver As String = ""
- Public Property FileName() As String
- Get
- Return m_fileName
- End Get
- Set(ByVal value As String)
- m_fileName = value
- End Set
- End Property
- Public Property LastVer() As String
- Get
- Return m_lastver
- End Get
- Set(ByVal value As String)
- m_lastver = value
- End Set
- End Property
- Public Sub New(ByVal fname As String,ByVal fver As String)
- Me.m_fileName = fname
- Me.m_lastver = fver
- End Sub
- End Class