Пример #1
0
        public bool DeleteProgrammeNodeByTimeExact(string start, string channel)
        {
            try
            {
                if (channel == null || start == null || channel == string.Empty || start == string.Empty)
                {
                    return(false);
                }

                if (!xmlData.channelData.ContainsKey(channel))
                {
                    return(false);
                }

                var startTime = XmlTV.StringToDate(start).UtcDateTime;
                if (!xmlData.channelData[channel].programmeNodes.ContainsKey(startTime))
                {
                    return(false);
                }

                xmlData.channelData[channel].programmeNodes.Remove(startTime);
                return(true);
            }
            catch (System.Exception ex)
            {
                addError(ex);
            }
            return(false);
        }
Пример #2
0
        public IEnumerable <XmlNode> FindMatchingProgrammeNodes(ProgrammeSearch[] searchItems)
        {
            var programmeNodes = new List <XmlNode>();

            var channelList = xmlData.channelData.Keys.Intersect(searchItems.Select(line => line.Channel));

            foreach (var channelItem in channelList)
            {
                programmeNodes.AddRange
                (
                    from searchItem in searchItems
                    join programmeNode in xmlData.channelData[channelItem].programmeNodes
                    on XmlTV.StringToDate(searchItem.Start).UtcDateTime equals programmeNode.Key
                    select programmeNode.Value
                );
            }
            return(programmeNodes.AsEnumerable());
        }