using System;
using System.Collections;
using System.Xml.Serialization;

namespace QC.QSPRTreeSchemaLibrary;

public class LoopScenarioValues
{
	private const string INPUT_PARAMETER = "INPUT";

	public const string DESCRIPTION_STRING_SEPARATOR = ";";

	private ArrayList loopConditions = new ArrayList();

	private ArrayList loopSelections = new ArrayList();

	private ArrayList loopDescriptions = new ArrayList();

	private ArrayList loopDontRunConds = new ArrayList();

	private ConditionMgr scenarioConditionMgr;

	[XmlElement(Type = typeof(LoopCondition))]
	public ArrayList LoopConditions
	{
		get
		{
			return loopConditions;
		}
		set
		{
			loopConditions = value;
		}
	}

	[XmlIgnore]
	public ArrayList DontRunCondition
	{
		get
		{
			return loopDontRunConds;
		}
		set
		{
			loopDontRunConds = value;
		}
	}

	public string DontRunConditionAsString
	{
		get
		{
			string text = "";
			if (loopDontRunConds.Count > 0)
			{
				for (int i = 0; i < loopDontRunConds.Count - 1; i++)
				{
					text = string.Concat(text, loopDontRunConds[i], ",");
				}
				text += loopDontRunConds[loopDontRunConds.Count - 1];
			}
			return text;
		}
		set
		{
			try
			{
				string[] array = value.Split(',');
				string[] array2 = array;
				foreach (string value2 in array2)
				{
					try
					{
						loopDontRunConds.Add(value2);
					}
					catch (Exception ex)
					{
						throw new Exception(ex.Message);
					}
				}
			}
			catch (Exception ex2)
			{
				throw new Exception(ex2.Message);
			}
		}
	}

	[XmlIgnore]
	public ArrayList ConditionCheck
	{
		get
		{
			return loopSelections;
		}
		set
		{
			loopSelections = value;
		}
	}

	public string ConditionCheckAsString
	{
		get
		{
			string text = "";
			if (loopSelections.Count > 0)
			{
				for (int i = 0; i < loopSelections.Count - 1; i++)
				{
					text = string.Concat(text, loopSelections[i], ",");
				}
				text += loopSelections[loopSelections.Count - 1];
			}
			return text;
		}
		set
		{
			try
			{
				string[] array = value.Split(',');
				string[] array2 = array;
				foreach (string value2 in array2)
				{
					try
					{
						loopSelections.Add(bool.Parse(value2));
					}
					catch (Exception ex)
					{
						throw new Exception(ex.Message);
					}
				}
			}
			catch (Exception ex2)
			{
				throw new Exception(ex2.Message);
			}
		}
	}

	[XmlIgnore]
	public ArrayList Descriptions
	{
		get
		{
			return loopDescriptions;
		}
		set
		{
			loopDescriptions = value;
		}
	}

	public string DescriptionsAsString
	{
		get
		{
			string text = "";
			if (loopDescriptions.Count > 0)
			{
				for (int i = 0; i < loopDescriptions.Count - 1; i++)
				{
					text = string.Concat(text, loopDescriptions[i], ";");
				}
				text += loopDescriptions[loopDescriptions.Count - 1];
			}
			return text;
		}
		set
		{
			try
			{
				string[] array = value.Split(";".ToCharArray()[0]);
				string[] array2 = array;
				foreach (string value2 in array2)
				{
					try
					{
						loopDescriptions.Add(value2);
					}
					catch (Exception ex)
					{
						throw new Exception(ex.Message);
					}
				}
			}
			catch (Exception ex2)
			{
				throw new Exception(ex2.Message);
			}
		}
	}

	[XmlIgnore]
	public int Count => loopConditions.Count;

	public ConditionMgr Condition
	{
		get
		{
			return scenarioConditionMgr;
		}
		set
		{
			scenarioConditionMgr = value;
		}
	}
}
