예제 #1
0
        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();
                }
            }
        }
예제 #2
0
        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");
        }
예제 #3
0
 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();
     }
 }
예제 #4
0
        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");
        }