using QSC_Params_File_Helper;

namespace QFDT_Components;

public class QSCXMLHelper
{
	public static string getMiddleChan(string channelList)
	{
		string[] array = channelList.Split(',');
		int num = array.Length / 2;
		string text = null;
		text = array[num];
		if (text.Length > 5 && num - 1 > -1)
		{
			text = array[num - 1];
		}
		return text;
	}

	public static string GetTxChannelList(string tech, string band, string subband, string QSCXMLPath)
	{
		string calInfo = null;
		QSC_Param_Query qSC_Param_Query = new QSC_Param_Query();
		string exceptionMessage = "";
		if (qSC_Param_Query.LoadQSCParamsFile(QSCXMLPath, ref exceptionMessage) && !qSC_Param_Query.Get_Channel_List_From_UnConnected_Nodes(tech, band, subband, ref calInfo))
		{
			calInfo = null;
		}
		return calInfo;
	}

	public static string GetRxChannelList(string tech, string band, string subband, string QSCXMLPath)
	{
		string calInfo = null;
		QSC_Param_Query qSC_Param_Query = new QSC_Param_Query();
		string exceptionMessage = "";
		if (qSC_Param_Query.LoadQSCParamsFile(QSCXMLPath, ref exceptionMessage) && !qSC_Param_Query.Get_DLChan_List_From_Connected_Nodes(tech, band, subband, ref calInfo))
		{
			calInfo = null;
		}
		return calInfo;
	}

	public static string GetRxCalInfoParamsList(string tech, string band, string subband, string QSCXMLPath, QSC_Param_Query.RxCalParameterType type)
	{
		string calInfo = null;
		QSC_Param_Query qSC_Param_Query = new QSC_Param_Query();
		string exceptionMessage = "";
		if (qSC_Param_Query.LoadQSCParamsFile(QSCXMLPath, ref exceptionMessage) && !qSC_Param_Query.Get_Rx_Gain_Info_By_Type_V2(tech, band, subband, type, ref calInfo))
		{
			calInfo = null;
		}
		return calInfo;
	}

	public static string GetChannelList(string tech, string band, string QSCXMLPath)
	{
		string calInfo = null;
		QSC_Param_Query qSC_Param_Query = new QSC_Param_Query();
		string exceptionMessage = "";
		if (qSC_Param_Query.LoadQSCParamsFile(QSCXMLPath, ref exceptionMessage) && !qSC_Param_Query.Get_Channel_List(tech, band, ref calInfo))
		{
			calInfo = null;
		}
		return calInfo;
	}

	public static string getFirstElementFromList(string paramsList, char splitSymbol = ',')
	{
		string[] array = paramsList.Split(splitSymbol);
		if (array.Length > 0)
		{
			return array[0];
		}
		return null;
	}

	public static string GetFBRxCalParamsList(string tech, string band, string QSCXMLPath, QSC_Param_Query.FBRxInfoParameterType type)
	{
		string calInfo = null;
		QSC_Param_Query qSC_Param_Query = new QSC_Param_Query();
		string exceptionMessage = "";
		if (qSC_Param_Query.LoadQSCParamsFile(QSCXMLPath, ref exceptionMessage) && !qSC_Param_Query.Get_FBRx_Cal_Info_By_Type(tech, band, type, ref calInfo))
		{
			calInfo = null;
		}
		return calInfo;
	}

	public static string GetTxLinearizerCalParamsList(string tech, string band, string sub_band, string QSCXMLPath, QSC_Param_Query.TxLineaizerCalParameterType type)
	{
		string calInfo = null;
		QSC_Param_Query qSC_Param_Query = new QSC_Param_Query();
		string exceptionMessage = "";
		if (qSC_Param_Query.LoadQSCParamsFile(QSCXMLPath, ref exceptionMessage) && !qSC_Param_Query.Get_Tx_Cal_Info_By_Type(tech, band, sub_band, type, ref calInfo))
		{
			calInfo = null;
		}
		return calInfo;
	}
}
