private void FillFromFunctionList(XMLAPI.FunctionList.FunctionList funcList) { foreach (var function in funcList.Function) { //make sure function names have "func" stripped from it (legacy homematic setup leaves them like this) //also make sure that the name is capitalized. string fn = function.Name.ToLower(); if (fn.StartsWith("func")) { fn = fn.Substring(4); } char[] arr = fn.ToCharArray(); arr[0] = Char.ToUpper(arr[0]); fn = new string(arr); foreach (var channel in function.Channel) { Channel c = null; if (ChannelByISEID.TryGetValue(channel.Ise_id, out c)) { if (!c.Functions.Contains(fn)) { c.Functions.Add(fn); } } } } }
private void FillFromRoomList(XMLAPI.RoomList.RoomList roomList) { foreach (var room in roomList.Room) { string rn = room.Name.Trim(); if (rn.StartsWith("room")) { rn = rn.Substring(4); } foreach (var channel in room.Channel) { Channel c = null; if (ChannelByISEID.TryGetValue(channel.Ise_id, out c)) { if (!c.Rooms.Contains(rn)) { c.Rooms.Add(rn); } } } } }
private void FillFromFunctionList(XMLAPI.FunctionList.FunctionList funcList) { foreach (var function in funcList.Function) { foreach (var channel in function.Channel) { Channel c = null; if (ChannelByISEID.TryGetValue(channel.Ise_id, out c)) { if (!c.Functions.Contains(function.Name)) { string f = function.Name; if (f.StartsWith("func")) { f = f.Substring(4); } c.Functions.Add(f); } } } } }