GXMacAvailableSwitch[] SetAvailableSwitches(IEnumerable <object> value) { List <GXMacAvailableSwitch> data = new List <GXMacAvailableSwitch>(); 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); } GXMacAvailableSwitch v = new GXMacAvailableSwitch(); v.Sna = (byte[])it[0]; v.LsId = Convert.ToInt16(it[1]); v.Level = Convert.ToSByte(it[2]); v.RxLevel = Convert.ToSByte(it[3]); v.RxSnr = Convert.ToSByte(it[4]); data.Add(v); } } return(data.ToArray()); }
private GXMacAvailableSwitch[] LoadAvailableSwitches(GXXmlReader reader) { List <GXMacAvailableSwitch> list = new List <GXMacAvailableSwitch>(); if (reader.IsStartElement("AvailableSwitches", true)) { while (reader.IsStartElement("Item", true)) { GXMacAvailableSwitch it = new GXMacAvailableSwitch(); list.Add(it); it.Sna = GXCommon.HexToBytes(reader.ReadElementContentAsString("Sna")); it.LsId = (Int16)reader.ReadElementContentAsInt("LsId"); it.Level = (sbyte)reader.ReadElementContentAsInt("Level"); it.RxLevel = (sbyte)reader.ReadElementContentAsInt("RxLevel"); it.RxSnr = (sbyte)reader.ReadElementContentAsInt("RxSnr"); } reader.ReadEndElement("AvailableSwitches"); } return(list.ToArray()); }