Skip to content

Commit 3018525

Browse files
author
박동준
committed
fixed error occurrence issue
1 parent d0e2602 commit 3018525

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

NVidExtractor/Controls/ItemPanel.vb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Public Class ItemPanel
1313
Public Selected As Boolean = False
1414
Public DownBegan As Boolean = False '다운로드를 한번이라도 시작을 했는지
1515
Public DownFinished As Boolean = False '다운로드를 완료한 상태인지
16+
Public progMode As String = "" '현재 프로그램의 모드 (downloading, pause, finished, error)
1617
Dim captionDownFinished As Boolean = False '자막 다운로드를 완료한 상태인지
17-
Dim progMode As String = ""
1818

1919
Dim prevCBSelect() As Integer = {-1, -1} '비디오 info 리셋할때 콤보박스 선택을 보존하기 위해서
2020

@@ -168,6 +168,7 @@ Public Class ItemPanel
168168
ProgPanelOver.BackColor = MainPanel.BackColor
169169
ProgLabel1.Text = ""
170170
ProgLabel2.Text = ""
171+
PauseResumeBT.Visible = False
171172
End If
172173
End Sub
173174

@@ -320,14 +321,21 @@ Public Class ItemPanel
320321
#Region "다운로드 작업"
321322

322323
Private Sub DownloadProgressChanged(ByVal sender As Object, ByVal e As FileDownloadProgressChangedEventArgs) Handles WC.DownloadProgressChanged
323-
progMode = "downloading"
324-
SetProgBar(e.ProgressPercentage.ToString _
325-
+ "% (" + FormatBytes(e.DownloadSpeedBytesPerSec) + "/s, " _
326-
+ FormatBytes(e.BytesReceived) + "/" + FormatBytes(e.TotalBytesToReceive) _
327-
+ ", " + DaysCalc(e.RemainingTimeSeconds) + " 남음)")
328-
progPercent = e.ProgressPercentage
329-
330-
ProgPanelOver.Width = (e.ProgressPercentage / 100) * ProgPanel.Width
324+
If e.ProgressPercentage >= 0 Then
325+
progMode = "downloading"
326+
SetProgBar(e.ProgressPercentage.ToString _
327+
+ "% (" + FormatBytes(e.DownloadSpeedBytesPerSec) + "/s, " _
328+
+ FormatBytes(e.BytesReceived) + "/" + FormatBytes(e.TotalBytesToReceive) _
329+
+ ", " + DaysCalc(e.RemainingTimeSeconds) + " 남음)")
330+
progPercent = e.ProgressPercentage
331+
332+
ProgPanelOver.Width = (e.ProgressPercentage / 100) * ProgPanel.Width
333+
Else '다운로드 퍼센트값이 음수면 -> 비정상적인 다운로드
334+
WC.CancelAsync()
335+
progMode = "downloading"
336+
forceReset(True)
337+
SetProgBar("다운로드를 재시작하는 중...")
338+
End If
331339
End Sub
332340

333341
Public Sub StartDownload()
@@ -479,11 +487,13 @@ Public Class ItemPanel
479487
End Sub
480488

481489
Public Sub PauseDown()
490+
LogForm.addLog("다운로드 일시정지 (" + Name + ")")
482491
Paused = True
483492
WC.CancelAsync()
484493
End Sub
485494

486495
Public Sub ResumeDown()
496+
LogForm.addLog("다운로드 재개 (" + Name + ")")
487497
Try
488498
If Not WC.IsBusy Then '이미 바쁠때 (사용중일때) 가 아닐 때에만
489499
WC.ResumeAsync()
@@ -651,7 +661,6 @@ Public Class ItemPanel
651661
Catch ex As Exception
652662

653663
'MsgBox("오류 발생:" + vbCr + ex.Message, vbCritical)
654-
655664
LogForm.addLog("비디오인포 수집 중 오류 발생. (" + Me.Name + ")")
656665
End Try
657666

NVidExtractor/Forms/Form1.vb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,19 @@ Public Class Form1
104104
ctrl.PauseDown()
105105
Next
106106

107+
LogForm.addLog("다운로드 타이머 정지됨")
107108
DownStartBT.Text = "다운로드 시작"
108109
Else
109110
downStarted = True
110111

111112
For Each ctrl As ItemPanel In ListPanel.Controls
112-
If Not ctrl.WC.IsBusy And ctrl.Paused And ctrl.DownBegan Then
113+
If Not ctrl.WC.IsBusy And ctrl.Paused And ctrl.DownBegan And Not ctrl.DownFinished Then
113114
ctrl.ResumeDown()
114115
End If
115116
Next
116117

117118
DownCheckTimer.Start()
118-
119+
LogForm.addLog("다운로드 타이머 시작됨")
119120
DownStartBT.Text = "일시 정지"
120121
End If
121122
End Sub
@@ -159,6 +160,7 @@ Public Class Form1
159160
For Each ctrl As ItemPanel In ListPanel.Controls
160161
'이미 시작하면 변경 못함
161162
If ctrl.Selected And Not ctrl.WC.IsBusy And Not ctrl.DownBegan Then
163+
LogForm.addLog("일괄 다운로드 설정적용 (" + ctrl.Name + ")")
162164
ctrl.DownQuality = quality
163165
ctrl.DownMode = downmode
164166
ctrl.DownloadLoc = saveLocation
@@ -205,6 +207,7 @@ Public Class Form1
205207
Next
206208

207209
For Each n As String In killlist
210+
LogForm.addLog("완료 다운로드 삭제 (" + n + ")")
208211
ListPanel.Controls.RemoveByKey(n)
209212
Next
210213
End If
@@ -225,6 +228,7 @@ Public Class Form1
225228
Next
226229

227230
For Each n As String In killlist
231+
LogForm.addLog("일괄 다운로드 삭제 (" + n + ")")
228232
ListPanel.Controls.RemoveByKey(n)
229233
Next
230234
End If
@@ -267,8 +271,8 @@ Public Class Form1
267271
Dim unfinished = 0
268272

269273
For Each ctrl As ItemPanel In ListPanel.Controls
270-
'시작은 했는데 끝을 못본 놈이 있으면
271-
If ctrl.WC.IsBusy Or (ctrl.DownBegan And Not ctrl.DownFinished) Then
274+
'시작은 했는데 끝을 못본 놈이 있으면 (그리고 오류도 아님)
275+
If ctrl.WC.IsBusy Or (ctrl.DownBegan And Not ctrl.DownFinished And Not ctrl.progMode = "error") Then
272276
busycount += 1
273277
End If
274278

NVidExtractor/My Project/AssemblyInfo.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' 기본값으로 할 수 있습니다.
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("1.0.1.0")>
35-
<Assembly: AssemblyFileVersion("1.0.1.0")>
34+
<Assembly: AssemblyVersion("1.0.2.0")>
35+
<Assembly: AssemblyFileVersion("1.0.2.0")>

0 commit comments

Comments
 (0)