using System.Collections;
using QC.QTMDotNetKernelInterface;

namespace QC.GlobalVariableManager;

public class QTMGlobalVariable
{
	public static Hashtable GVariables
	{
		get
		{
			return GlobalVariable.GVariables;
		}
		set
		{
			GlobalVariable.GVariables = value;
		}
	}

	public static ArrayList SortedGVNames => GlobalVariable.SortedGVNames;

	public static event QTMGlobalVariablesChangedDelegate OnGlobalVariableChange;

	private QTMGlobalVariable()
	{
	}

	static QTMGlobalVariable()
	{
		GlobalVariable.OnGlobalVariableChange += GlobalVariable_OnGlobalVariableChange;
	}

	private static void GlobalVariable_OnGlobalVariableChange(object sender, GlobalVariableEventArgs e)
	{
		try
		{
			if (QTMGlobalVariable.OnGlobalVariableChange != null)
			{
				QTMGlobalVariable.OnGlobalVariableChange(null, new QTMGlobalVariableEventArgs());
			}
		}
		catch
		{
		}
	}

	public static Hashtable GetGVariablesById(string id)
	{
		return GlobalVariable.GetGVariablesById(id);
	}

	public static bool SetGlobalVariableObject(string gvName, object gvValue)
	{
		return GlobalVariable.SetGlobalVariableObject(gvName.Trim(), gvValue);
	}

	public static bool SetGlobalVariable(string gvName, string gvValue)
	{
		return GlobalVariable.SetGlobalVariable(gvName, gvValue);
	}

	public static bool SetGlobalVariable(string gvName, string gvValue, string id)
	{
		return GlobalVariable.SetGlobalVariable(gvName, gvValue, id);
	}

	public static bool GetGlobalVariable(string gvName, out string gvValue)
	{
		return GlobalVariable.GetGlobalVariable(gvName, out gvValue);
	}

	public static bool GetGlobalVariable(string gvName, out string gvValue, string id)
	{
		return GlobalVariable.GetGlobalVariable(gvName, out gvValue, id);
	}

	public static bool GetGlobalVariableObject(string gvName, out object gvValue)
	{
		return GlobalVariable.GetGlobalVariableObject(gvName, out gvValue);
	}

	public static bool Contains(string gvName)
	{
		return GlobalVariable.Contains(gvName);
	}

	public static bool GetGlobalVariableForSN(string SN, string gvName, out string gvValue)
	{
		return GlobalVariable.GetGlobalVariableForSN(SN, gvName, out gvValue);
	}

	public static void ResetErrorCode()
	{
		GlobalVariable.ResetErrorCode();
	}

	public static bool SetErrorCode(string errorCode)
	{
		return GlobalVariable.SetErrorCode(errorCode);
	}

	public static string GetErrorCode()
	{
		return GlobalVariable.GetErrorCode();
	}
}
