public static EpgData Load(string filename) { EpgData epgdata = new EpgData(); if (!File.Exists(filename)) { return(epgdata); } XmlSerializer xs = null; FileStream fs = null; try { //xs = new XmlSerializer(typeof(KlonsSettings)); xs = Utils.CreateDefaultXmlSerializer(typeof(EpgData)); fs = new FileStream(filename, FileMode.Open); epgdata = (EpgData)xs.Deserialize(fs); if (epgdata != null) { epgdata.SetReferences(); } epgdata.SortChannels(); if (epgdata.Source == "?") { if (epgdata._channelListURL != null && epgdata._channelListURL.Contains("/api/")) { epgdata.Source = "api"; } else if (epgdata._channelListURL != null && epgdata._channelListURL.Contains("/api/")) { epgdata.Source = "web"; } } return(epgdata); } catch (Exception) { //LogError(e.Message); epgdata = new EpgData(); return(epgdata); } finally { if (fs != null) { fs.Close(); } } }
public void LoadData() { bsChannels.DataSource = null; bsPrograms.DataSource = null; tbURL.DataBindings.Clear(); tbAddHours.DataBindings.Clear(); tbTimeZone.DataBindings.Clear(); EpgData1 = EpgData.Load(MyData.ChannelListFileName); bsChannels.DataSource = EpgData1.Channels; tbURL.DataBindings.Add("Text", EpgData1, "ChannelListURL"); tbAddHours.DataBindings.Add("Text", EpgData1, "AddHours"); tbTimeZone.DataBindings.Add("Text", EpgData1, "TimeZone"); }
public static EpgData Load(string filename) { EpgData epgdata = new EpgData(); if (!File.Exists(filename)) return epgdata; XmlSerializer xs = null; FileStream fs = null; try { //xs = new XmlSerializer(typeof(KlonsSettings)); xs = Utils.CreateDefaultXmlSerializer(typeof(EpgData)); fs = new FileStream(filename, FileMode.Open); epgdata = (EpgData)xs.Deserialize(fs); if (epgdata != null) epgdata.SetReferences(); return epgdata; } catch (Exception) { //LogError(e.Message); epgdata = new EpgData(); return epgdata; } finally { if (fs != null) fs.Close(); } }
public void LoadData() { bsChannels.DataSource = null; bsPrograms.DataSource = null; tbURL.DataBindings.Clear(); tbAddHours.DataBindings.Clear(); tbTimeZone.DataBindings.Clear(); EpgData1 = EpgData.Load(ChannelListFileName); bsChannels.DataSource = EpgData1.Channels; tbURL.DataBindings.Add("Text", EpgData1, "ChannelListURL"); tbAddHours.DataBindings.Add("Text", EpgData1, "AddHours"); tbTimeZone.DataBindings.Add("Text", EpgData1, "TimeZone"); }