我怎么能得到另一个文件版本? [英] How I can get another file version?
问题描述
Public Sub CheckForUpdates()
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://192.168.0.254/Vandella/Update/Version.txt")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim newestversion As String = sr.ReadToEnd()
Dim currentversion As String = System.Diagnostics.FileVersionInfo.GetVersionInfo(Application.StartupPath & "\test.exe")
If newestversion.Contains(currentversion) Then
MsgBox("You are using the latest version!")
Me.Hide()
Dim MainForm As New AngelZoneDB.AngelZoneDB
MainForm.Show()
Else
MsgBox("There is a new version on the website, Press 'Ok' to download", MsgBoxStyle.OkOnly, "Update Found!")
UpdateContinue()
End If
错误出现,当我调试
System.Diagnostics.FileVersionInfo不能转换为字符串
我想要这样的东西?抱歉我的英语,我不知道如何解决
我尝试过:
如果我将此代码放入
currentversion As String = Application.ProductVersion
但我想从我的exe文件中获取ProductVersion
Error comes up, when i debug
System.Diagnostics.FileVersionInfo cannot be converted to string
I want something like that? Sorry about my english, i dont know how to fix
What I have tried:
It's working if i put this code in
currentversion As String = Application.ProductVersion
but i want to get the ProductVersion from my exe file
推荐答案
首先,您需要停止以字符串形式查看所有数据。此外,您需要至少阅读原始MSDN文档的基本技能,这非常清楚。
它可以是
First of all, you need to stop viewing all data as strings. Also, you need elementary skills of reading at least original MSDN documentation, which is extremely clear.
It can be
System.Diagnostics.FileVersionInfo info = System.Diagnostics.FileVersionInfo.GetVersionInfo(fileName);
请参阅:
FileVersionInfo.GetVersionInfo Method(String)(System.Diagnostics) [ ^ ],
FileVersionInfo类(System.Diagnostics) [ ^ ]。
至于得到一个其他文件版本,没有任何预定义或标准化的方法。有些文件系统有嵌入式文件版本控制系统,但几乎没有任何系统。 Web标准中没有类似的东西。如果某个特定网站或应用程序提供不同版本的某些内容,则完全取决于这些应用程序。你必须学习这种应用程序提供的特定界面,或者学习如何通过网络抓取来实现。
这篇关于我怎么能得到另一个文件版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!