예제 #1
0
        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);
                        }
                    }
                }
            }
        }
예제 #2
0
        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);
                        }
                    }
                }
            }
        }
예제 #3
0
        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);
                        }
                    }
                }
            }
        }