namespace IOB_UT_NEXT
{
    public class ByteDataConverter
    {
        public class MemStruct
        {
            /// <summary>
            /// Init oggetto da string di configurazione
            /// </summary>
            /// <param name="rawVal"></param>
            /// <param name="cSep"></param>
            public MemStruct(string rawVal, char cSep)
            {
                string[] sList = rawVal.Split(cSep);
                // solo se son 3 parti...
                if (sList.Length > 2)
                {
                    this.Product = sList[0];
                    this.Type = sList[1];
                    int index = 0;
                    if(int.TryParse(sList[2], out index))
                    {
                        this.Idx = index;
                    }
                }
                // se ho anche bit idx...
                if (sList.Length > 3)
                {
                    int bId = 0;
                    if (int.TryParse(sList[3], out bId))
                    {
                        this.Num = bId;
                    }
                }
                }
            public string Product { get; set; } = "ND";
            public string Type { get; set; } = "ND";
            public int Idx { get; set; } = 0;
            public int Num { get; set; } = 0;
        }
    }
}
