Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void timerLog_Tick(object sender, EventArgs e)
- {
- string logpath = "log.txt";
- if (File.Exists(logpath))
- {
- Stream stream = File.Open(logpath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
- StreamReader streamReader = new StreamReader(stream);
- string str = streamReader.ReadToEnd();
- //rtblog is my RichTextBox
- int startIndex = 0;
- int tempStartIndex = -1;
- if ((tempStartIndex = str.LastIndexOf("Application engine version 2.0.2016 was initiated", startIndex)) > 0)
- {
- rtbLog.SelectedText = rtbLog.SelectedText + "Application engine Started\n";
- }
- else if ((tempStartIndex = str.LastIndexOf("Drivers not found", startIndex)) > 0)
- {
- rtbLog.SelectedText = rtbLog.SelectedText + "Drivers were not found navigate to settings Menu to install them\n";
- }
- if (tempStartIndex != -1)
- {
- startIndex = tempStartIndex;
- }
- //rtbLog.Text = str;
- rtbLog.SelectionStart = rtbLog.Text.Length;
- rtbLog.ScrollToCaret();
- streamReader.Close();
- stream.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement