using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using SystemX.Common.Protocol.SIA; using SystemX.Net.BaseProtocol; using SystemX.Net.Schedule; using static SystemX.Net.MiddlewareUI.MainForm; namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method { public interface IProtocol { } public class ProtocolShell { public MainForm Parent_; protected CustomProtocol_ cp = new CustomProtocol_(); protected int nPos; protected byte nLabel; protected byte[] ucSendByteInfo; protected List getStreamList; protected bool bThisShellSendOn; public bool GetShellSendOnState() { return bThisShellSendOn; } public byte[] ArrSendByte(int nPos = 0) { if (IsByteList == false) return ucSendByteInfo; else return getStreamList.ElementAt(nPos); } public bool IsByteList { protected set; get; } public int nByteListSize { protected set; get; } public ProtocolShell(MainForm parent, int iPos, byte nLabel) { this.bThisShellSendOn = true; this.IsByteList = false; this.nByteListSize = 0; this.Parent_ = parent; this.nPos = iPos; this.nLabel = nLabel; } protected string GetTableValue(DataSet ds, string strParam1) { string strValue = string.Empty; if (strParam1.Length > 0) { int nIndex = int.MaxValue; if (int.TryParse(strParam1, out nIndex)) strValue = ds.Tables[0].Rows[0][nIndex].ToString(); else strValue = ds.Tables[0].Rows[0][strParam1].ToString(); } else strValue = ds.Tables[0].Rows[0][0].ToString(); return strValue; } public virtual void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL, BASE_PROTOCOL.PROTOCOL_CODE CODE, HEADER_PACKET getHeader, object objData){ /*Virtual*/ } } }