using System;
using System.Collections;
using System.Xml.Serialization;
using QC.QsprShared.Trace;

namespace QC.QsprTestObjects.Tests.Base;

[Serializable]
public class TestTreeInfo
{
	public const double CURRENT_TREE_VERSION = 13.0;

	public const string SOURCE_APPLICATION = "QSPR";

	private ArrayList globalIncludeList = new ArrayList();

	private ArrayList globalExcludeList = new ArrayList();

	private GlobalVariables qGlobalVariables = new GlobalVariables();

	private double testTreeVersion = 1.0;

	public double TestTreeVersion
	{
		get
		{
			return testTreeVersion;
		}
		set
		{
			testTreeVersion = value;
		}
	}

	public string SourceApplication
	{
		get
		{
			return "QSPR";
		}
		set
		{
		}
	}

	[XmlElement(Type = typeof(string))]
	public ArrayList GlobalIncludeList
	{
		get
		{
			return globalIncludeList;
		}
		set
		{
			globalIncludeList = value;
		}
	}

	[XmlElement(Type = typeof(string))]
	public ArrayList GlobalExcludeList
	{
		get
		{
			return globalExcludeList;
		}
		set
		{
			globalExcludeList = value;
		}
	}

	public GlobalVariables QGlobalVariables
	{
		get
		{
			return qGlobalVariables;
		}
		set
		{
			qGlobalVariables = value;
		}
	}

	public bool IncludeLoggingGlobally(string pName)
	{
		try
		{
			if (globalExcludeList.Contains(pName.Trim()))
			{
				globalExcludeList.Remove(pName.Trim());
			}
			if (!globalIncludeList.Contains(pName.Trim()))
			{
				globalIncludeList.Add(pName.Trim());
			}
			return true;
		}
		catch (Exception ex)
		{
			TraceMessage.Write(ToString(), "IncludeLoggingGlobally " + ex.Message, TraceMessageType.Exception);
		}
		return false;
	}

	public bool ExcludeLoggingGlobally(string pName)
	{
		try
		{
			if (globalIncludeList.Contains(pName.Trim()))
			{
				globalIncludeList.Remove(pName.Trim());
			}
			if (!globalExcludeList.Contains(pName.Trim()))
			{
				globalExcludeList.Add(pName.Trim());
			}
			return true;
		}
		catch (Exception ex)
		{
			TraceMessage.Write(ToString(), "ExcludeLoggingGlobally " + ex.Message, TraceMessageType.Exception);
		}
		return false;
	}
}
