Beispiel #1
0
        private void createDetailEPG()
        {
            Uri    lUri      = new Uri(vURL);
            string lResponse = SendWebRequest(lUri);

            if (lResponse == "")
            {
                return;
            }
            //XML Elemente durchgehen
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(lResponse);
            XmlElement  root  = doc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("./e2event");

            try
            {
                string title = "";
                //string catIcon = "";
                string zeit      = "";
                string startTime = "";
                string progId    = "";
                //float zeitPzt = 0;
                string   timerNo = "";
                string   text    = "";
                DateTime UnixEpochStart;
                DateTime UnixEpochEnd;
                foreach (XmlNode i in nodes)
                {
                    //Titel auslesen und HTMLKonvertierung durchführen
                    title = i["e2eventtitle"].InnerText;
                    StringWriter myWriter = new StringWriter();
                    HttpUtility.HtmlDecode(title, myWriter);
                    title = myWriter.ToString();
                    //if (i["progress"] != null) { zeitPzt = (float)Convert.ToDouble(i["progress"].InnerText); } else { zeitPzt = 0; }
                    if (i["e2eventid"] != null)
                    {
                        progId = i["e2eventid"].InnerText;
                    }
                    else
                    {
                        progId = "";
                    }
                    //if (i["catIcon"] != null) {
                    //    catIcon = i["catIcon"].InnerText;
                    //    catIcon = catIcon.Replace("/icon/", "");
                    //} else {
                    //    catIcon = "";
                    //}
                    if (i["e2eventstart"] != null)
                    {
                        startTime      = i["e2eventstart"].InnerText;
                        UnixEpochStart = new DateTime(Convert.ToInt64(i["e2eventstart"].InnerText) * 10000000); //Ticks
                        UnixEpochStart = UnixEpochStart.AddYears(1969);
                        UnixEpochStart = UnixEpochStart.AddDays(-1);                                            //16.5. aus irgend einem Grund muss ein tag abgezogen werden
                        if (vDayLightSaving)
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(2);
                        }
                        else
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(1);
                        }                                                                                                                          // Time Offset
                        zeit = String.Format("{0} {1:00}:{2:00}", DateTools.PrintDayOfWeek(UnixEpochStart.DayOfWeek), UnixEpochStart.Hour, UnixEpochStart.Minute);
                    }
                    else
                    {
                        zeit           = "";
                        startTime      = "";
                        UnixEpochStart = new DateTime();
                    }
                    if (i["e2eventduration"] != null)
                    {
                        UnixEpochEnd = UnixEpochStart.AddSeconds(Convert.ToInt64(i["e2eventduration"].InnerText)); // Dauer zu beginnzeit addieren
                        zeit        += " - " + String.Format("{0:00}:{1:00}", UnixEpochEnd.Hour, UnixEpochEnd.Minute);
                    }
                    if (i["e2eventdescription"] != null)
                    {
                        text = i["e2eventdescription"].InnerText;
                    }
                    else
                    {
                        text = "";
                    }
                    if (i["e2eventdescriptionextended"] != null)
                    {
                        text += "\n" + i["e2eventdescriptionextended"].InnerText;
                    }
                    //if (i["timerNo"] != null) { timerNo = i["timerNo"].InnerText; } else { timerNo = ""; }
                    ListViewItem listItem = listView1.Items.Add(new ListViewItem(new string[] { "", title, zeit, progId, startTime, timerNo, text }));
                    //Kategorie Icon auswählen
                    //if (catIcon != ""){ (listItem).ImageIndex = Convert.ToInt16(catIcon); } else { (listItem).ImageIndex = 0; }
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
        private void GenerateTimerTable()
        {
            Uri    lUri      = new Uri(vTimerURL);
            string lResponse = SendWebRequest(lUri);

            if (lResponse == "")
            {
                return;
            }
            //XML Elemente durchgehen
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(lResponse);
            XmlElement  root  = doc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("./e2timer");

            try
            {
                string   channelNr;
                string   channelName;
                string   tvtId     = "";
                string   programm  = "";
                string   zeit      = "";
                string   startTime = "";
                string   endTime   = "";
                string   text      = "";
                string   active    = "";
                DateTime UnixEpochStart;
                DateTime UnixEpochEnd;
                int      channel  = 1;
                Int64    duration = 0;
                foreach (XmlNode i in nodes)
                {
                    channelNr = channel.ToString();
                    channel++;
                    channelName = i["e2servicename"].InnerText;
                    tvtId       = i["e2servicereference"].InnerText;
                    if (i["e2name"] != null)
                    {
                        programm = i["e2name"].InnerText;
                    }
                    else
                    {
                        programm = "";
                    }
                    //beginzeit
                    if ((i["e2timebegin"] != null) && ((i["e2timebegin"].InnerText).ToUpper() != "NONE"))
                    {
                        startTime      = i["e2timebegin"].InnerText;
                        UnixEpochStart = new DateTime(Convert.ToInt64(i["e2timebegin"].InnerText) * 10000000); //Ticks
                        UnixEpochStart = UnixEpochStart.AddYears(1969);
                        UnixEpochStart = UnixEpochStart.AddDays(-1);                                           //16.5. aus irgend einem Grund muss ein tag abgezogen werden
                        // je nach Sommer oder Winterzeit muss die Uhrzeit korrigiert werden
                        // Ticks uns UnixEpoch sind mindesten 1h unterschiedlich
                        if (vDayLightSaving)
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(2);
                        }
                        else
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(1);
                        }
                        zeit = String.Format("{0} {1:00}:{2:00}", DateTools.PrintDayOfWeek(UnixEpochStart.DayOfWeek), UnixEpochStart.Hour, UnixEpochStart.Minute);
                    }
                    else
                    {
                        zeit           = "";
                        startTime      = "";
                        UnixEpochStart = new DateTime();
                    }
                    //endezeit
                    if ((i["e2timeend"] != null) && ((i["e2timeend"].InnerText).ToUpper() != "NONE"))
                    {
                        endTime = i["e2timeend"].InnerText;
                    }
                    else
                    {
                        endTime = "";
                    }
                    //Dauer
                    if ((i["e2duration"] != null) && ((i["e2duration"].InnerText).ToUpper() != "NONE"))
                    {
                        duration     = Convert.ToInt64(i["e2duration"].InnerText);
                        UnixEpochEnd = UnixEpochStart.AddSeconds(duration); // Dauer zu beginnzeit addieren
                        zeit        += " - " + String.Format("{0:00}:{1:00}", UnixEpochEnd.Hour, UnixEpochEnd.Minute);
                    }
                    else
                    {
                        duration = 0;
                    }
                    //aktiv
                    if ((i["e2disabled"] != null) && ((i["e2disabled"].InnerText).ToUpper() != "1"))
                    {
                        active = "aktiv";
                    }
                    else
                    {
                        active = "inaktiv";
                    }

                    //if (i["e2eventcurrenttime"] != null)
                    //{
                    //    DateTime UnixEpochNow = new DateTime(Convert.ToInt64(i["e2eventcurrenttime"].InnerText) * 10000000); //Ticks;
                    //    UnixEpochNow = UnixEpochNow.AddYears(1969);
                    //    if (vDayLightSaving) { UnixEpochNow = UnixEpochNow.AddHours(2); } else { UnixEpochNow = UnixEpochNow.AddHours(1); }
                    //    if (duration > 0)
                    //    {
                    //        progress = Math.Truncate(UnixEpochNow.Subtract(UnixEpochStart).TotalSeconds / duration * 100).ToString();
                    //    }
                    //    else
                    //    {
                    //        progress = "0";
                    //    }

                    //}
                    //else
                    //{
                    //    progress = "";
                    //}
                    if (i["e2description"] != null)
                    {
                        text = i["e2description"].InnerText;
                    }
                    else
                    {
                        text = "";
                    }
                    if (i["e2descriptionextended"] != null)
                    {
                        text += "\n" + i["e2descriptionextended"].InnerText;
                    }
                    //ListViewItem listItem = listView1.Items.Add(new ListViewItem(new string[] { "", channelNr, channelName, programm, zeit, tvtId, startTime, progress, text }));
                    //Element hinzufügen
                    //ListViewItem listItem = TimerListView.Items.Add(new ListViewItem(new string[] { "" /*channelIcon*/, channelNr, channelName, programm, tag + " " + zeit, tvtId, timerNo, catIcon }));
                    ListViewItem listItem = TimerListView.Items.Add(new ListViewItem(new string[] { "" /*channelIcon*/, channelNr, channelName, programm, zeit, active, tvtId, "", text, startTime, endTime }));

                    if (tvtId != "")
                    {
                        string key = tvtId.Replace(':', '_');
                        key = key.Remove(key.Length - 1, 1); //das letzte _ entfernen
                        //Icon aus der Liste suchen
                        (listItem).ImageIndex = channelImageList.Images.IndexOfKey(key);
                    }
                    else
                    {
                        (listItem).ImageIndex = channelImageList.Images.IndexOfKey("0");
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #3
0
        public void UpdateDetailEPG(string tvtId, string channelName)
        {
            //Initialisierung
            this.vserviceRef = tvtId;
            vURL             = vBaseUrl + "/web/epgservice?sRef=" + tvtId;

            //Liste leeren
            listView1.Items.Clear();

            Uri    lUri      = new Uri(vURL);
            string lResponse = SendWebRequest(lUri);

            if (lResponse == "")
            {
                return;
            }
            //XML Elemente durchgehen
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(lResponse);
            XmlElement  root  = doc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("./e2event");

            try
            {
                string title = "";
                //string catIcon = "";
                string zeit      = "";
                string startTime = "";
                string progId    = "";
                //float zeitPzt = 0;
                string   timerNo = "";
                string   text    = "";
                DateTime UnixEpochStart;
                DateTime UnixEpochEnd;
                foreach (XmlNode i in nodes)
                {
                    //Titel auslesen und HTMLKonvertierung durchführen
                    title = i["e2eventtitle"].InnerText;
                    StringWriter myWriter = new StringWriter();
                    HttpUtility.HtmlDecode(title, myWriter);
                    title = myWriter.ToString();
                    if (i["e2eventid"] != null)
                    {
                        progId = i["e2eventid"].InnerText;
                    }
                    else
                    {
                        progId = "";
                    }
                    if (i["e2eventstart"] != null)
                    {
                        startTime      = i["e2eventstart"].InnerText;
                        UnixEpochStart = new DateTime(Convert.ToInt64(i["e2eventstart"].InnerText) * 10000000); //Ticks
                        UnixEpochStart = UnixEpochStart.AddYears(1969);
                        UnixEpochStart = UnixEpochStart.AddDays(-1);                                            //16.5. aus irgend einem Grund muss ein tag abgezogen werden
                        if (vDayLightSaving)
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(2);
                        }
                        else
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(1);
                        }                                                                                                                          // Time Offset
                        zeit = String.Format("{0} {1:00}:{2:00}", DateTools.PrintDayOfWeek(UnixEpochStart.DayOfWeek), UnixEpochStart.Hour, UnixEpochStart.Minute);
                    }
                    else
                    {
                        zeit           = "";
                        startTime      = "";
                        UnixEpochStart = new DateTime();
                    }
                    if (i["e2eventduration"] != null)
                    {
                        UnixEpochEnd = UnixEpochStart.AddSeconds(Convert.ToInt64(i["e2eventduration"].InnerText)); // Dauer zu beginnzeit addieren
                        zeit        += " - " + String.Format("{0:00}:{1:00}", UnixEpochEnd.Hour, UnixEpochEnd.Minute);
                    }
                    if (i["e2eventdescription"] != null)
                    {
                        text = i["e2eventdescription"].InnerText;
                    }
                    else
                    {
                        text = "";
                    }
                    if (i["e2eventdescriptionextended"] != null)
                    {
                        text += "\n" + i["e2eventdescriptionextended"].InnerText;
                    }
                    //if (i["timerNo"] != null) { timerNo = i["timerNo"].InnerText; } else { timerNo = ""; }
                    ListViewItem listItem = listView1.Items.Add(new ListViewItem(new string[] { "", title, zeit, progId, startTime, timerNo, text }));
                }
            }
            catch
            {
            }
        }
Beispiel #4
0
        //EPG Liste laden
        private void GenerateEPGList(Boolean aNow)
        {
            string lresponseFromServer = "";
            string lUrl = "";

            if (aNow)
            {
                lUrl = vEPGURL.Replace("{REF}", vServiceList[serviceBox.SelectedIndex]);
            }
            else
            {
                lUrl = vEPGURLNext.Replace("{REF}", vServiceList[serviceBox.SelectedIndex]);
            }
            ProgressForm lProgress = new ProgressForm();

            lProgress.StartPosition = FormStartPosition.CenterParent;
            lProgress.Show(this);
            lProgress.SetProgress("Lade Daten", 0);
            Uri lUri = new Uri(lUrl);

            //Daten anfordern
            lresponseFromServer = SendWebRequest(lUri);
            //wenn keine Daten gefunden, dann exit
            if (lresponseFromServer == "")
            {
                lProgress.Close();
                return;
            }
            //lProgress.SetProgress("Erzeuge Liste", 50);
            //XML Elemente durchgehen
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(lresponseFromServer);
            XmlElement  root  = doc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("./e2event");

            //Liste leeren, sie könnte ja schon mal befüllt worden sein
            listView1.Items.Clear();
            try
            {
                string   channelNr;
                string   channelName;
                string   tvtId     = "";
                string   programm  = "";
                string   zeit      = "";
                string   startTime = "";
                string   progress  = "";
                string   text      = "";
                DateTime UnixEpochStart;
                DateTime UnixEpochEnd;
                int      channel  = 1;
                Int64    duration = 0;
                foreach (XmlNode i in nodes)
                {
                    channelNr = channel.ToString();
                    channel++;
                    channelName = i["e2eventservicename"].InnerText;
                    tvtId       = i["e2eventservicereference"].InnerText;
                    if ((i["e2eventtitle"] != null) && ((i["e2eventtitle"].InnerText).ToUpper() != "NONE"))
                    {
                        programm = i["e2eventtitle"].InnerText;
                    }
                    else
                    {
                        programm = "";
                    }
                    if ((i["e2eventstart"] != null) && ((i["e2eventstart"].InnerText).ToUpper() != "NONE"))
                    {
                        startTime      = i["e2eventstart"].InnerText;
                        UnixEpochStart = new DateTime(Convert.ToInt64(i["e2eventstart"].InnerText) * 10000000); //Ticks
                        UnixEpochStart = UnixEpochStart.AddYears(1969);
                        UnixEpochStart = UnixEpochStart.AddDays(-1);                                            //16.5. aus irgend einem Grund muss ein tag abgezogen werden
                        // je nach Sommer oder Winterzeit muss die Uhrzeit korrigiert werden
                        // Ticks uns UnixEpoch sind mindesten 1h unterschiedlich
                        if (vDayLightSaving)
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(2);
                        }
                        else
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(1);
                        }
                        zeit = String.Format("{0} {1:00}:{2:00}", DateTools.PrintDayOfWeek(UnixEpochStart.DayOfWeek), UnixEpochStart.Hour, UnixEpochStart.Minute);
                    }
                    else
                    {
                        zeit           = "";
                        startTime      = "";
                        UnixEpochStart = new DateTime();
                    }
                    if ((i["e2eventduration"] != null) && ((i["e2eventduration"].InnerText).ToUpper() != "NONE"))
                    {
                        duration     = Convert.ToInt64(i["e2eventduration"].InnerText);
                        UnixEpochEnd = UnixEpochStart.AddSeconds(duration); // Dauer zu beginnzeit addieren
                        zeit        += " - " + String.Format("{0:00}:{1:00}", UnixEpochEnd.Hour, UnixEpochEnd.Minute);
                    }
                    else
                    {
                        duration = 0;
                    }
                    if (i["e2eventcurrenttime"] != null)
                    {
                        DateTime UnixEpochNow = new DateTime(Convert.ToInt64(i["e2eventcurrenttime"].InnerText) * 10000000); //Ticks;
                        UnixEpochNow = UnixEpochNow.AddYears(1969);
                        UnixEpochNow = UnixEpochNow.AddDays(-1);                                                             //16.5. aus irgend einem Grund muss ein tag abgezogen werden
                        if (vDayLightSaving)
                        {
                            UnixEpochNow = UnixEpochNow.AddHours(2);
                        }
                        else
                        {
                            UnixEpochNow = UnixEpochNow.AddHours(1);
                        }
                        if (duration > 0)
                        {
                            progress = Math.Truncate(UnixEpochNow.Subtract(UnixEpochStart).TotalSeconds / duration * 100).ToString();
                        }
                        else
                        {
                            progress = "0";
                        }
                    }
                    else
                    {
                        progress = "";
                    }
                    if ((i["e2eventdescription"] != null) && ((i["e2eventdescription"].InnerText).ToUpper() != "NONE"))
                    {
                        text = i["e2eventdescription"].InnerText;
                    }
                    else
                    {
                        text = "";
                    }
                    if ((i["e2eventdescriptionextended"] != null) && ((i["e2eventdescriptionextended"].InnerText).ToUpper() != "NONE"))
                    {
                        text += "\n" + i["e2eventdescriptionextended"].InnerText;
                    }
                    ListViewItem listItem = listView1.Items.Add(new ListViewItem(new string[] { "", channelNr, channelName, programm, zeit, tvtId, startTime, progress, text }));
                    if (tvtId != "")
                    {
                        string key = tvtId.Replace(':', '_');
                        key = key.Remove(key.Length - 1, 1); //das letzte _ entfernen
                        //Icon aus der Liste suchen
                        (listItem).ImageIndex = channelImageList.Images.IndexOfKey(key);
                    }
                    else
                    {
                        (listItem).ImageIndex = channelImageList.Images.IndexOfKey("0");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fehler beim Laden: " + ex.Message);
            }

            lProgress.SetProgress("Fertig ...", 100);
            lProgress.Close();
        }
 public static DateTime FromUnixSeconds(this double seconds) => UnixEpochStart.AddSeconds(seconds);
Beispiel #6
0
        private void createDetailEPG()
        {
            Uri    lUri      = new Uri(vURL);
            string lResponse = SendWebRequest(lUri);

            if (lResponse == "")
            {
                return;
            }
            //XML Elemente durchgehen
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(lResponse);
            XmlElement  root  = doc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("./e2event");

            try
            {
                string   title     = "";
                string   zeit      = "";
                string   startTime = "";
                string   progId    = "";
                string   text      = "";
                string   tvtId     = "";
                string   programm  = "";
                DateTime UnixEpochStart;
                DateTime UnixEpochEnd;
                foreach (XmlNode i in nodes)
                {
                    title = i["e2eventtitle"].InnerText;
                    //if (i["progress"] != null) { zeitPzt = (float)Convert.ToDouble(i["progress"].InnerText); } else { zeitPzt = 0; }
                    if (i["e2eventid"] != null)
                    {
                        progId = i["e2eventid"].InnerText;
                    }
                    else
                    {
                        progId = "";
                    }
                    //if (i["catIcon"] != null) {
                    //    catIcon = i["catIcon"].InnerText;
                    //    catIcon = catIcon.Replace("/icon/", "");
                    //} else {
                    //    catIcon = "";
                    //}
                    if (i["e2eventstart"] != null)
                    {
                        startTime      = i["e2eventstart"].InnerText;
                        UnixEpochStart = new DateTime(Convert.ToInt64(i["e2eventstart"].InnerText) * 10000000); //Ticks
                        UnixEpochStart = UnixEpochStart.AddYears(1969);
                        UnixEpochStart = UnixEpochStart.AddDays(-1);                                            //16.5. aus irgend einem Grund muss ein tag abgezogen werden
                        if (vDayLightSaving)
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(2);
                        }
                        else
                        {
                            UnixEpochStart = UnixEpochStart.AddHours(1);
                        }                                                                                                                          // Time Offset
                        zeit = String.Format("{0} {1}  {2:00}:{3:00}", DateTools.PrintDayOfWeek(UnixEpochStart.DayOfWeek), PrintDate(UnixEpochStart), UnixEpochStart.Hour, UnixEpochStart.Minute);
                    }
                    else
                    {
                        zeit           = "";
                        startTime      = "";
                        UnixEpochStart = new DateTime();
                    }
                    if (i["e2eventduration"] != null)
                    {
                        UnixEpochEnd = UnixEpochStart.AddSeconds(Convert.ToInt64(i["e2eventduration"].InnerText)); // Dauer zu beginnzeit addieren
                        zeit        += " - " + String.Format("{0:00}:{1:00}", UnixEpochEnd.Hour, UnixEpochEnd.Minute);
                    }
                    if (i["e2eventdescription"] != null)
                    {
                        text = i["e2eventdescription"].InnerText;
                    }
                    else
                    {
                        text = "";
                    }
                    if (i["e2eventdescriptionextended"] != null)
                    {
                        text += "\n" + i["e2eventdescriptionextended"].InnerText;
                    }
                    if (i["e2eventservicename"] != null)
                    {
                        programm = i["e2eventservicename"].InnerText;
                    }
                    else
                    {
                        programm = "";
                    }
                    if (i["e2eventservicereference"] != null)
                    {
                        tvtId = i["e2eventservicereference"].InnerText;
                    }
                    else
                    {
                        tvtId = "";
                    }
                    ListViewItem listItem = listView1.Items.Add(new ListViewItem(new string[] { "", programm, title, zeit, progId, startTime, text, tvtId }));
                    if (tvtId != "")
                    {
                        string key = tvtId.Replace(':', '_');
                        key = key.Remove(key.Length - 1, 1); //das letzte _ entfernen
                        //Icon aus der Liste suchen
                        (listItem).ImageIndex = channelImageList.Images.IndexOfKey(key);
                    }
                    else
                    {
                        (listItem).ImageIndex = channelImageList.Images.IndexOfKey("0");
                    }
                }
            }
            catch
            {
            }
        }