GXMacDirectTable[] SetDirectTable(IEnumerable <object> value) { List <GXMacDirectTable> data = new List <GXMacDirectTable>(); if (value != null) { foreach (object tmp in value) { List <object> it; if (tmp is List <object> ) { it = (List <object>)tmp; } else { it = new List <object>((object[])tmp); } GXMacDirectTable v = new GXMacDirectTable(); v.SourceSId = Convert.ToInt16(it[0]); v.SourceLnId = Convert.ToInt16(it[1]); v.SourceLcId = Convert.ToInt16(it[2]); v.DestinationSId = Convert.ToInt16(it[3]); v.DestinationLnId = Convert.ToInt16(it[4]); v.DestinationLcId = Convert.ToInt16(it[5]); v.Did = (byte[])it[6]; data.Add(v); } } return(data.ToArray()); }
private GXMacDirectTable[] LoadDirectTable(GXXmlReader reader) { List <GXMacDirectTable> list = new List <GXMacDirectTable>(); if (reader.IsStartElement("DirectTable", true)) { while (reader.IsStartElement("Item", true)) { GXMacDirectTable it = new GXMacDirectTable(); list.Add(it); it.SourceSId = (Int16)reader.ReadElementContentAsInt("SourceSId"); it.SourceLnId = (Int16)reader.ReadElementContentAsInt("SourceLnId"); it.SourceLcId = (Int16)reader.ReadElementContentAsInt("SourceLcId"); it.DestinationSId = (Int16)reader.ReadElementContentAsInt("DestinationSId"); it.DestinationLnId = (Int16)reader.ReadElementContentAsInt("DestinationLnId"); it.DestinationLcId = (Int16)reader.ReadElementContentAsInt("DestinationLcId"); it.Did = GXCommon.HexToBytes(reader.ReadElementContentAsString("Did")); } reader.ReadEndElement("DirectTable"); } return(list.ToArray()); }