using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace SL200_RTLogViewer.subForm
{
	// Token: 0x02000012 RID: 18
	public class mmiMsgForm : Form
	{
		// Token: 0x06000092 RID: 146 RVA: 0x00009558 File Offset: 0x00007758
		public mmiMsgForm()
		{
			this.InitializeComponent();
		}

		// Token: 0x06000093 RID: 147 RVA: 0x00009570 File Offset: 0x00007770
		private void mmiMsgForm_DragDrop(object sender, DragEventArgs e)
		{
			string[] array = (string[])e.Data.GetData(DataFormats.FileDrop);
			string text = array[0];
			string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
			string extension = Path.GetExtension(text);
			bool flag = text.Contains("MSG");
			if (flag)
			{
				this.Cursor = Cursors.WaitCursor;
				this.fileOpen(text);
				this.Cursor = Cursors.Default;
				this.lbl_filename.Text = fileNameWithoutExtension + extension;
			}
		}

		// Token: 0x06000094 RID: 148 RVA: 0x000095EC File Offset: 0x000077EC
		private static void CopySelectedItems(ListView source, ListView target)
		{
			foreach (object obj in source.Items)
			{
				ListViewItem listViewItem = (ListViewItem)obj;
				target.Items.Add((ListViewItem)listViewItem.Clone());
			}
		}

		// Token: 0x06000095 RID: 149 RVA: 0x0000965C File Offset: 0x0000785C
		public void fileOpen(string fileName)
		{
			this.sublistView.Items.Clear();
			bool @checked = this.checkBox_save.Checked;
			if (@checked)
			{
				this.listViewMSG.Items.Clear();
			}
			FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
			StreamReader streamReader = new StreamReader(fileStream);
			long length = streamReader.BaseStream.Length;
			try
			{
				string text;
				while ((text = streamReader.ReadLine()) != null)
				{
					string text2 = text.Substring(14, text.Length - 14);
					bool flag = text2.Contains("오류") || text2.Contains("실패") || text2.Contains("고장") || text2.Contains("비정상") || text2.Contains("반대편") || text2.Contains("부족") || text2.Contains("롤백") || text2.Contains("미끌림") || text2.Contains("움직임") || text2.Contains("MSG") || text2.Contains("성공") || text2.Contains("대기");
					string[] items;
					if (flag)
					{
						items = new string[]
						{
							text.Substring(0, 5),
							text.Substring(6, 8),
							text.Substring(14, text.Length - 14),
							"1"
						};
					}
					else
					{
						items = new string[]
						{
							text.Substring(0, 5),
							text.Substring(6, 8),
							text.Substring(14, text.Length - 14),
							"0"
						};
					}
					ListViewItem value = new ListViewItem(items);
					this.listViewMSG.Items.Add(value);
				}
			}
			catch (Exception)
			{
				throw;
			}
			finally
			{
				bool flag2 = streamReader != null;
				if (flag2)
				{
					streamReader.Close();
				}
				bool flag3 = fileStream != null;
				if (flag3)
				{
					fileStream.Close();
				}
			}
			mmiMsgForm.CopySelectedItems(this.listViewMSG, this.sublistView);
			this.lb_itemCount.Text = "총 메세지 :" + this.listViewMSG.Items.Count.ToString();
		}

		// Token: 0x06000096 RID: 150 RVA: 0x000098E0 File Offset: 0x00007AE0
		private void mmiMsgForm_DragEnter(object sender, DragEventArgs e)
		{
			e.Effect = DragDropEffects.Copy;
		}

		// Token: 0x06000097 RID: 151 RVA: 0x000098EC File Offset: 0x00007AEC
		private void checkBox_event_CheckedChanged(object sender, EventArgs e)
		{
			this.listViewMSG.Items.Clear();
			bool @checked = this.checkBox_event.Checked;
			if (@checked)
			{
				foreach (object obj in this.sublistView.Items)
				{
					ListViewItem listViewItem = (ListViewItem)obj;
					bool flag = listViewItem.SubItems[3].Text == "1";
					if (flag)
					{
						this.listViewMSG.Items.Add((ListViewItem)listViewItem.Clone());
					}
				}
			}
			else
			{
				foreach (object obj2 in this.sublistView.Items)
				{
					ListViewItem listViewItem2 = (ListViewItem)obj2;
					this.listViewMSG.Items.Add((ListViewItem)listViewItem2.Clone());
				}
			}
			this.lb_itemCount.Text = "총 메세지 :" + this.listViewMSG.Items.Count.ToString();
		}

		// Token: 0x06000098 RID: 152 RVA: 0x00009A50 File Offset: 0x00007C50
		private void bt_fileOpen_Click(object sender, EventArgs e)
		{
			OpenFileDialog openFileDialog = new OpenFileDialog();
			bool flag = DialogResult.OK != openFileDialog.ShowDialog();
			if (!flag)
			{
				string fileName = openFileDialog.FileName;
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);
				string extension = Path.GetExtension(fileName);
				bool flag2 = fileName.Contains("MSG");
				if (flag2)
				{
					this.Cursor = Cursors.WaitCursor;
					this.fileOpen(openFileDialog.FileName);
					this.Cursor = Cursors.Default;
					this.lbl_filename.Text = fileNameWithoutExtension + extension;
				}
			}
		}

		// Token: 0x06000099 RID: 153 RVA: 0x00009AD8 File Offset: 0x00007CD8
		protected override void Dispose(bool disposing)
		{
			bool flag = disposing && this.components != null;
			if (flag)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}

		// Token: 0x0600009A RID: 154 RVA: 0x00009B10 File Offset: 0x00007D10
		private void InitializeComponent()
		{
			this.lb_itemCount = new Label();
			this.listViewMSG = new ListView();
			this.columnHeader1 = new ColumnHeader();
			this.columnHeader5 = new ColumnHeader();
			this.columnHeader2 = new ColumnHeader();
			this.columnHeader3 = new ColumnHeader();
			this.checkBox_event = new CheckBox();
			this.sublistView = new ListView();
			this.columnHeader4 = new ColumnHeader();
			this.columnHeader6 = new ColumnHeader();
			this.columnHeader7 = new ColumnHeader();
			this.columnHeader8 = new ColumnHeader();
			this.bt_fileOpen = new Button();
			this.lbl_filename = new Label();
			this.label1 = new Label();
			this.checkBox_save = new CheckBox();
			base.SuspendLayout();
			this.lb_itemCount.BackColor = Color.Silver;
			this.lb_itemCount.Font = new Font("나눔스퀘어 ExtraBold", 15.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lb_itemCount.Location = new Point(433, 19);
			this.lb_itemCount.Name = "lb_itemCount";
			this.lb_itemCount.Size = new Size(162, 23);
			this.lb_itemCount.TabIndex = 288;
			this.lb_itemCount.Text = "총 메세지 : 0";
			this.listViewMSG.BackColor = SystemColors.GradientInactiveCaption;
			this.listViewMSG.BorderStyle = BorderStyle.None;
			this.listViewMSG.Columns.AddRange(new ColumnHeader[]
			{
				this.columnHeader1,
				this.columnHeader5,
				this.columnHeader2,
				this.columnHeader3
			});
			this.listViewMSG.Font = new Font("맑은 고딕", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 129);
			this.listViewMSG.FullRowSelect = true;
			this.listViewMSG.GridLines = true;
			this.listViewMSG.HideSelection = false;
			this.listViewMSG.Location = new Point(12, 68);
			this.listViewMSG.MultiSelect = false;
			this.listViewMSG.Name = "listViewMSG";
			this.listViewMSG.Size = new Size(1160, 779);
			this.listViewMSG.TabIndex = 287;
			this.listViewMSG.UseCompatibleStateImageBehavior = false;
			this.listViewMSG.View = View.Details;
			this.columnHeader1.Text = "날짜";
			this.columnHeader1.Width = 70;
			this.columnHeader5.Text = "시간";
			this.columnHeader5.Width = 120;
			this.columnHeader2.Text = "내용";
			this.columnHeader2.Width = 260;
			this.columnHeader3.Text = "분류";
			this.columnHeader3.Width = 0;
			this.checkBox_event.Appearance = Appearance.Button;
			this.checkBox_event.Font = new Font("나눔스퀘어 Bold", 12f, FontStyle.Bold, GraphicsUnit.Point, 129);
			this.checkBox_event.Location = new Point(1097, 12);
			this.checkBox_event.Name = "checkBox_event";
			this.checkBox_event.Size = new Size(75, 33);
			this.checkBox_event.TabIndex = 289;
			this.checkBox_event.Text = "이벤트";
			this.checkBox_event.TextAlign = ContentAlignment.MiddleCenter;
			this.checkBox_event.UseVisualStyleBackColor = true;
			this.checkBox_event.CheckedChanged += this.checkBox_event_CheckedChanged;
			this.sublistView.BackColor = SystemColors.GradientInactiveCaption;
			this.sublistView.BorderStyle = BorderStyle.None;
			this.sublistView.Columns.AddRange(new ColumnHeader[]
			{
				this.columnHeader4,
				this.columnHeader6,
				this.columnHeader7,
				this.columnHeader8
			});
			this.sublistView.Font = new Font("맑은 고딕", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 129);
			this.sublistView.FullRowSelect = true;
			this.sublistView.GridLines = true;
			this.sublistView.HideSelection = false;
			this.sublistView.Location = new Point(12, 356);
			this.sublistView.MultiSelect = false;
			this.sublistView.Name = "sublistView";
			this.sublistView.Size = new Size(143, 127);
			this.sublistView.TabIndex = 290;
			this.sublistView.UseCompatibleStateImageBehavior = false;
			this.sublistView.View = View.Details;
			this.sublistView.Visible = false;
			this.columnHeader4.Text = "날짜";
			this.columnHeader4.Width = 70;
			this.columnHeader6.Text = "시간";
			this.columnHeader6.Width = 120;
			this.columnHeader7.Text = "내용";
			this.columnHeader7.Width = 260;
			this.columnHeader8.Text = "분류";
			this.bt_fileOpen.Font = new Font("맑은 고딕", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 129);
			this.bt_fileOpen.Location = new Point(150, 8);
			this.bt_fileOpen.Margin = new Padding(3, 2, 3, 2);
			this.bt_fileOpen.Name = "bt_fileOpen";
			this.bt_fileOpen.Size = new Size(90, 40);
			this.bt_fileOpen.TabIndex = 292;
			this.bt_fileOpen.Text = "FILE OPEN";
			this.bt_fileOpen.UseVisualStyleBackColor = true;
			this.bt_fileOpen.Click += this.bt_fileOpen_Click;
			this.lbl_filename.BackColor = Color.DarkBlue;
			this.lbl_filename.BorderStyle = BorderStyle.FixedSingle;
			this.lbl_filename.Font = new Font("맑은 고딕", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 129);
			this.lbl_filename.ForeColor = Color.White;
			this.lbl_filename.Location = new Point(246, 8);
			this.lbl_filename.Name = "lbl_filename";
			this.lbl_filename.Size = new Size(181, 40);
			this.lbl_filename.TabIndex = 291;
			this.lbl_filename.Text = "-";
			this.lbl_filename.TextAlign = ContentAlignment.MiddleCenter;
			this.label1.BackColor = Color.Silver;
			this.label1.Dock = DockStyle.Top;
			this.label1.Font = new Font("맑은 고딕", 18f, FontStyle.Bold, GraphicsUnit.Point, 129);
			this.label1.ForeColor = Color.Black;
			this.label1.Location = new Point(0, 0);
			this.label1.Name = "label1";
			this.label1.Size = new Size(1184, 55);
			this.label1.TabIndex = 293;
			this.label1.Text = "메세지 뷰어";
			this.label1.TextAlign = ContentAlignment.MiddleLeft;
			this.checkBox_save.Appearance = Appearance.Button;
			this.checkBox_save.Checked = true;
			this.checkBox_save.CheckState = CheckState.Checked;
			this.checkBox_save.Font = new Font("나눔스퀘어 Bold", 12f, FontStyle.Bold, GraphicsUnit.Point, 129);
			this.checkBox_save.Location = new Point(1016, 12);
			this.checkBox_save.Name = "checkBox_save";
			this.checkBox_save.Size = new Size(75, 33);
			this.checkBox_save.TabIndex = 294;
			this.checkBox_save.Text = "갱 신";
			this.checkBox_save.TextAlign = ContentAlignment.MiddleCenter;
			this.checkBox_save.UseVisualStyleBackColor = true;
			this.AllowDrop = true;
			base.AutoScaleDimensions = new SizeF(7f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(1184, 860);
			base.Controls.Add(this.checkBox_save);
			base.Controls.Add(this.bt_fileOpen);
			base.Controls.Add(this.lbl_filename);
			base.Controls.Add(this.sublistView);
			base.Controls.Add(this.checkBox_event);
			base.Controls.Add(this.lb_itemCount);
			base.Controls.Add(this.listViewMSG);
			base.Controls.Add(this.label1);
			base.Name = "mmiMsgForm";
			this.Text = "MMI 메세지";
			base.DragDrop += this.mmiMsgForm_DragDrop;
			base.DragEnter += this.mmiMsgForm_DragEnter;
			base.ResumeLayout(false);
		}

		// Token: 0x04000068 RID: 104
		private IContainer components = null;

		// Token: 0x04000069 RID: 105
		private Label lb_itemCount;

		// Token: 0x0400006A RID: 106
		private ListView listViewMSG;

		// Token: 0x0400006B RID: 107
		private ColumnHeader columnHeader1;

		// Token: 0x0400006C RID: 108
		private ColumnHeader columnHeader5;

		// Token: 0x0400006D RID: 109
		private ColumnHeader columnHeader2;

		// Token: 0x0400006E RID: 110
		private CheckBox checkBox_event;

		// Token: 0x0400006F RID: 111
		private ColumnHeader columnHeader3;

		// Token: 0x04000070 RID: 112
		private ListView sublistView;

		// Token: 0x04000071 RID: 113
		private ColumnHeader columnHeader4;

		// Token: 0x04000072 RID: 114
		private ColumnHeader columnHeader6;

		// Token: 0x04000073 RID: 115
		private ColumnHeader columnHeader7;

		// Token: 0x04000074 RID: 116
		private ColumnHeader columnHeader8;

		// Token: 0x04000075 RID: 117
		private Button bt_fileOpen;

		// Token: 0x04000076 RID: 118
		private Label lbl_filename;

		// Token: 0x04000077 RID: 119
		private Label label1;

		// Token: 0x04000078 RID: 120
		private CheckBox checkBox_save;
	}
}
