설명 없음
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HX-PGS-UPDATE.vb 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. Imports System.IO
  2. Imports System.Net
  3. Imports System.Net.NetworkInformation
  4. Public Class HX_PGS_UPDATE
  5. ReadOnly ds2 As New DataSet
  6. ReadOnly computerProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
  7. ReadOnly IPEndPoint() As EndPoint = computerProperties.GetActiveTcpListeners()
  8. Dim myIPEndPoint As IPEndPoint
  9. Dim 內網線路 As Boolean : ReadOnly 開發線路 As Boolean
  10. Private Sub Set_清單1()
  11. ftp清單_dgv.DataSource = Nothing : ds2.Clear()
  12. ftp清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  13. ftp清單_dgv.ColumnHeadersHeight = 25
  14. ftp清單_dgv.AllowUserToAddRows = False
  15. SQL_FTP資料夾路徑分配()
  16. da.Fill(ds2) : ftp清單_dgv.DataSource = ds2.Tables(0) : conn.Close()
  17. End Sub
  18. Private Sub IP比對()
  19. '-----------------------IP比對----------------------------------------------------------------------------------------------------------------------------------------------------
  20. 伺服器區域_cb.Text = "公司雲端"
  21. End Sub
  22. Private Sub HX_PGS_UPDATE_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  23. IP比對() : 資料數 = 100
  24. MyModule1.進度條() : If Strings.Left(伺服器區域_cb.Text, 2) = "公司" Then : SQL_連線字串_正式() : Else : SQL_連線字串_測試() : End If
  25. MyModule1.進度條() : SQL_FTP伺服器登入位置()
  26. MyModule1.進度條() : If dr.Read() Then : Target = dr("FTP地址") : FTP帳號 = dr("FTP帳號") : FTP密碼 = dr("FTP密碼") : FTP物理位置 = dr("FTP物理位置") : End If : conn.Close()
  27. MyModule1.進度條() : Set_清單1()
  28. MyModule1.進度條() : Dim HH As String = ""
  29. For i As Integer = 0 To ftp清單_dgv.Rows.Count - 1
  30. If i < 10 Then : HH = "0" & i : ElseIf i >= 10 Then : HH = i : End If
  31. If ftp清單_dgv("指定", i).Value.ToString = "AA" & HH Then : AA(i) = ftp清單_dgv("資料夾名稱", i).Value.ToString : End If
  32. Next
  33. MyModule1.進度條() : Target1 = Target & AA(0) & "/"
  34. End Sub
  35. Private Sub HX_PGS_UPDATE_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  36. MyModule1.進度條() : Delay(30000)
  37. MyModule1.進度條() : Dim Str As String = Application.StartupPath
  38. '--- 刪除在下載---------------------------------------------------------------------------------------------------------------------------
  39. MyModule1.進度條() : If File.Exists(Str + "\HX-PGS-ERP-SYS.exe") Then : File.Delete(Str + "\HX-PGS-ERP-SYS.exe") : End If
  40. MyModule1.進度條() : If File.Exists(Str + "\HX01.docx") Then : File.Delete(Str + "\HX01.docx") : End If
  41. MyModule1.進度條() : If File.Exists(Str + "\PGS01.docx") Then : File.Delete(Str + "\PGS01.docx") : End If
  42. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "HX-PGS-ERP-SYS.exe", Str + "\HX-PGS-ERP-SYS.exe")
  43. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "HX01.docx", Str + "\HX01.docx")
  44. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "PGS01.docx", Str + "\PGS01.docx")
  45. '--- 比對下載---------------------------------------------------------------------------------------------------------------------------
  46. MyModule1.進度條() : If File.Exists(Str + "\HX-PGS-Message.exe") Then : Else
  47. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "HX-PGS-Message.exe", Str + "\HX-PGS-Message.exe") : End If
  48. MyModule1.進度條() : If File.Exists(Str + "\Tran.exe") Then : Else
  49. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Tran.exe", Str + "\Tran.exe") : End If
  50. MyModule1.進度條() : If File.Exists(Str + "\HX-PGS-ERP-SYS.pdb") Then : Else
  51. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "HX-PGS-ERP-SYS.pdb", Str + "\HX-PGS-ERP-SYS.pdb") : End If
  52. MyModule1.進度條() : If File.Exists(Str + "\HX-PGS-ERP-SYS.xml") Then : Else
  53. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "HX-PGS-ERP-SYS.xml", Str + "\HX-PGS-ERP-SYS.xml") : End If
  54. MyModule1.進度條() : If File.Exists(Str + "\Interop.SHDocVw.dll") Then : Else
  55. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Interop.SHDocVw.dll", Str + "\Interop.SHDocVw.dll") : End If
  56. MyModule1.進度條() : If File.Exists(Str + "\AxInterop.MSHTML.dll") Then : Else
  57. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "AxInterop.MSHTML.dll", Str + "\AxInterop.MSHTML.dll") : End If
  58. MyModule1.進度條() : If File.Exists(Str + "\AxInterop.SHDocVw.dll") Then : Else
  59. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "AxInterop.SHDocVw.dll", Str + "\AxInterop.SHDocVw.dll") : End If
  60. MyModule1.進度條() : If File.Exists(Str + "\HX-PGS-ERP-SYS.exe.config") Then : Else
  61. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "HX-PGS-ERP-SYS.exe.config", Str + "\HX-PGS-ERP-SYS.exe.config") : End If
  62. MyModule1.進度條() : If File.Exists(Str + "\A.txt") Then : Else
  63. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "A.txt", Str + "\A.txt") : End If
  64. MyModule1.進度條() : If File.Exists(Str + "\C.txt") Then : Else
  65. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "C.txt", Str + "\C.txt") : End If
  66. MyModule1.進度條() : If File.Exists(Str + "\ch.txt") Then : Else
  67. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "ch.txt", Str + "\ch.txt") : End If
  68. MyModule1.進度條() : If File.Exists(Str + "\DotNetBarcode.dll") Then : Else
  69. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "DotNetBarcode.dll", Str + "\DotNetBarcode.dll") : End If
  70. MyModule1.進度條() : If File.Exists(Str + "\en.txt") Then : Else
  71. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "en.txt", Str + "\en.txt") : End If
  72. MyModule1.進度條() : If File.Exists(Str + "\IdentityModel.dll") Then : Else
  73. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "IdentityModel.dll", Str + "\IdentityModel.dll") : End If
  74. MyModule1.進度條() : If File.Exists(Str + "\IdentityModel.pdb") Then : Else
  75. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "IdentityModel.pdb", Str + "\IdentityModel.pdb") : End If
  76. MyModule1.進度條() : If File.Exists(Str + "\IdentityModel.xml") Then : Else
  77. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "IdentityModel.xml", Str + "\IdentityModel.xml") : End If
  78. MyModule1.進度條() : If File.Exists(Str + "\in.txt") Then : Else
  79. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "in.txt", Str + "\in.txt") : End If
  80. MyModule1.進度條() : If File.Exists(Str + "\Newtonsoft.Json.dll") Then : Else
  81. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Newtonsoft.Json.dll", Str + "\Newtonsoft.Json.dll") : End If
  82. MyModule1.進度條() : If File.Exists(Str + "\Newtonsoft.Json.xml") Then : Else
  83. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Newtonsoft.Json.xml", Str + "\Newtonsoft.Json.xml") : End If
  84. MyModule1.進度條() : If File.Exists(Str + "\PInvoke.Windows.Core.dll") Then : Else
  85. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "PInvoke.Windows.Core.dll", Str + "\PInvoke.Windows.Core.dll") : End If
  86. MyModule1.進度條() : If File.Exists(Str + "\PInvoke.Windows.Core.xml") Then : Else
  87. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "PInvoke.Windows.Core.xml", Str + "\PInvoke.Windows.Core.xml") : End If
  88. MyModule1.進度條() : If File.Exists(Str + "\py-tran-log.txt") Then : Else
  89. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "py-tran-log.txt", Str + "\py-tran-log.txt") : End If
  90. MyModule1.進度條() : If File.Exists(Str + "\System.Buffers.dll") Then : Else
  91. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Buffers.dll", Str + "\System.Buffers.dll") : End If
  92. MyModule1.進度條() : If File.Exists(Str + "\System.Buffers.xml") Then : Else
  93. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Buffers.xml", Str + "\System.Buffers.xml") : End If
  94. MyModule1.進度條() : If File.Exists(Str + "\System.Memory.dll") Then : Else
  95. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Memory.dll", Str + "\System.Memory.dll") : End If
  96. MyModule1.進度條() : If File.Exists(Str + "\System.Memory.xml") Then : Else
  97. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Memory.xml", Str + "\System.Memory.xml") : End If
  98. MyModule1.進度條() : If File.Exists(Str + "\System.Numerics.Vectors.dll") Then : Else
  99. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Numerics.Vectors.dll", Str + "\System.Numerics.Vectors.dll") : End If
  100. MyModule1.進度條() : If File.Exists(Str + "\System.Numerics.Vectors.xml") Then : Else
  101. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Numerics.Vectors.xml", Str + "\System.Numerics.Vectors.xml") : End If
  102. MyModule1.進度條() : If File.Exists(Str + "\System.Runtime.CompilerServices.Unsafe.dll") Then : Else
  103. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Runtime.CompilerServices.Unsafe.dll", Str + "\System.Runtime.CompilerServices.Unsafe.dll") : End If
  104. MyModule1.進度條() : If File.Exists(Str + "\System.Runtime.CompilerServices.Unsafe.xml") Then : Else
  105. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Runtime.CompilerServices.Unsafe.xml", Str + "\System.Runtime.CompilerServices.Unsafe.xml") : End If
  106. MyModule1.進度條() : If File.Exists(Str + "\System.Text.Encodings.Web.dll") Then : Else
  107. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Text.Encodings.Web.dll", Str + "\System.Text.Encodings.Web.dll") : End If
  108. MyModule1.進度條() : If File.Exists(Str + "\System.Text.Encodings.Web.xml") Then : Else
  109. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "System.Text.Encodings.Web.xml", Str + "\System.Text.Encodings.Web.xml") : End If
  110. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.RadToastNotification.dll") Then : Else
  111. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.RadToastNotification.dll", Str + "\Telerik.WinControls.RadToastNotification.dll") : End If
  112. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.RadToastNotification.xml") Then : Else
  113. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.RadToastNotification.xml", Str + "\Telerik.WinControls.RadToastNotification.xml") : End If
  114. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.SyntaxEditor.dll") Then : Else
  115. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.SyntaxEditor.dll", Str + "\Telerik.WinControls.SyntaxEditor.dll") : End If
  116. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.SyntaxEditor.xml") Then : Else
  117. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.SyntaxEditor.xml", Str + "\Telerik.WinControls.SyntaxEditor.xml") : End If
  118. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.RadWebCam.dll") Then : Else
  119. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.RadWebCam.dll", Str + "\Telerik.WinControls.RadWebCam.dll") : End If
  120. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.RadWebCam.xml") Then : Else
  121. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.RadWebCam.xml", Str + "\Telerik.WinControls.RadWebCam.xml") : End If
  122. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.GridView.dll") Then : Else
  123. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.GridView.dll", Str + "\Telerik.WinControls.GridView.dll") : End If
  124. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.RadMap.dll") Then : Else
  125. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.RadMap.dll", Str + "\Telerik.WinControls.RadMap.dll") : End If
  126. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.RadMap.xml") Then : Else
  127. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.RadMap.xml", Str + "\Telerik.WinControls.RadMap.xml") : End If
  128. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.GridView.xml") Then : Else
  129. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.GridView.xml", Str + "\Telerik.WinControls.GridView.xml") : End If
  130. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.ChartView.dll") Then : Else
  131. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.ChartView.dll", Str + "\Telerik.WinControls.ChartView.dll") : End If
  132. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.ChartView.xml") Then : Else
  133. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.ChartView.xml", Str + "\Telerik.WinControls.ChartView.xml") : End If
  134. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.UI.dll") Then : Else
  135. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.UI.dll", Str + "\Telerik.WinControls.UI.dll") : End If
  136. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.UI.xml") Then : Else
  137. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.UI.xml", Str + "\Telerik.WinControls.UI.xml") : End If
  138. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.dll") Then : Else
  139. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.dll", Str + "\Telerik.WinControls.dll") : End If
  140. MyModule1.進度條() : If File.Exists(Str + "\Telerik.WinControls.xml") Then : Else
  141. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.WinControls.xml", Str + "\Telerik.WinControls.xml") : End If
  142. MyModule1.進度條() : If File.Exists(Str + "\TelerikCommon.dll") Then : Else
  143. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "TelerikCommon.dll", Str + "\TelerikCommon.dll") : End If
  144. MyModule1.進度條() : If File.Exists(Str + "\MediaFoundation.dll") Then : Else
  145. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "MediaFoundation.dll", Str + "\MediaFoundation.dll") : End If
  146. MyModule1.進度條() : If File.Exists(Str + "\Telerik.Windows.MediaFoundation.dll") Then : Else
  147. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Telerik.Windows.MediaFoundation.dll", Str + "\Telerik.Windows.MediaFoundation.dll") : End If
  148. MyModule1.進度條() : If File.Exists(Str + "\Microsoft.Toolkit.Uwp.Notifications.dll") Then : Else
  149. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "Microsoft.Toolkit.Uwp.Notifications.dll", Str + "\Microsoft.Toolkit.Uwp.Notifications.dll") : End If
  150. '--- 開啟專案---------------------------------------------------------------------------------------------------------------------------
  151. MyModule1.進度條() : Shell(Str + "\HX-PGS-ERP-SYS.exe", vbNormalFocus)
  152. Me.Close()
  153. End Sub
  154. Private Sub 伺服器區域_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 伺服器區域_cb.SelectedIndexChanged
  155. '-----------------------確認登入伺服器位置-----------------------------------------------------------------------------------------------------------------------------------------
  156. If 伺服器區域_cb.Text = "公司雲端" Then
  157. 登入人IP = "103.231.201.230,2433"
  158. ElseIf 伺服器區域_cb.Text = "測試雲端" Then
  159. 登入人IP = "106.1.48.106,4567"
  160. ElseIf 伺服器區域_cb.Text = "印尼測試" Then
  161. 登入人IP = "103.231.201.230,2433"
  162. End If
  163. End Sub
  164. Public Sub Delay(ByRef Interval As Double) 'Interval单位为毫秒
  165. Dim time As DateTime = DateTime.Now
  166. Dim Span As Double = Interval * 1234
  167. While ((DateTime.Now.Ticks - time.Ticks) < Span)
  168. Application.DoEvents()
  169. End While
  170. End Sub
  171. End Class