dc/LogForm.cs

85 lines
3.0 KiB
C#
Raw Normal View History

2022-04-01 17:03:54 +08:00
using Glorysoft.SECS.EQP.Utilities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ARI.EAP.HOST
{
public partial class LogForm : Form
{
public string FlogFilePath;
public string FeventName;
public string FLogTime;
public string FeventDisc;
public string Fkey;
public string Ftype;
public LogForm(string logFilePath,string eventName, string LogTime,string eventDisc,string key,string type)
{
FlogFilePath = logFilePath;
FeventName = eventName;
FLogTime = LogTime;
FeventDisc = eventDisc;
Fkey = key;
Ftype = type;
InitializeComponent();
}
private void LogForm_Load(object sender, EventArgs e)
{
try
{
this.Text = FeventDisc;
FileStream fs = new FileStream(FlogFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
StreamReader str = new StreamReader(fs);
string Line;
while ((Line = str.ReadLine()) != null)
{
//if (Ftype == "SECS")
//{
if (Line.Contains(FLogTime) && Line.Contains(Fkey) && Line.Contains(FeventName))
{
if (FeventName == "S1F17" || FeventName == "S1F15")
{
this.richTextBox1.Text = this.richTextBox1.Text + Line;
}
else
{
while (Line.StartsWith(".") == false)
{
this.richTextBox1.Text = this.richTextBox1.Text + Line + Environment.NewLine;
Line = str.ReadLine();
}
this.richTextBox1.Text = this.richTextBox1.Text + Line;
}
}
//}
//else
//{
// if (Line.Contains(FLogTime) && Line.Contains(Fkey))
// {
// while (Line.StartsWith(".") == false)
// {
// this.richTextBox1.Text = this.richTextBox1.Text + Line + Environment.NewLine;
// Line = str.ReadLine();
// }
// this.richTextBox1.Text = this.richTextBox1.Text + Line;
// }
//}
}
}
catch (Exception ex)
{
LoggerService.SECSLogger.Error(ex);
}
}
}
}