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

namespace QC.CompareTestTree;

[XmlType(AnonymousType = true)]
public class TestContainers
{
	private string nameField;

	private SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests[] testsField;

	private string targetTypeField;

	private string targetNameField;

	private bool expandedField;

	private string containerTypeField;

	public string Name
	{
		get
		{
			return nameField;
		}
		set
		{
			nameField = value;
		}
	}

	[XmlElement("Tests")]
	public SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests[] Tests
	{
		get
		{
			return testsField;
		}
		set
		{
			testsField = value;
		}
	}

	public string TargetType
	{
		get
		{
			return targetTypeField;
		}
		set
		{
			targetTypeField = value;
		}
	}

	public string TargetName
	{
		get
		{
			return targetNameField;
		}
		set
		{
			targetNameField = value;
		}
	}

	public bool Expanded
	{
		get
		{
			return expandedField;
		}
		set
		{
			expandedField = value;
		}
	}

	public string ContainerType
	{
		get
		{
			return containerTypeField;
		}
		set
		{
			containerTypeField = value;
		}
	}

	public void CompareTestContainers(string xmlNodeName, TestContainers baseContainer, string overrideAttrib, ref XmlDocument xmlDoc, ref XmlElement parentNode)
	{
		XmlElement parentNode2 = xmlDoc.CreateElement(xmlNodeName);
		if (overrideAttrib != null)
		{
			parentNode2.SetAttribute("delta", overrideAttrib);
		}
		CommonFunctions.RootDoc = xmlDoc;
		CommonFunctions.ParentNode = parentNode2;
		CommonFunctions.AddElement("Name", Name, baseContainer.Name, overrideAttrib);
		CommonFunctions.AddElement("TargetType", TargetType, baseContainer.TargetType, overrideAttrib);
		CommonFunctions.AddElement("TargetName", TargetName, baseContainer.TargetName, overrideAttrib);
		CommonFunctions.AddElement("Expanded", Expanded, baseContainer.Expanded, overrideAttrib);
		CommonFunctions.AddElement("ContainerType", ContainerType, baseContainer.ContainerType, overrideAttrib);
		if (baseContainer.Tests != null)
		{
			for (int i = 0; i < baseContainer.Tests.Length; i++)
			{
				SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests = (SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests)baseContainer.Tests.GetValue(i);
				int num = -1;
				SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2;
				if (Tests != null)
				{
					for (int j = 0; j < Tests.Length; j++)
					{
						serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2 = (SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests)Tests.GetValue(j);
						if (serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests.Name == serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2.Name)
						{
							num = j;
							break;
						}
					}
				}
				if (num < 0)
				{
					serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests.CompareRegistryTest("Tests", serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests, "Remove", ref xmlDoc, ref parentNode2);
					continue;
				}
				serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2 = (SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests)Tests.GetValue(num);
				serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2.CompareRegistryTest("Tests", serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests, overrideAttrib, ref xmlDoc, ref parentNode2);
			}
		}
		if (Tests != null)
		{
			for (int i = 0; i < Tests.Length; i++)
			{
				int num = -1;
				SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2 = (SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests)Tests.GetValue(i);
				if (baseContainer.Tests != null)
				{
					for (int j = 0; j < baseContainer.Tests.Length; j++)
					{
						SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests = (SerializeComponentsTheRegistryQTMThisPCTargetTestContainersTests)baseContainer.Tests.GetValue(j);
						if (serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2.Name == serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests.Name)
						{
							num = j;
							break;
						}
					}
				}
				if (num < 0)
				{
					serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2.CompareRegistryTest("Tests", serializeComponentsTheRegistryQTMThisPCTargetTestContainersTests2, "Add", ref xmlDoc, ref parentNode2);
				}
			}
		}
		parentNode.AppendChild(parentNode2);
	}
}
