Private Sub WriteLog(line As String)
Logger.WriteDebugLog("MAIN: " & line)
If (TextArea1.IsInitialized) Then
UpdateTextArea
End If
End Sub
Private Sub UpdateTextArea
TextArea1.Text = Logger.GetBuffer
TextArea1.SetSelection(TextArea1.Text.Length, TextArea1.Text.Length)
Sleep(0)
End Sub
Private Sub SplitLongLog
Dim dir As String = Preferences.GetString(Preferences.OPT_DIR)
Dim filename As String = Preferences.GetString(Preferences.OPT_FILENAME)
Dim linenumber As Int = 0
WriteLog($"Split ${dir}\${filename}"$)
Private inTextFile As TextReader
Try
inTextFile.Initialize(File.OpenInput(dir, filename))
Dim line As String = ""
Do While line <> Null
line = inTextFile.ReadLine
If (line <> Null) Then
linenumber = linenumber + 1
If (linenumber Mod 1000) = 0 Then
WriteLog("processing line " & linenumber)
End If
If Regex.IsMatch(pattern, line) Then
'process the line
'time consuming
End If
End If
Loop
Catch
Log(LastException)
End Try
If (inTextFile.IsInitialized) Then
inTextFile.Close
End If
End Sub