This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.vb
64 lines (54 loc) · 1.69 KB
/
MainForm.vb
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
'
' Created by SharpDevelop.
' User: IP-Man
' Date: 6/27/2017
' Time: 9:55 PM
'
Imports System.IO
Imports System.Drawing.Font
Public Partial Class MainForm
Dim inputfile,inputfilename As String
Public Sub New()
' The Me.InitializeComponent call is required for Windows Forms designer support.
Me.InitializeComponent()
'
' TODO : Add constructor code after InitializeComponents
'
End Sub
Function DoConvert(inputText As String)
Dim uni,font As String
Dim TotalLines As Integer = File.ReadAllLines("charlist.txt").Length
For Each Line As String In File.ReadLines("charlist.txt")
If Line.Contains("-") Then
uni=Line.Split("-")(0)
font=Line.Split("-")(1)
inputText=inputText.Replace(uni,font)
End If
Next
Return inputText
End Function
Sub OutputfontBTNClick(sender As Object, e As EventArgs)
Dim objFontDlg As New FontDialog
If objFontDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
outputBox.Font = objFontDlg.Font
outputfontBTN.Text = objFontDlg.Font.Name
End If
End Sub
Sub ConvertBTNClick(sender As Object, e As EventArgs)
outputBox.Text=DoConvert(inputBox.Text)
End Sub
Sub LoadfileBTNClick(sender As Object, e As EventArgs)
If openFileDialog.ShowDialog()=DialogResult.OK Then
inputfile=openFileDialog.FileName
inputfilename=System.IO.Path.GetFileName(inputfile)
inputfile=File.ReadAllText(inputfile)
inputBox.Text = inputfile
End If
End Sub
Sub SavetextBTNClick(sender As Object, e As EventArgs)
saveFileDialog.FileName="converted_" & inputfilename
If saveFileDialog.ShowDialog() = DialogResult.OK Then
System.IO.File.WriteAllText(saveFileDialog.FileName,outputBox.Text)
End If
End Sub
End Class