using System;
using System.IO;
using System.Windows.Forms;
using QC.QTMInterface;

namespace QC.TestResultsLite;

[Serializable]
public class SerialConfig
{
	public enum ViewTypes
	{
		SingleUnitView,
		AllUnitsInOneSheet,
		NoExcelLogging,
		SingleUnitWideView
	}

	public enum FileOptions
	{
		NewFile,
		AppendFile,
		AllInOneSheet
	}

	public enum AllUnitsFormatOptions
	{
		WideFormat,
		LongFormat,
		LongWideFormat
	}

	private string excelTemplate = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), Path.Combine(GlobalInformation.RunTimeConfig.xlTemplatesDirectory, "StatsTemplate.xlt")));

	private string groupName = "DefaultGroup";

	private string outputFile = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), Path.Combine(GlobalInformation.RunTimeConfig.logDirectory, "DefaultXls.xls")));

	private string excelFileName = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), Path.Combine(GlobalInformation.RunTimeConfig.logDirectory, "DefaultTestResult.xls")));

	private string fileLocation = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), GlobalInformation.RunTimeConfig.logDirectory));

	private ViewTypes viewType = ViewTypes.NoExcelLogging;

	private FileOptions fileOption;

	private AllUnitsFormatOptions allUnitsFormatOption = AllUnitsFormatOptions.LongFormat;

	private bool bEnableExcelLog = true;

	private bool promptInvalidGroupName = true;

	private bool showCharValue = true;

	private bool enableGrid = true;

	private bool enableExcelCellColoring = true;

	private int maxVisibleArraySize = 10;

	private bool autoScrollGrid = true;

	private bool enableVisibleArraySize;

	private bool showTestsWithoutParameters;

	private bool showLinkedTreeNameColumn;

	private bool openExcelAfterTestRun = true;

	private string linesToKeep = "ALL";

	private bool enableCsvLog;

	private string xmlPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), GlobalInformation.RunTimeConfig.logDirectory));

	private bool writeXml;

	public string ExcelTemplate
	{
		get
		{
			return excelTemplate;
		}
		set
		{
			excelTemplate = value;
		}
	}

	public string GroupName
	{
		get
		{
			return groupName;
		}
		set
		{
			groupName = value;
		}
	}

	public bool EnableExcelLog
	{
		get
		{
			return bEnableExcelLog;
		}
		set
		{
			bEnableExcelLog = value;
		}
	}

	public string OutputFile
	{
		get
		{
			return outputFile;
		}
		set
		{
			outputFile = value;
		}
	}

	public string ExcelFileName
	{
		get
		{
			return excelFileName;
		}
		set
		{
			excelFileName = value;
		}
	}

	public string XmlPath
	{
		get
		{
			return xmlPath;
		}
		set
		{
			xmlPath = value;
		}
	}

	public bool WriteXml
	{
		get
		{
			return writeXml;
		}
		set
		{
			writeXml = value;
		}
	}

	public string FileLocation
	{
		get
		{
			return fileLocation;
		}
		set
		{
			fileLocation = value;
		}
	}

	public ViewTypes ViewType
	{
		get
		{
			return viewType;
		}
		set
		{
			viewType = value;
		}
	}

	public FileOptions FileOption
	{
		get
		{
			return fileOption;
		}
		set
		{
			fileOption = value;
		}
	}

	public AllUnitsFormatOptions AllUnitsFormatOption
	{
		get
		{
			return allUnitsFormatOption;
		}
		set
		{
			allUnitsFormatOption = value;
		}
	}

	public bool PromptInvalidGroupName
	{
		get
		{
			return promptInvalidGroupName;
		}
		set
		{
			promptInvalidGroupName = value;
		}
	}

	public bool ShowCharValue
	{
		get
		{
			return showCharValue;
		}
		set
		{
			showCharValue = value;
		}
	}

	public bool EnableGrid
	{
		get
		{
			return enableGrid;
		}
		set
		{
			enableGrid = value;
		}
	}

	public bool EnableExcelCellColoring
	{
		get
		{
			return enableExcelCellColoring;
		}
		set
		{
			enableExcelCellColoring = value;
		}
	}

	public int MaxVisibleArraySize
	{
		get
		{
			return maxVisibleArraySize;
		}
		set
		{
			maxVisibleArraySize = value;
		}
	}

	public bool AutoScrollGrid
	{
		get
		{
			return autoScrollGrid;
		}
		set
		{
			autoScrollGrid = value;
		}
	}

	public bool EnableVisibleArraySize
	{
		get
		{
			return enableVisibleArraySize;
		}
		set
		{
			enableVisibleArraySize = value;
		}
	}

	public bool ShowTestsWithoutParameters
	{
		get
		{
			return showTestsWithoutParameters;
		}
		set
		{
			showTestsWithoutParameters = value;
		}
	}

	public bool ShowLinkedTreeNameColumn
	{
		get
		{
			return showLinkedTreeNameColumn;
		}
		set
		{
			showLinkedTreeNameColumn = value;
		}
	}

	public bool OpenExcelAfterTestRun
	{
		get
		{
			return openExcelAfterTestRun;
		}
		set
		{
			openExcelAfterTestRun = value;
		}
	}

	public string LinesToKeep
	{
		get
		{
			return linesToKeep;
		}
		set
		{
			linesToKeep = value;
		}
	}

	public bool EnableCSVLog
	{
		get
		{
			return enableCsvLog;
		}
		set
		{
			enableCsvLog = value;
		}
	}

	public static bool ValidateGroupName(string GroupName)
	{
		char[] anyOf = new char[2] { ' ', '_' };
		if (GroupName.Trim().Length == 0)
		{
			MessageBox.Show("Group Name cannot be empty", "Error In Group Name");
			return false;
		}
		if (GroupName.IndexOfAny(anyOf) > 0)
		{
			MessageBox.Show("Invalid chars found", "Error In Group Name");
			return false;
		}
		return true;
	}
}
