-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTutorials.vb
More file actions
140 lines (120 loc) · 5.33 KB
/
Tutorials.vb
File metadata and controls
140 lines (120 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Threading
Public Class Tutorials
''' <summary>
''' 답변 문자열().
''' </summary>
Public Answers_ As New List(Of String)
Private Sub Tutorials_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Select Case MainProject.lang
Case Translator.tL.Korean
Text = "튜토리얼"
End Select
If My.Computer.Network.IsAvailable Then
ThreadPool.QueueUserWorkItem(AddressOf Tutorial_DownloadFile)
Else
MessageBox.Show("Connecting Network Failed!" & vbNewLine & "Please check the computer's network.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Catch ex As Exception
If MainProject.IsGreatExMode Then
MessageBox.Show("Error - " & ex.Message & vbNewLine & "Error Message: " & ex.StackTrace, Me.Text & ": Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Error: " & ex.Message, Me.Text & ": Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Try
End Sub
Public Sub Tutorial_DownloadFile()
Invoke(Sub()
With Loading
.Show()
.DPr.Style = ProgressBarStyle.Marquee
.DPr.MarqueeAnimationSpeed = 10
Select Case MainProject.lang
Case Translator.tL.English
.Text = "Loading Tutorials..."
.DLb.Text = "Downloading Tutorials File..."
Case Translator.tL.Korean
.Text = "튜토리얼 불러오는 중..."
.DLb.Text = "튜토리얼 파일 다운로드 하는 중..."
End Select
.DLb.Left -= 50
End With
End Sub)
Invoke(Sub() Q_ListView.Enabled = False)
Try
Dim a As New WebClient
a.DownloadFile("http://dtr.ucv.kro.kr", MainProject.TempDirectory & "\UniConverter-Tutorials.uni")
Catch exN As WebException
Invoke(Sub()
Loading.Dispose()
Select Case MainProject.lang
Case Translator.tL.English
MessageBox.Show("Connecting Network Failed!" & vbNewLine & "Please check the computer's network.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
Case Translator.tL.Korean
MessageBox.Show("네트워크에 연결을 할 수 없습니다!" & vbNewLine & "컴퓨터의 네트워크를 확인해 주세요.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Select
End Sub)
Exit Sub
End Try
Try
Invoke(Sub()
Loading.Dispose()
Q_ListView.Enabled = True
Tutorial_ReadMark()
End Sub)
Catch exN As InvalidOperationException
Exit Sub
End Try
End Sub
Private Sub Me_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If Q_ListView.Enabled = False Then 'InvaildOperationException 예외 처리
Loading.Dispose()
Dispose()
End If
End Sub
Public Sub Tutorial_ReadMark()
Dim TutorialsDir As String = MainProject.TempDirectory & "\UniConverter-Tutorials.uni"
Dim tstr As String() = File.ReadAllLines(TutorialsDir, Encoding.Default)
Dim skipInt As Integer = 0
For i As Integer = 0 To tstr.Count - 1
'빈 문자열 이거나 주석인 경우.
If String.IsNullOrWhiteSpace(tstr(i)) OrElse Mid(tstr(i), 1, 2) = "//" Then
Continue For
End If
Dim a As String() = tstr(i).Split("=")
Select Case a(0)
Case "`"
If Not MainProject.lang = Translator.GetLnEnum(a(1).Trim) Then
skipInt = MainProject.Cntstr(File.ReadAllText(TutorialsDir), ">>")
Else
skipInt = 0
End If
Case ">"
If Not skipInt = 0 Then
skipInt -= 1
Continue For
End If
Q_ListView.Items.Add(a(1).Trim())
Case ">>"
If Not skipInt = 0 Then
skipInt -= 1
Continue For
End If
Answers_.Add(a(1))
End Select
Next
End Sub
Private Sub Q_ListView_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Q_ListView.SelectedIndexChanged
If Q_ListView.SelectedItems.Count > 0 Then
Dim a As Integer = Q_ListView.SelectedItems.Item(0).Index
A_RichTextBox.Text = Answers_.Item(a)
End If
End Sub
Private Sub A_RichTextBox_LinkClicked(sender As Object, e As LinkClickedEventArgs) Handles A_RichTextBox.LinkClicked
Shell("explorer.exe " & e.LinkText)
End Sub
End Class