Follow along with the video below to see how to install our site as a web app on your home screen.
Nota: This feature may not be available in some browsers.
Ciao, evidentemente mi sono espresso male, non l'ho creato io; ho preso una source e l'ho personalizzata a modo mio..Se lo hai 'creato' saprai anche fixarlo... scrivere un binary file nel file system direi che è l'abc, se hai creato un patcher allora sicuramente saprai risolvere.
Imports System.Net
Imports System
Imports System.IO
Public Class Form1
Dim link As String = "http://sito.altervista.org/"
Dim sLine3 As String = ""
Dim sLine2 As String = ""
Dim arrText As New ArrayList()
Dim arrText2 As New ArrayList()
Private WithEvents downl As System.Net.WebClient
Private Sub Form1_load(ByVal sender As System.Object, ByVal e As System.EventArgs)
If My.Computer.FileSystem.FileExists("log.txt") Then
BackgroundWorker1.RunWorkerAsync()
Else
Using sw As StreamWriter = File.CreateText("log.txt")
sw.WriteLine("Inizio log.txt")
sw.Close()
End Using
BackgroundWorker1.RunWorkerAsync()
End If
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
End Sub
#Region "Bottoni"
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Using sw As StreamWriter = File.CreateText("avvio.bat")
sw.WriteLine("start metin2client.bin")
sw.Close()
End Using
If My.Computer.FileSystem.FileExists("avvio.bat") Then
Shell("avvio.bat")
End If
Me.Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If My.Computer.FileSystem.FileExists("config.exe") Then
Shell("./config.exe")
Else
MsgBox("Non posso trovare il config , si prega di riscaricare.")
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim p As New Process
p.StartInfo.FileName = "Starter.exe"
p.StartInfo.Arguments = "http://Sito/"
p.Start()
End Sub
#End Region
#Region "Md5 checker"
Public Function MD5CalcFile(ByVal filepath As String) As String
' If FileIniziale.Text = "" Then
'MsgBox("devi scegliere un file!")
' Else
filepath = "./pack/" & sLine3
' apre il file in sola lettura
Using reader As New System.IO.FileStream(filepath, IO.FileMode.Open, IO.FileAccess.Read)
Using md5 As New System.Security.Cryptography.MD5CryptoServiceProvider
' hash contenuto in questo file
Dim hash() As Byte = md5.ComputeHash(reader)
' ritorno formattato in hex dell'hash
Return ByteArrayToString(hash)
End Using
End Using
End Function
' funzione per convertire un array di byte in una stringa esadecimale
Private Function ByteArrayToString(ByVal arrInput() As Byte) As String
Dim StringBuilder As New System.Text.StringBuilder(arrInput.Length * 2)
For i As Integer = 0 To arrInput.Length - 1
StringBuilder.Append(arrInput(i).ToString("X2"))
Next
Return StringBuilder.ToString().ToLower
End Function
#End Region
#Region "Initiate Download"
Private Sub InitiateDownload(ByVal remoteUrl As String, ByVal localFilePath As String)
'* qui
Me.ProgressBar1.Value = 0
If Me.downl Is Nothing Then
Me.downl = New Net.WebClient
End If
End Sub
Private Sub downl_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles downl.DownloadProgressChanged
'blablabla... setta la progressbar
Me.ProgressBar1.Maximum = CInt(e.TotalBytesToReceive)
Me.ProgressBar1.Value = CInt(e.BytesReceived)
End Sub
Private Sub downl_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles downl.DownloadFileCompleted
'a download finito modifica il file di log
'..............................................................................
'data e ora per i log
Dim dt As DateTime
dt = DateTime.Now
' data e ora:
Dim dataOra As String = dt.ToString
' solo data in formato GG/MM/AAAA:
Dim data As String = dt.ToString("dd/MM/yyyy")
' solo ora in formato HH.MM.SS (ore da 0 a 23):
Dim ora As String = dt.ToString("T")
' stampa i tre valori:
Dim s As String = dataOra
'..............................................................................
Dim SW As StreamWriter
Dim b As String
b = My.Computer.FileSystem.ReadAllText("./log.txt")
SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
SW.Write(b & vbCrLf & s & vbCrLf & "il file" & sLine3 & " è ora ok!")
SW.Flush()
SW.Close()
End Sub
#End Region
#Region "Muovere il form"
Dim NewPoint As New System.Drawing.Point
Dim X, Y As Integer
Private Sub Form1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
X = Control.MousePosition.X - Me.Location.X
Y = Control.MousePosition.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
NewPoint = Control.MousePosition
NewPoint.X -= (X)
NewPoint.Y -= (Y)
Me.Location = NewPoint
End If
End Sub
#End Region
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub Label5_Click(sender As Object, e As EventArgs) Handles Label5.Click
End Sub
Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
If My.Computer.FileSystem.FileExists("log.txt") Then
Else
Using sw As StreamWriter = File.CreateText("log.txt")
sw.WriteLine("Inizio log.txt")
sw.Close()
End Using
End If
'..............................................................................
'data e ora per i log
Dim dt As DateTime
dt = DateTime.Now
' data e ora:
Dim dataOra As String = dt.ToString
' solo data in formato GG/MM/AAAA:
Dim data As String = dt.ToString("dd/MM/yyyy")
' solo ora in formato HH.MM.SS (ore da 0 a 23):
Dim ora As String = dt.ToString("T")
' stampa i tre valori:
Dim s As String = dataOra
'..............................................................................
Dim arrText As New ArrayList()
Dim st1 As System.IO.Stream
Dim sr1 As System.IO.StreamReader
Dim req1 As System.Net.WebRequest =
System.Net.WebRequest.Create(link & "test.txt")
Dim resp1 As System.Net.WebResponse =
req1.GetResponse
st1 = resp1.GetResponseStream
sr1 = New System.IO.StreamReader(st1)
Dim st2 As System.IO.Stream
Dim sr2 As System.IO.StreamReader
Dim req2 As System.Net.WebRequest =
System.Net.WebRequest.Create(link & "md5.txt")
Dim resp2 As System.Net.WebResponse =
req2.GetResponse
st2 = resp2.GetResponseStream
sr2 = New System.IO.StreamReader(st2)
'...............................................
Do
sLine2 = sr2.ReadLine()
sLine3 = sr1.ReadLine()
Dim SW As StreamWriter
Dim b As String
Label4.Text = "Connessione al server..."
If Not sLine3 Is Nothing Then
ListBox1.Items.Add(sLine3)
ListBox2.Items.Add(sLine2)
If My.Computer.FileSystem.FileExists("./pack/" & sLine3) Then
Else
Using sw1 As StreamWriter = File.CreateText("./pack/" & sLine3)
sw1.WriteLine("This is my file.")
sw1.Close()
End Using
InitiateDownload(link & sLine3, "./pack/" & sLine3)
b = My.Computer.FileSystem.ReadAllText("./log.txt")
SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
SW.Write(b & vbCrLf & s & vbCrLf & "il file" & sLine3 & " non è presente, sta venendo scaricato!")
SW.Flush()
SW.Close()
End If
ListBox3.Items.Add(sLine2)
Label4.Text = "Testando: " & sLine3 & " ..."
If MD5CalcFile(sLine3) = sLine2 Then
Label4.Text = "Il file " & sLine3 & "è ok"
b = My.Computer.FileSystem.ReadAllText("./log.txt")
SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
SW.Write(b & vbCrLf & s & vbCrLf & sLine3 & " è ok")
SW.Flush()
SW.Close()
Else
Label4.Text = "Il file " & sLine3 & "non è ok"
b = My.Computer.FileSystem.ReadAllText("./log.txt")
SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
SW.Write(b & vbCrLf & s & vbCrLf & sLine3 & " non è ok")
InitiateDownload(link & sLine3, "./pack/" & sLine3)
SW.Flush()
SW.Close()
b = My.Computer.FileSystem.ReadAllText("./log.txt")
SW = New StreamWriter("./log.txt", False, System.Text.UTF8Encoding.Default)
Label4.Text = "Il file " & sLine3 & " non è ok, sta venendo riscaricato!"
SW.Write(b & vbCrLf & s & vbCrLf & "il file" & sLine3 & " non è ok, sta venendo riscaricato!")
SW.Flush()
SW.Close()
End If
End If
Loop Until sLine3 Is Nothing
Label4.Text = "Buon divertimento!"
End Sub
End Class