diff --git a/Src/SmartEduDownloader/AboutForm.vb b/Src/SmartEduDownloader/AboutForm.vb index 4cf4546..441a01e 100644 --- a/Src/SmartEduDownloader/AboutForm.vb +++ b/Src/SmartEduDownloader/AboutForm.vb @@ -11,7 +11,7 @@ Else sa = "x86" End If - Label3.Text = "版本 " & My.Application.Info.Version.ToString & " (" & MainForm.AppBuildTime & ") " & MainForm.MyArch + Label3.Text = "版本 " & My.Application.Info.Version.ToString & " (" & MainForm.AppBuildTime & ") " & MainForm.MyArch & " " & MainForm.AppBuildChannel Label6.Text = "系统信息 " & My.Computer.Info.OSFullName & " " & sa & " " & GetOSVersion() End Sub diff --git a/Src/SmartEduDownloader/MDownForm.vb b/Src/SmartEduDownloader/MDownForm.vb index c153446..b5fed67 100644 --- a/Src/SmartEduDownloader/MDownForm.vb +++ b/Src/SmartEduDownloader/MDownForm.vb @@ -6,7 +6,7 @@ Public Class MDownForm Public DownloadClient As New WebClientPro Dim DownLinks() As String Dim dline As Integer - Dim lgtmp As String + 'Dim lgtmp As String Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox2.Text = "" End Sub @@ -23,7 +23,7 @@ Public Class MDownForm CheckBox1.Checked = True DownloadClient.Timeout = 30000 'AddHandler DownloadClient.DownloadProgressChanged, AddressOf DownloadClient_DownloadProgressChanged - 'AddHandler DownloadClient.DownloadFileCompleted, AddressOf DownloadClient_DownloadFileCompleted + AddHandler DownloadClient.DownloadFileCompleted, AddressOf DownloadClient_DownloadFileCompleted FolderBrowserDialog1.SelectedPath = Application.StartupPath & "\BookDownloads" Label3.Text = "当前下载目录:" & FolderBrowserDialog1.SelectedPath End Sub @@ -56,7 +56,11 @@ Public Class MDownForm If InStr(DownLinks(i), "basic.smartedu.cn") > 0 Then Call smartedudown(DownLinks(i)) End If Next - TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "**************下载完成**************" & vbCrLf & TextBox2.Text + If mld = 1 Then + TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "**************全部开始下载**************" & vbCrLf & TextBox2.Text + Else + TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "**************下载完成**************" & vbCrLf & TextBox2.Text + End If TextBox1.Enabled = True Button1.Enabled = True Button2.Enabled = True @@ -94,7 +98,7 @@ Public Class MDownForm Dim DownBookLinkPri As String = CStr((BookItemsObject(1)("ti_storages"))(0)) Dim DownBookLink As String = Replace(DownBookLinkPri, "ndr-private.ykt.cbern.com.cn", "ndr.ykt.cbern.com.cn") - lgtmp = TextBox2.Text + 'lgtmp = TextBox2.Text Dim BookNameObject As JObject = BookInfoObject("global_title") Dim DownBookName As String = CStr(BookNameObject("zh-CN")) @@ -119,7 +123,10 @@ Public Class MDownForm 'DownloadClient.DownloadFileAsync(New Uri(DownBookLink), (fn)) If mld = 1 Then - DownloadClient.DownloadFileAsync(New Uri(DownBookLink), fn) + Dim DownloadClient1 As New WebClientPro + DownloadClient1.Timeout = 30000 + AddHandler DownloadClient1.DownloadFileCompleted, AddressOf DownloadClient_DownloadFileCompleted + DownloadClient1.DownloadFileAsync(New Uri(DownBookLink), fn) Else DownloadClient.DownloadFile(New Uri(DownBookLink), fn) End If @@ -132,18 +139,18 @@ Public Class MDownForm ' TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "正在下载第" & dline & "个 " & e.ProgressPercentage & "% 已经下载 " & Int(e.BytesReceived / 1024 / 1024).ToString & " MB,共 " & Int(e.TotalBytesToReceive / 1024 / 1024).ToString & " MB" & vbCrLf & TextBox2.Text 'End Sub - 'Private Sub DownloadClient_DownloadFileCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) - ' If e.Error IsNot Nothing Then - ' TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "第" & dline & "个" & e.Error.Message & vbCrLf & TextBox2.Text - ' lgtmp = "" - ' ElseIf e.Cancelled = True Then - ' TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "第" & dline & "个下载已被取消" & vbCrLf & TextBox2.Text - ' lgtmp = "" - ' Else - ' TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "第" & dline & "个下载完成!" & vbCrLf & TextBox2.Text - ' lgtmp = "" - ' End If - 'End Sub + Private Sub DownloadClient_DownloadFileCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) + If e.Error IsNot Nothing Then + TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "第" & dline & "个" & e.Error.Message & vbCrLf & TextBox2.Text + 'lgtmp = "" + ElseIf e.Cancelled = True Then + TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "第" & dline & "个下载已被取消" & vbCrLf & TextBox2.Text + 'lgtmp = "" + Else + TextBox2.Text = Format(Now, "[yyyy-MM-dd HH:mm:ss] ") & "第" & dline & "个下载完成!" & vbCrLf & TextBox2.Text + 'lgtmp = "" + End If + End Sub Private Sub DownFormvb_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyClass.FormClosing If st = 1 Then diff --git a/Src/SmartEduDownloader/MainForm.Designer.vb b/Src/SmartEduDownloader/MainForm.Designer.vb index 5512e4b..d79f5d6 100644 --- a/Src/SmartEduDownloader/MainForm.Designer.vb +++ b/Src/SmartEduDownloader/MainForm.Designer.vb @@ -256,6 +256,7 @@ Partial Class MainForm Me.Controls.Add(Me.MenuStrip1) Me.Font = New System.Drawing.Font("微软雅黑", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) Me.ForeColor = System.Drawing.Color.Black + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MainMenuStrip = Me.MenuStrip1 Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) diff --git a/Src/SmartEduDownloader/MainForm.vb b/Src/SmartEduDownloader/MainForm.vb index 6ed60a2..064a320 100644 --- a/Src/SmartEduDownloader/MainForm.vb +++ b/Src/SmartEduDownloader/MainForm.vb @@ -12,6 +12,7 @@ Public Class MainForm Public MyArch As String Public Const AppBuildTime As String = "20240824" + Public Const AppBuildChannel As String = "O" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Environment.Is64BitProcess = True Then @@ -19,7 +20,7 @@ Public Class MainForm Else MyArch = "x86" End If - Me.Text = "SmartEduDownloader " & My.Application.Info.Version.ToString & " (" & MainForm.AppBuildTime & ") " & MyArch + Me.Text = "SmartEduDownloader " & My.Application.Info.Version.ToString & " (" & MainForm.AppBuildTime & ") " & MyArch & " " & AppBuildChannel DownloadClient.Timeout = 30000 DownBookLink = "" DownBookName = ""