-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to read GZip-Compressed log files #34
base: main
Are you sure you want to change the base?
Conversation
Magic number for recognizing a GZip file found in https://stackoverflow.com/questions/6059302/how-to-check-if-a-file-is-gzip-compressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at my comment regardning .gz extension detections. Otherwise looks good, thanks for the contribution!
@@ -95,15 +96,28 @@ public void LoadLogEntries() | |||
this.LogFileExists = true; | |||
using (FileStream fs = File.Open(this.LogFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) | |||
{ | |||
using (TextReader sr = new StreamReader(fs, true)) | |||
var isGzip = false; | |||
if (LogFileName.Contains(".gz")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be better to use EndsWith instead of Contains? I assume that we are interested only in files ending by .gz.
And I would also add StringComparer.OrdinalIgnoreCase option.
@@ -22,7 +23,20 @@ public void LoadFile(string fileName, int numberOfRowsToShow) | |||
this.Text = fileName; | |||
using (FileStream fs = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) | |||
{ | |||
using (TextReader sr = new StreamReader(fs)) | |||
var isGzip = false; | |||
if (fileName.Contains(".gz")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same comment as above. Otherwise no comments, thanks for the PR! :)
#33