Hi, I have been working on a little program that can read a chat log of a game called "Path of Exile" and let you easily read through your old chats even after closing the game. The reason I am making this is because it is not already a feature in the game. I am having trouble parsing / replacing certain parts of the chat log to make it nicer to read.
This is how it looks right now:
![]()
There are a few problems I am having so far.
1. Each message has a random number 8 digits long and then "1ae" after it. I would like to remove both of them along with INFO Client.
2. The way I am finding what parts of the log file are chat messages is by parsing "[INFO Client 5840] $" or # or @. The problem with this is that the 3~4 numbers after INFO Client change every day. I wouldn't want to only filter by #, @ or $ because these can be part of the message.
3. Where I tried to do replace 1ae, it didn't change anything.
This is the code I am using to filter the text from the log. I'd be very grateful for anyone that could help me with this! Many other players would like a tool like this too! :)
Also, if there is a more efficient way to load a huge text file and parse it please let me know. I also want to try adding a progress bar to show how long it is loading the document.
This is how it looks right now:
There are a few problems I am having so far.
1. Each message has a random number 8 digits long and then "1ae" after it. I would like to remove both of them along with INFO Client.
Code:
2013/02/02 18:09:03 34517015 1ae [INFO Client 5840] $LamentLol: WTS _ current offer 2 chaos
3. Where I tried to do replace 1ae, it didn't change anything.
Code:
newTextLine = Replace(TextLine, "1ae", "")
rtb_Global.AppendText(newTextLine)
Code:
Private Sub ParseTrade(ByVal txtFile As String)
Dim TextLine As String = Nothing
Dim NewLine As String = Nothing
Dim newTextLine As String = Nothing
If System.IO.File.Exists(txtFile) = True Then
Dim txtReader As New System.IO.StreamReader(txtFile)
Do While txtReader.Peek() <> -1
TextLine = txtReader.ReadLine()
If InStr(TextLine, "[INFO Client 5840] #") Then
If rtb_Global.Text = "" Then
newTextLine = Replace(TextLine, "1ae", "")
rtb_Global.AppendText(newTextLine)
Else
rtb_Global.AppendText(Environment.NewLine & TextLine)
End If
End If
If InStr(TextLine, "[INFO Client 5840] @") Then
If rtb_Private.Text = "" Then
rtb_Private.AppendText(TextLine)
Else
rtb_Private.AppendText(Environment.NewLine & TextLine)
End If
End If
If InStr(TextLine, "[INFO Client 5840] $") Then
If rtb_Trade.Text = "" Then
rtb_Trade.AppendText(TextLine)
Else
rtb_Trade.AppendText(Environment.NewLine & TextLine)
End If
End If
Loop
Else
MsgBox("File does not exist.")
End If
End Sub
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ParseTrade(("C:\Program Files (x86)\Grinding Gear Games\Path of Exile\logs\Client.txt"))
End Sub