Ejemplo n.º 1
0
        public void editToMadara(serviceFormat service)
        {
            epgEventTime             current = new epgEventTime(DateTime.MinValue);
            List <outputFormatBasic> eventList;
            Int32 counter = 0;

            this.service = service;

            Int32 serviceTotalNum = 1 /* primary */ + service.children.Count();

            while ((eventList = getNextEvent(service, current)).Count != 0)
            {
                // eventList には、各サービスの current 時刻以降で最も近いevent が並んでいる。
                // このうち、「eventtime」が同じで「duration」も同じevent が並んでいたら、
                // それを「まだら」にする。
                if (eventList.Count == 1)
                {
                    current = eventList[0].eventtime;
                    continue;
                }


                // eventtimeのうち最小のイベントを抽出
                DateTime          thisCurrent = DateTime.MaxValue;
                outputFormatBasic target      = null;
                foreach (outputFormatBasic x in eventList)
                {
                    if (x.eventtime.value < thisCurrent)
                    {
                        target      = x;
                        thisCurrent = x.eventtime.value;
                    }
                }
                current.value = thisCurrent;
                if (target == null)
                {
                    continue;
                }

                // その eventtime と duration が同じeventをさがしてみる
                var list = from x in eventList
                           where x.eventtime.value == target.eventtime.value && x.duration.value == target.duration.value
                           select x;

                // そのeventtime の時間の eventlist全部も作る。
                List <outputFormatBasic> alllist = this.getEventListsCurrent(current.value, service);

                if (list.Count() > 1) // まだらに出来るぞ!
                {
                    this.setMadara(list.ToList <outputFormatBasic>(), alllist.ToList <outputFormatBasic>(), counter);
                }
                counter++;
            }
        }
Ejemplo n.º 2
0
        public outputFormatBasic(int net, serviceFormat service, ExchangeLetter ex)
        {
            this.service   = service;
            this.networkid = new epgNetowrkId(net);
            this.serviceid = new epgServiceId(service.serviceId.value);
            this.eventid   = new epgEventId(1);
            this.eventtime = new epgEventTime();
            this.duration  = new epgDuration(0);
            this.title     = new epgTitle("", ex);
            this.contents  = new epgDescribe("", ex);
            this.payment   = new epgPayment(0);

            this.exchangeLetter = ex;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// service.outList, child[].outList の イベントについて
        /// サービス毎の startTime以降で最も「近い」イベントの epgEventTime を配列にして返す
        /// </summary>
        /// <param name="service"></param>
        /// <returns></returns>
        private List <outputFormatBasic> getNextEvent(serviceFormat service, epgEventTime startEvtTime)
        {
            List <outputFormatBasic> eventList = new List <outputFormatBasic>();
            outputFormatBasic        p;

            p = this.getEventListLater(service.outList, startEvtTime);
            if (p != null)
            {
                eventList.Add(p);
            }

            for (Int32 i = 0; i < service.children.Count; i++)
            {
                p = this.getEventListLater(service.children[i].outList, startEvtTime);
                if (p != null)
                {
                    eventList.Add(p);
                }
            }

            return(eventList);
        }
Ejemplo n.º 4
0
        private outputFormatBasic getEventListLater(List <outputFormatBasic> outList, epgEventTime startEvtTime)
        {
            var obj = (from p in outList
                       where startEvtTime.value < p.eventtime.value
                       orderby p.eventtime.value
                       select p).Take(1);

            foreach (outputFormatBasic ret in obj)
            {
                return(ret as outputFormatBasic);
            }
            return(null);
        }