デバッグ中にイミディエイト ウィンドウにこれが表示されます。
わかりましたので、バージョンが正しいかどうかを確認するバージョンチェッカーを作成しました。そうでない場合は更新します。機能していません。バージョンは同じであると考えられ、更新されません。それは早い段階で機能していましたが、今ではランダムに壊れています..
Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
'*update process
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://localhost/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 = My.Settings.version
If newestversion.Contains(currentversion) Then
Label3.Text = "Up to date."
MsgBox("debug")
Button1.Enabled = True
Else
MsgBox("An new update is available! Please, do NOT close the launcher!", MsgBoxStyle.Information)
Label3.Text = "Updating game..."
Label3.Refresh()
GhostProgressbar1.Value = 10
'starts(download)
GhostProgressbar1.Value = +65
My.Computer.Network.DownloadFile("http://localhost/update/patch.zip", New System.IO.FileInfo(Application.ExecutablePath).DirectoryName + "/patch.zip")
GhostProgressbar1.Value = +15
'unzips update
Dim ZipToUnpack As String = "patch.zip"
Dim TargetDir As String = New System.IO.FileInfo(Application.ExecutablePath).DirectoryName
Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
Dim e1 As ZipEntry
For Each e1 In zip1
e1.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
Next
End Using
'delete(zip)
GhostProgressbar1.Value = +9
My.Computer.FileSystem.DeleteFile(New System.IO.FileInfo(Application.ExecutablePath).DirectoryName + "/patch.zip")
GhostProgressbar1.Value = 100
My.Settings.version = newestversion
My.Settings.Save()
MsgBox("The game has been updated successfully!")
End If
Label3.Text = "Up to date."
Label3.Refresh()
Button1.Enabled = True
End Sub