Form3.vb 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. Imports System
  2. Imports System.IO
  3. Public Class Form3
  4. Dim appPath As String = Application.StartupPath()
  5. Private IsFormBeingDragged As Boolean = False
  6. Private MouseDownX As Integer
  7. Private MouseDownY As Integer
  8. Dim z As String
  9. Private Sub Form3_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  10. For counter = 10 To 90 Step +20
  11. Me.Opacity = counter / 100
  12. Me.Refresh()
  13. Threading.Thread.Sleep(50)
  14. Next
  15. Me.Opacity = 100
  16. For Each Dir As String In Directory.GetDirectories(appPath & "\system\minecraft")
  17. Dim filePath As String = Dir
  18. Dim split As String() = filePath.Split("\")
  19. Dim parentFolder As String = split(split.Length - 1)
  20. ListBox1.Items.Add(parentFolder)
  21. Dim countfolder As Integer
  22. Dim dire() As String = System.IO.Directory.GetDirectories(appPath & "\system\minecraft\")
  23. countfolder = dire.Length
  24. If countfolder = 1 Then
  25. If My.Computer.FileSystem.FileExists(appPath & "\system\" & parentFolder & ".bat") Then
  26. Shell(appPath & "\system\" & parentFolder & ".bat", vbHide)
  27. Threading.Thread.Sleep(3000)
  28. Dim iCount As Integer
  29. For iCount = 90 To 10 Step -10
  30. Me.Opacity = iCount / 100
  31. Threading.Thread.Sleep(50)
  32. Next
  33. Me.Close()
  34. ElseIf My.Computer.FileSystem.FileExists(appPath & "\system\" & parentFolder & ".bat") = False Then
  35. Label1.Text = "請先為 " & parentFolder & "版本設置玩家名稱"
  36. Else
  37. Label1.Text = "請到遊戲設置設定玩家名稱"
  38. End If
  39. ElseIf countfolder = 0 Then
  40. Label1.Text = "請使用自動更新功能下載客戶端文件"
  41. Else
  42. Label1.Text = "請選擇要啟動的版本"
  43. End If
  44. Next
  45. End Sub
  46. Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown
  47. If e.Button = MouseButtons.Left Then
  48. IsFormBeingDragged = True
  49. MouseDownX = e.X
  50. MouseDownY = e.Y
  51. End If
  52. End Sub
  53. Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp
  54. If e.Button = MouseButtons.Left Then
  55. IsFormBeingDragged = False
  56. End If
  57. End Sub
  58. Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove
  59. If IsFormBeingDragged Then
  60. Dim temp As Point = New Point()
  61. temp.X = Me.Location.X + (e.X - MouseDownX)
  62. temp.Y = Me.Location.Y + (e.Y - MouseDownY)
  63. Me.Location = temp
  64. temp = Nothing
  65. End If
  66. End Sub
  67. Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
  68. End Sub
  69. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  70. Dim iCount As Integer
  71. For iCount = 90 To 10 Step -10
  72. Me.Opacity = iCount / 100
  73. Threading.Thread.Sleep(50)
  74. Next
  75. Me.Close()
  76. End Sub
  77. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  78. If My.Computer.FileSystem.FileExists(appPath & "\system\" & ListBox1.SelectedItem & ".bat") = False Then
  79. Label1.Text = "請先為 " & ListBox1.SelectedItem & "版本設置玩家名稱"
  80. Else
  81. Try
  82. Shell(appPath & "\system\" & ListBox1.SelectedItem & ".bat", vbHide)
  83. Dim iCount As Integer
  84. For iCount = 90 To 10 Step -10
  85. Me.Opacity = iCount / 100
  86. Threading.Thread.Sleep(50)
  87. Next
  88. Me.Close()
  89. Catch ex As Exception
  90. Label3.Text = ex.Message & "請選擇版本或下載更新。"
  91. End Try
  92. End If
  93. End Sub
  94. End Class