Esempio n. 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);
                        }
                    }
                }
            }
        }
Esempio n. 2
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);
                        }
                    }
                }
            }
        }