using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
using LogCfg;

namespace QDART_MFG_CfgEditor;

public class LoggingConfigPanel : UserControl
{
	public delegate void TargetFileChangedEventHandler(string targetfile);

	private LogCfg.Root ori = new LogCfg.Root();

	private RootConfig rc;

	private string TargetFile = "";

	private Dictionary<string, string> dcLogType = new Dictionary<string, string>();

	private BindingSource bsRoot = new BindingSource();

	private BindingSource bsLogSettings = new BindingSource();

	private BindingSource bsFolderSettings = new BindingSource();

	private BindingSource bsFileNameSettings = new BindingSource();

	private BindingSource bsLogFlags = new BindingSource();

	private IContainer components;

	private CheckBox cbUseGlobalSettings;

	private CheckedListBox clbLogType;

	private Panel panel1;

	private TextBox tbBaseFolder;

	private Button btnBaseFolderBrower;

	private Label label1;

	private TextBox tbSubFolder;

	private Label label3;

	private CheckBox cbLogOnErrOnly;

	private Panel panel2;

	private TextBox tbFileName;

	private Button btnSubFolder;

	private Button btnFileName;

	private Button btnResetAll;

	private ToolTip toolTip1;

	private TextBox tbStylesheetFolder;

	private Button btnStylesheetFolder;

	private Label label2;

	private FolderBrowserDialog folderBrowser;

	private ContextMenuStrip cmsLogTypeList;

	private ToolStripMenuItem createToolStripMenuItem;

	private ToolStripMenuItem renameToolStripMenuItem;

	private ToolStripMenuItem deleteToolStripMenuItem;

	private Label label4;

	private TextBox tbPreview;

	private Label label5;

	private Label label6;

	private Panel panel4;

	private Panel panel6;

	private Panel panel5;

	private Panel panel7;

	private Label label8;

	private CheckBox cbCreateFolderForEachLogFlag;

	private ErrorProvider errorProvider1;

	public event TargetFileChangedEventHandler TargetFileChanged;

	public LoggingConfigPanel(RootConfig cfg)
	{
		InitializeComponent();
		InitVar(cfg);
		rc = cfg;
	}

	private void InitVar(RootConfig cfg)
	{
		RootConfigAllPanel[] panel = cfg.All[0].Panel;
		foreach (RootConfigAllPanel rootConfigAllPanel in panel)
		{
			if (cfg.Station == rootConfigAllPanel.Name && rootConfigAllPanel.File.Length > 0)
			{
				TargetFile = Common.GetPath(rootConfigAllPanel.File[0].Value);
			}
		}
		if (File.Exists(TargetFile))
		{
			if (LoadTargetFile(TargetFile))
			{
				BindingUI();
				InitControls();
			}
			else
			{
				ClearControls();
			}
		}
		else
		{
			btnResetAll_Click(null, null);
			SaveResult();
		}
	}

	public bool OpenFile()
	{
		bool result = false;
		try
		{
			OpenFileDialog openFileDialog = new OpenFileDialog();
			openFileDialog.Filter = "xml(*.xml)|*.xml";
			if (openFileDialog.ShowDialog() == DialogResult.OK)
			{
				string fileName = openFileDialog.FileName;
				if (LoadTargetFile(fileName))
				{
					TargetFile = fileName;
					BindingUI();
					InitControls();
					result = true;
				}
				else
				{
					ClearControls();
				}
			}
			return result;
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
			return false;
		}
	}

	public bool SaveResult()
	{
		bool result = false;
		try
		{
			string targetFile = TargetFile;
			if (!File.Exists(targetFile))
			{
				string directoryName = Path.GetDirectoryName(targetFile);
				if (!Directory.Exists(directoryName))
				{
					Directory.CreateDirectory(directoryName);
				}
				FileStream fileStream = File.Create(targetFile);
				fileStream.Close();
			}
			if (File.GetAttributes(targetFile).ToString().IndexOf("ReadOnly") != -1)
			{
				File.SetAttributes(targetFile, FileAttributes.Normal);
			}
			UiToData();
			SerialToFile(targetFile);
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
			result = false;
		}
		return result;
	}

	public bool SaveResultAs()
	{
		try
		{
			string targetFile = TargetFile;
			using (SaveFileDialog saveFileDialog = new SaveFileDialog())
			{
				saveFileDialog.Title = "Save file as Diag";
				saveFileDialog.InitialDirectory = Path.GetDirectoryName(targetFile);
				saveFileDialog.FileName = targetFile;
				saveFileDialog.Filter = "xmlfile|*.xml";
				if (saveFileDialog.ShowDialog() == DialogResult.OK)
				{
					targetFile = saveFileDialog.FileName;
					SerialToFile(targetFile);
					if (File.GetAttributes(targetFile).ToString().IndexOf("ReadOnly") != -1)
					{
						File.SetAttributes(targetFile, FileAttributes.Normal);
					}
					UiToData();
					SerialToFile(targetFile);
					TargetFile = targetFile;
					OnFileChange(TargetFile);
				}
			}
			return true;
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
			return false;
		}
	}

	private void SerialToFile(string fileName)
	{
		XmlSerializer xmlSerializer = new XmlSerializer(typeof(LogCfg.Root));
		using StreamWriter streamWriter = new StreamWriter(fileName);
		xmlSerializer.Serialize(streamWriter, ori);
		streamWriter.Close();
	}

	private bool LoadTargetFile(string resfile)
	{
		bool result = false;
		try
		{
			if (File.Exists(resfile))
			{
				using (FileStream fileStream = new FileStream(resfile, FileMode.Open, FileAccess.Read, FileShare.Read))
				{
					XmlSerializer xmlSerializer = new XmlSerializer(typeof(LogCfg.Root));
					ori = (LogCfg.Root)xmlSerializer.Deserialize(fileStream);
					fileStream.Close();
					if (ori != null)
					{
						dcLogType.Clear();
						LogFlag[] logFlags = ori.LogSettings.LogFlags;
						foreach (LogFlag logFlag in logFlags)
						{
							dcLogType.Add(logFlag.name, logFlag.value);
						}
					}
				}
				result = true;
			}
			OnFileChange(resfile);
		}
		catch
		{
			result = false;
		}
		return result;
	}

	private void BindingUI()
	{
		try
		{
			bsRoot = new BindingSource();
			tbBaseFolder.DataBindings.Clear();
			tbStylesheetFolder.DataBindings.Clear();
			tbFileName.DataBindings.Clear();
			tbSubFolder.DataBindings.Clear();
			cbUseGlobalSettings.DataBindings.Clear();
			cbLogOnErrOnly.DataBindings.Clear();
			cbCreateFolderForEachLogFlag.DataBindings.Clear();
			if (ori != null)
			{
				bsRoot.Add(ori);
				bsLogSettings.DataSource = bsRoot;
				bsLogSettings.DataMember = "LogSettings";
				bsFolderSettings.DataSource = bsLogSettings;
				bsFolderSettings.DataMember = "FolderSettings";
				bsLogFlags.DataSource = bsLogSettings;
				bsLogFlags.DataMember = "LogFlags";
				bsFileNameSettings.DataSource = bsLogSettings;
				bsFileNameSettings.DataMember = "FileNameSettings";
				tbBaseFolder.DataBindings.Add("Text", bsFolderSettings, "BaseFolder");
				tbStylesheetFolder.DataBindings.Add("Text", bsFolderSettings, "StylesheetFolder");
				tbFileName.DataBindings.Add("Text", bsFileNameSettings, "FileNameTemplate");
				tbSubFolder.DataBindings.Add("Text", bsFolderSettings, "FolderNameTemplate");
				cbUseGlobalSettings.DataBindings.Add("Checked", bsLogSettings, "UseGlobalSettings");
				cbLogOnErrOnly.DataBindings.Add("Checked", bsFolderSettings, "LogOnErrorOnly");
				cbCreateFolderForEachLogFlag.DataBindings.Add("Checked", bsFolderSettings, "CreateFolderForEachLogFlag");
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void InitControls()
	{
		clbLogType.Items.Clear();
		foreach (KeyValuePair<string, string> item in dcLogType)
		{
			clbLogType.Items.Add(item.Key);
			clbLogType.SetItemChecked(clbLogType.Items.Count - 1, bool.Parse(item.Value));
		}
		cbUseGlobalSettings_CheckedChanged(null, null);
	}

	private void ClearControls()
	{
	}

	private void UiToData()
	{
		dcLogType.Clear();
		for (int i = 0; i < clbLogType.Items.Count; i++)
		{
			dcLogType.Add(clbLogType.Items[i].ToString(), clbLogType.GetItemChecked(i).ToString());
		}
		List<LogFlag> list = new List<LogFlag>();
		foreach (KeyValuePair<string, string> item in dcLogType)
		{
			LogFlag logFlag = new LogFlag();
			logFlag.name = item.Key;
			logFlag.value = item.Value;
			list.Add(logFlag);
		}
		ori.LogSettings.LogFlags = list.ToArray();
	}

	private void OnFileChange(string resfile)
	{
		if (this.TargetFileChanged != null)
		{
			this.TargetFileChanged(resfile);
		}
	}

	public void TickFileChange()
	{
		OnFileChange(TargetFile);
	}

	private void btnBaseFolderBrower_Click(object sender, EventArgs e)
	{
		if (folderBrowser.ShowDialog() == DialogResult.OK)
		{
			tbBaseFolder.Text = folderBrowser.SelectedPath;
			bsFolderSettings.EndEdit();
		}
	}

	private void btnStylesheetFolder_Click(object sender, EventArgs e)
	{
		if (folderBrowser.ShowDialog() == DialogResult.OK)
		{
			tbStylesheetFolder.Text = folderBrowser.SelectedPath;
			bsFolderSettings.EndEdit();
		}
	}

	private void clbLogType_MouseClick(object sender, MouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right)
		{
			cmsLogTypeList.Show(clbLogType, e.X, e.Y);
		}
		UpdatePreView();
	}

	private void createToolStripMenuItem_Click(object sender, EventArgs e)
	{
		New_Click(sender, e);
	}

	private void renameToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Rename_Click(sender, e);
	}

	private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Delete_Click(sender, e);
	}

	private void New_Click(object sender, EventArgs e)
	{
		Input input = new Input();
		input.ShowDialog();
		string inputString = input.inputString;
		if (!(inputString == ""))
		{
			if (dcLogType.ContainsKey(inputString))
			{
				MessageBox.Show(inputString + " already exist.");
				return;
			}
			dcLogType.Add(inputString, "True");
			clbLogType.Items.Add(inputString);
			clbLogType.SetItemChecked(clbLogType.Items.Count - 1, value: true);
			clbLogType.SetSelected(clbLogType.Items.Count - 1, value: true);
		}
	}

	private void Rename_Click(object sender, EventArgs e)
	{
		if (clbLogType.SelectedItem == null)
		{
			return;
		}
		Input input = new Input();
		input.ShowDialog();
		string inputString = input.inputString;
		if (!(inputString == ""))
		{
			if (dcLogType.ContainsKey(inputString))
			{
				MessageBox.Show(inputString + " already exist.");
				return;
			}
			string key = clbLogType.SelectedItem.ToString();
			dcLogType.Remove(key);
			dcLogType.Add(inputString, "True");
			int selectedIndex = clbLogType.SelectedIndex;
			clbLogType.Items.RemoveAt(selectedIndex);
			clbLogType.Items.Insert(selectedIndex, inputString);
			clbLogType.SetItemChecked(selectedIndex, value: true);
			clbLogType.SetSelected(selectedIndex, value: true);
		}
	}

	private void Delete_Click(object sender, EventArgs e)
	{
		if (clbLogType.SelectedItem != null)
		{
			string key = clbLogType.SelectedItem.ToString();
			dcLogType.Remove(key);
			int selectedIndex = clbLogType.SelectedIndex;
			clbLogType.Items.RemoveAt(selectedIndex);
		}
	}

	private void btnSubFolder_Click(object sender, EventArgs e)
	{
		Namer namer = new Namer(tbSubFolder.Text + ";QRD-%PCNAME%-%DATE%-%TREENAME%;Sub Folder");
		if (namer.ShowDialog() == DialogResult.OK)
		{
			tbSubFolder.Text = namer.Tag.ToString();
			bsFolderSettings.EndEdit();
		}
	}

	private void btnFileName_Click(object sender, EventArgs e)
	{
		Namer namer = new Namer(tbFileName.Text + ";UserDefine-%SN%-%DATE_TIME%-%TECHNOLOGIES%-%DUT_ID%;File Name");
		if (namer.ShowDialog() == DialogResult.OK)
		{
			tbFileName.Text = namer.Tag.ToString();
			bsFileNameSettings.EndEdit();
		}
	}

	private void cbUseGlobalSettings_CheckedChanged(object sender, EventArgs e)
	{
		foreach (Control control in base.Controls)
		{
			control.Enabled = cbUseGlobalSettings.Checked;
		}
		cbUseGlobalSettings.Enabled = true;
		btnResetAll.Enabled = true;
		UpdatePreView();
	}

	private void cmsLogTypeList_Opening(object sender, CancelEventArgs e)
	{
		if (clbLogType.SelectedItem == null)
		{
			renameToolStripMenuItem.Visible = false;
			deleteToolStripMenuItem.Visible = false;
		}
		else
		{
			renameToolStripMenuItem.Visible = true;
			deleteToolStripMenuItem.Visible = true;
		}
	}

	private void UpdatePreView()
	{
		try
		{
			tbPreview.Text = "";
			if (!cbUseGlobalSettings.Checked)
			{
				tbPreview.Text = "";
				return;
			}
			string text = tbBaseFolder.Text;
			if (string.IsNullOrEmpty(text))
			{
				tbPreview.Text = "Base Folder can't be empty";
				return;
			}
			string path = "";
			string text2 = "";
			text2 = tbSubFolder.Text;
			if (!string.IsNullOrEmpty(text2))
			{
				foreach (KeyValuePair<string, string> item in Common.LogSample)
				{
					if (text2.Contains(item.Key))
					{
						text2 = text2.Replace(item.Key, item.Value);
					}
				}
				path = text2;
			}
			string text3 = "";
			string text4 = "";
			bool flag = false;
			for (int i = 0; i < clbLogType.Items.Count; i++)
			{
				if (flag)
				{
					break;
				}
				if (clbLogType.GetItemChecked(i))
				{
					flag = true;
					text3 = clbLogType.Items[i].ToString();
					break;
				}
			}
			if (!flag)
			{
				tbPreview.Text = "At least one item in Log Flags checked.If the log type not included in the list, please right click to add it as needed.";
				return;
			}
			text4 = text3;
			if (text3 == "")
			{
				text4 = "log";
			}
			if (!cbCreateFolderForEachLogFlag.Checked)
			{
				text3 = "";
			}
			string text5 = "";
			text2 = tbFileName.Text;
			if (!string.IsNullOrEmpty(text2))
			{
				foreach (KeyValuePair<string, string> item2 in Common.LogSample)
				{
					if (text2.Contains(item2.Key))
					{
						text2 = text2.Replace(item2.Key, item2.Value);
					}
				}
				text5 = text2;
			}
			else
			{
				text5 = "KeepDefaultFileName";
			}
			text5 = text5 + "." + text4;
			string text6 = "";
			text6 = Path.Combine(text, path, text3, text5);
			tbPreview.Text = text6;
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void textPathChange(object sender, EventArgs e)
	{
		if (IsLegalPath(((TextBox)sender).Text))
		{
			StringBuilder stringBuilder = new StringBuilder(((TextBox)sender).Text);
			int num = stringBuilder.ToString().Count((char o) => o.Equals('%'));
			if (1 == num % 2)
			{
				errorProvider1.SetError((TextBox)sender, "% count should be even number");
				return;
			}
			errorProvider1.SetError((TextBox)sender, null);
			UpdatePreView();
		}
		else
		{
			errorProvider1.SetError((TextBox)sender, "Path contains not legal character");
		}
	}

	private void tbBaseFolder_TextChanged(object sender, EventArgs e)
	{
		textPathChange(sender, e);
	}

	private void tbSubFolder_TextChanged(object sender, EventArgs e)
	{
		textPathChange(sender, e);
	}

	private void tbStylesheetFolder_TextChanged(object sender, EventArgs e)
	{
		textPathChange(sender, e);
	}

	private void tbFileName_TextChanged(object sender, EventArgs e)
	{
		if (IsLegalFileName(((TextBox)sender).Text))
		{
			StringBuilder stringBuilder = new StringBuilder(((TextBox)sender).Text);
			int num = stringBuilder.ToString().Count((char o) => o.Equals('%'));
			if (1 == num % 2)
			{
				errorProvider1.SetError((TextBox)sender, "% count should be even number");
				return;
			}
			errorProvider1.SetError((TextBox)sender, null);
			UpdatePreView();
		}
		else
		{
			errorProvider1.SetError((TextBox)sender, "File name contains not legal character");
		}
	}

	private void clbLogType_SelectedValueChanged_1(object sender, EventArgs e)
	{
		UpdatePreView();
	}

	private void cbCreateFolderForEachLogFlag_CheckedChanged(object sender, EventArgs e)
	{
		UpdatePreView();
	}

	private void btnResetAll_Click(object sender, EventArgs e)
	{
		ori = new LogCfg.Root();
		ori.LogSettings = new LogSettings();
		ori.LogSettings.UseGlobalSettings = "True";
		ori.LogSettings.FolderSettings = new FolderSettings();
		ori.LogSettings.FolderSettings.BaseFolder = "C:\\Qualcomm\\Log";
		ori.LogSettings.FolderSettings.FolderNameTemplate = "%PCNAME%-%DATE%-%TREENAME%";
		ori.LogSettings.FolderSettings.StylesheetFolder = "C:\\Program Files (x86)\\Qualcomm\\QDART\\QSPRStyleSheets";
		ori.LogSettings.FolderSettings.LogOnErrorOnly = "False";
		ori.LogSettings.FolderSettings.CreateFolderForEachLogFlag = "False";
		ori.LogSettings.FileNameSettings = new FileNameSettings();
		ori.LogSettings.FileNameSettings.FileNameTemplate = "UserDefine-%SN%-%DATE_TIME%-%TECHNOLOGIES%-%DUT_ID%";
		dcLogType.Clear();
		dcLogType = new Dictionary<string, string>
		{
			{ "XML", "True" },
			{ "XML-QSPR", "True" },
			{ "XML-Others", "True" },
			{ "XML-SubSystemDLL", "True" },
			{ "HTML", "True" },
			{ "TPL3", "True" },
			{ "TXT", "True" },
			{ "TXT-QMSL", "False" },
			{ "TXT-Debug", "True" },
			{ "TXT-Log", "True" },
			{ "TXT-Error", "True" },
			{ "TXT-Others", "True" },
			{ "CSV-IQ", "False" },
			{ "BIN-IQ", "False" }
		};
		List<LogFlag> list = new List<LogFlag>();
		foreach (KeyValuePair<string, string> item in dcLogType)
		{
			LogFlag logFlag = new LogFlag();
			logFlag.name = item.Key;
			logFlag.value = item.Value;
			list.Add(logFlag);
		}
		ori.LogSettings.LogFlags = list.ToArray();
		BindingUI();
		InitControls();
	}

	private bool IsLegalPath(string path)
	{
		foreach (char value in path)
		{
			if (Path.GetInvalidPathChars().Contains(value))
			{
				return false;
			}
		}
		return true;
	}

	private bool IsLegalFileName(string filename)
	{
		foreach (char value in filename)
		{
			if (Path.GetInvalidFileNameChars().Contains(value))
			{
				return false;
			}
		}
		return true;
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		this.cbUseGlobalSettings = new System.Windows.Forms.CheckBox();
		this.clbLogType = new System.Windows.Forms.CheckedListBox();
		this.cmsLogTypeList = new System.Windows.Forms.ContextMenuStrip(this.components);
		this.createToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.renameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.panel1 = new System.Windows.Forms.Panel();
		this.tbBaseFolder = new System.Windows.Forms.TextBox();
		this.btnBaseFolderBrower = new System.Windows.Forms.Button();
		this.label1 = new System.Windows.Forms.Label();
		this.tbSubFolder = new System.Windows.Forms.TextBox();
		this.label3 = new System.Windows.Forms.Label();
		this.cbLogOnErrOnly = new System.Windows.Forms.CheckBox();
		this.panel2 = new System.Windows.Forms.Panel();
		this.tbFileName = new System.Windows.Forms.TextBox();
		this.btnSubFolder = new System.Windows.Forms.Button();
		this.btnFileName = new System.Windows.Forms.Button();
		this.btnResetAll = new System.Windows.Forms.Button();
		this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
		this.btnStylesheetFolder = new System.Windows.Forms.Button();
		this.label5 = new System.Windows.Forms.Label();
		this.label6 = new System.Windows.Forms.Label();
		this.label2 = new System.Windows.Forms.Label();
		this.tbStylesheetFolder = new System.Windows.Forms.TextBox();
		this.folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
		this.label4 = new System.Windows.Forms.Label();
		this.tbPreview = new System.Windows.Forms.TextBox();
		this.panel4 = new System.Windows.Forms.Panel();
		this.panel6 = new System.Windows.Forms.Panel();
		this.panel5 = new System.Windows.Forms.Panel();
		this.panel7 = new System.Windows.Forms.Panel();
		this.label8 = new System.Windows.Forms.Label();
		this.cbCreateFolderForEachLogFlag = new System.Windows.Forms.CheckBox();
		this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
		this.cmsLogTypeList.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).BeginInit();
		base.SuspendLayout();
		this.cbUseGlobalSettings.AutoSize = true;
		this.cbUseGlobalSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.cbUseGlobalSettings.Location = new System.Drawing.Point(12, 10);
		this.cbUseGlobalSettings.Name = "cbUseGlobalSettings";
		this.cbUseGlobalSettings.Size = new System.Drawing.Size(165, 20);
		this.cbUseGlobalSettings.TabIndex = 1;
		this.cbUseGlobalSettings.Text = "Use Global Settings";
		this.toolTip1.SetToolTip(this.cbUseGlobalSettings, "Determines if all tools should use the configuration items in this file");
		this.cbUseGlobalSettings.UseVisualStyleBackColor = true;
		this.cbUseGlobalSettings.CheckedChanged += new System.EventHandler(cbUseGlobalSettings_CheckedChanged);
		this.clbLogType.CheckOnClick = true;
		this.clbLogType.ContextMenuStrip = this.cmsLogTypeList;
		this.clbLogType.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.clbLogType.FormattingEnabled = true;
		this.clbLogType.Location = new System.Drawing.Point(149, 289);
		this.clbLogType.MultiColumn = true;
		this.clbLogType.Name = "clbLogType";
		this.clbLogType.Size = new System.Drawing.Size(423, 72);
		this.clbLogType.TabIndex = 2;
		this.clbLogType.MouseClick += new System.Windows.Forms.MouseEventHandler(clbLogType_MouseClick);
		this.clbLogType.SelectedValueChanged += new System.EventHandler(clbLogType_SelectedValueChanged_1);
		this.cmsLogTypeList.Items.AddRange(new System.Windows.Forms.ToolStripItem[3] { this.createToolStripMenuItem, this.renameToolStripMenuItem, this.deleteToolStripMenuItem });
		this.cmsLogTypeList.Name = "cmsLogTypeList";
		this.cmsLogTypeList.Size = new System.Drawing.Size(159, 70);
		this.cmsLogTypeList.Opening += new System.ComponentModel.CancelEventHandler(cmsLogTypeList_Opening);
		this.createToolStripMenuItem.Name = "createToolStripMenuItem";
		this.createToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.N | System.Windows.Forms.Keys.Control;
		this.createToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
		this.createToolStripMenuItem.Text = "&New";
		this.createToolStripMenuItem.Click += new System.EventHandler(createToolStripMenuItem_Click);
		this.renameToolStripMenuItem.Name = "renameToolStripMenuItem";
		this.renameToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.R | System.Windows.Forms.Keys.Control;
		this.renameToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
		this.renameToolStripMenuItem.Text = "&Rename";
		this.renameToolStripMenuItem.Click += new System.EventHandler(renameToolStripMenuItem_Click);
		this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
		this.deleteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.D | System.Windows.Forms.Keys.Control;
		this.deleteToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
		this.deleteToolStripMenuItem.Text = "&Delete";
		this.deleteToolStripMenuItem.Click += new System.EventHandler(deleteToolStripMenuItem_Click);
		this.panel1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
		this.panel1.Location = new System.Drawing.Point(9, 37);
		this.panel1.Name = "panel1";
		this.panel1.Size = new System.Drawing.Size(625, 1);
		this.panel1.TabIndex = 3;
		this.tbBaseFolder.Location = new System.Drawing.Point(149, 148);
		this.tbBaseFolder.Name = "tbBaseFolder";
		this.tbBaseFolder.Size = new System.Drawing.Size(423, 20);
		this.tbBaseFolder.TabIndex = 4;
		this.tbBaseFolder.TextChanged += new System.EventHandler(tbBaseFolder_TextChanged);
		this.btnBaseFolderBrower.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.btnBaseFolderBrower.Location = new System.Drawing.Point(591, 146);
		this.btnBaseFolderBrower.Name = "btnBaseFolderBrower";
		this.btnBaseFolderBrower.Size = new System.Drawing.Size(44, 23);
		this.btnBaseFolderBrower.TabIndex = 5;
		this.btnBaseFolderBrower.Text = "...";
		this.btnBaseFolderBrower.UseVisualStyleBackColor = true;
		this.btnBaseFolderBrower.Click += new System.EventHandler(btnBaseFolderBrower_Click);
		this.label1.AutoSize = true;
		this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label1.Location = new System.Drawing.Point(54, 151);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(93, 16);
		this.label1.TabIndex = 6;
		this.label1.Text = "Base Folder";
		this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
		this.toolTip1.SetToolTip(this.label1, "Must configure. Base folder for all log files");
		this.tbSubFolder.Location = new System.Drawing.Point(149, 181);
		this.tbSubFolder.Name = "tbSubFolder";
		this.tbSubFolder.Size = new System.Drawing.Size(423, 20);
		this.tbSubFolder.TabIndex = 4;
		this.tbSubFolder.TextChanged += new System.EventHandler(tbSubFolder_TextChanged);
		this.label3.AutoSize = true;
		this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label3.Location = new System.Drawing.Point(54, 289);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(77, 16);
		this.label3.TabIndex = 6;
		this.label3.Text = "Log Flags";
		this.toolTip1.SetToolTip(this.label3, "Log flags for log type");
		this.cbLogOnErrOnly.AutoSize = true;
		this.cbLogOnErrOnly.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.cbLogOnErrOnly.Location = new System.Drawing.Point(54, 428);
		this.cbLogOnErrOnly.Name = "cbLogOnErrOnly";
		this.cbLogOnErrOnly.Size = new System.Drawing.Size(149, 20);
		this.cbLogOnErrOnly.TabIndex = 7;
		this.cbLogOnErrOnly.Text = "Log On Error Only";
		this.toolTip1.SetToolTip(this.cbLogOnErrOnly, "Write-On-Error, generate logs only when there is an error when it's true");
		this.cbLogOnErrOnly.UseVisualStyleBackColor = true;
		this.panel2.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
		this.panel2.Location = new System.Drawing.Point(10, 278);
		this.panel2.Name = "panel2";
		this.panel2.Size = new System.Drawing.Size(625, 1);
		this.panel2.TabIndex = 4;
		this.tbFileName.Location = new System.Drawing.Point(149, 212);
		this.tbFileName.Name = "tbFileName";
		this.tbFileName.Size = new System.Drawing.Size(423, 20);
		this.tbFileName.TabIndex = 8;
		this.tbFileName.TextChanged += new System.EventHandler(tbFileName_TextChanged);
		this.btnSubFolder.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.btnSubFolder.Location = new System.Drawing.Point(591, 178);
		this.btnSubFolder.Name = "btnSubFolder";
		this.btnSubFolder.Size = new System.Drawing.Size(44, 23);
		this.btnSubFolder.TabIndex = 5;
		this.btnSubFolder.Text = "<<";
		this.btnSubFolder.UseVisualStyleBackColor = true;
		this.btnSubFolder.Click += new System.EventHandler(btnSubFolder_Click);
		this.btnFileName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.btnFileName.Location = new System.Drawing.Point(591, 212);
		this.btnFileName.Name = "btnFileName";
		this.btnFileName.Size = new System.Drawing.Size(44, 23);
		this.btnFileName.TabIndex = 5;
		this.btnFileName.Text = "<<";
		this.btnFileName.UseVisualStyleBackColor = true;
		this.btnFileName.Click += new System.EventHandler(btnFileName_Click);
		this.btnResetAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.btnResetAll.Location = new System.Drawing.Point(284, 423);
		this.btnResetAll.Name = "btnResetAll";
		this.btnResetAll.Size = new System.Drawing.Size(112, 29);
		this.btnResetAll.TabIndex = 5;
		this.btnResetAll.Text = "Reset All";
		this.btnResetAll.UseVisualStyleBackColor = true;
		this.btnResetAll.Click += new System.EventHandler(btnResetAll_Click);
		this.btnStylesheetFolder.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.btnStylesheetFolder.Location = new System.Drawing.Point(591, 382);
		this.btnStylesheetFolder.Name = "btnStylesheetFolder";
		this.btnStylesheetFolder.Size = new System.Drawing.Size(44, 23);
		this.btnStylesheetFolder.TabIndex = 5;
		this.btnStylesheetFolder.Text = "...";
		this.toolTip1.SetToolTip(this.btnStylesheetFolder, "Folder which contains the stylesheets to be used for transforming XML log files");
		this.btnStylesheetFolder.UseVisualStyleBackColor = true;
		this.btnStylesheetFolder.Click += new System.EventHandler(btnStylesheetFolder_Click);
		this.label5.AutoSize = true;
		this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label5.Location = new System.Drawing.Point(54, 185);
		this.label5.Name = "label5";
		this.label5.Size = new System.Drawing.Size(92, 16);
		this.label5.TabIndex = 6;
		this.label5.Text = "Sub   Folder";
		this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
		this.toolTip1.SetToolTip(this.label5, "Optional to configure. Empty if no need this folder level.");
		this.label6.AutoSize = true;
		this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label6.Location = new System.Drawing.Point(54, 216);
		this.label6.Name = "label6";
		this.label6.Size = new System.Drawing.Size(87, 16);
		this.label6.TabIndex = 6;
		this.label6.Text = "File   Name";
		this.toolTip1.SetToolTip(this.label6, "Optional to configure. File Name format. Empty for keep file name default.");
		this.label2.AutoSize = true;
		this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label2.Location = new System.Drawing.Point(50, 378);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(81, 32);
		this.label2.TabIndex = 6;
		this.label2.Text = "Stylesheet\r\n Folder";
		this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
		this.toolTip1.SetToolTip(this.label2, "Optional to configure. SUITE dlls use the stylesheet to format test data.");
		this.tbStylesheetFolder.Location = new System.Drawing.Point(149, 384);
		this.tbStylesheetFolder.Name = "tbStylesheetFolder";
		this.tbStylesheetFolder.Size = new System.Drawing.Size(423, 20);
		this.tbStylesheetFolder.TabIndex = 4;
		this.tbStylesheetFolder.TextChanged += new System.EventHandler(tbStylesheetFolder_TextChanged);
		this.label4.AutoSize = true;
		this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label4.ForeColor = System.Drawing.SystemColors.Highlight;
		this.label4.Location = new System.Drawing.Point(3, 56);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(187, 16);
		this.label4.TabIndex = 6;
		this.label4.Text = "Log folder and file naming";
		this.tbPreview.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.tbPreview.ForeColor = System.Drawing.SystemColors.ActiveCaption;
		this.tbPreview.Location = new System.Drawing.Point(54, 93);
		this.tbPreview.Multiline = true;
		this.tbPreview.Name = "tbPreview";
		this.tbPreview.ReadOnly = true;
		this.tbPreview.Size = new System.Drawing.Size(580, 47);
		this.tbPreview.TabIndex = 8;
		this.panel4.BackColor = System.Drawing.SystemColors.Highlight;
		this.panel4.Location = new System.Drawing.Point(30, 84);
		this.panel4.Name = "panel4";
		this.panel4.Size = new System.Drawing.Size(1, 140);
		this.panel4.TabIndex = 4;
		this.panel6.BackColor = System.Drawing.SystemColors.Highlight;
		this.panel6.Location = new System.Drawing.Point(37, 158);
		this.panel6.Name = "panel6";
		this.panel6.Size = new System.Drawing.Size(16, 1);
		this.panel6.TabIndex = 6;
		this.panel5.BackColor = System.Drawing.SystemColors.Highlight;
		this.panel5.Location = new System.Drawing.Point(37, 192);
		this.panel5.Name = "panel5";
		this.panel5.Size = new System.Drawing.Size(16, 1);
		this.panel5.TabIndex = 6;
		this.panel7.BackColor = System.Drawing.SystemColors.Highlight;
		this.panel7.Location = new System.Drawing.Point(37, 224);
		this.panel7.Name = "panel7";
		this.panel7.Size = new System.Drawing.Size(16, 1);
		this.panel7.TabIndex = 6;
		this.label8.AutoSize = true;
		this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.label8.Location = new System.Drawing.Point(51, 77);
		this.label8.Name = "label8";
		this.label8.Size = new System.Drawing.Size(45, 13);
		this.label8.TabIndex = 6;
		this.label8.Text = "Preview";
		this.cbCreateFolderForEachLogFlag.AutoSize = true;
		this.cbCreateFolderForEachLogFlag.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.cbCreateFolderForEachLogFlag.Location = new System.Drawing.Point(53, 249);
		this.cbCreateFolderForEachLogFlag.Name = "cbCreateFolderForEachLogFlag";
		this.cbCreateFolderForEachLogFlag.Size = new System.Drawing.Size(253, 20);
		this.cbCreateFolderForEachLogFlag.TabIndex = 7;
		this.cbCreateFolderForEachLogFlag.Text = "Create Folder For Each Log Flag";
		this.toolTip1.SetToolTip(this.cbCreateFolderForEachLogFlag, "Create folders for all types of logs or not.");
		this.cbCreateFolderForEachLogFlag.UseVisualStyleBackColor = true;
		this.cbCreateFolderForEachLogFlag.CheckedChanged += new System.EventHandler(cbCreateFolderForEachLogFlag_CheckedChanged);
		this.errorProvider1.ContainerControl = this;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.Controls.Add(this.panel7);
		base.Controls.Add(this.panel5);
		base.Controls.Add(this.panel6);
		base.Controls.Add(this.tbPreview);
		base.Controls.Add(this.tbFileName);
		base.Controls.Add(this.panel4);
		base.Controls.Add(this.panel2);
		base.Controls.Add(this.cbCreateFolderForEachLogFlag);
		base.Controls.Add(this.cbLogOnErrOnly);
		base.Controls.Add(this.label3);
		base.Controls.Add(this.label4);
		base.Controls.Add(this.label8);
		base.Controls.Add(this.label2);
		base.Controls.Add(this.label6);
		base.Controls.Add(this.label5);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.tbSubFolder);
		base.Controls.Add(this.btnFileName);
		base.Controls.Add(this.btnSubFolder);
		base.Controls.Add(this.btnResetAll);
		base.Controls.Add(this.btnStylesheetFolder);
		base.Controls.Add(this.btnBaseFolderBrower);
		base.Controls.Add(this.tbStylesheetFolder);
		base.Controls.Add(this.tbBaseFolder);
		base.Controls.Add(this.panel1);
		base.Controls.Add(this.clbLogType);
		base.Controls.Add(this.cbUseGlobalSettings);
		base.Name = "LoggingConfigPanel";
		base.Size = new System.Drawing.Size(643, 471);
		this.cmsLogTypeList.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).EndInit();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
