public bool GetCurrentFromFile() { if (EpgData1.Source == "api") { return(false); } DateTime startdate, enddate; if (!GetDates(out startdate, out enddate)) { return(false); } if (EpgData1.Channels.Count == 0) { return(true); } if (bsChannels.Current == null) { return(false); } task_cur_ch = bsChannels.Current as EpgChannel; task_ch_nr = EpgData1.Channels.IndexOf(task_cur_ch); if (task_ch_nr == -1) { return(false); } task_date = startdate; task_cur_ch.RemoveDates(startdate, enddate); EpgData1.ClearTemp(); string page = File.ReadAllText(tbURL.Text); bool ret = task_cur_ch.ReadProgrammsA(page, task_date); task_cur_ch.AddFromTemp(); task_cur_ch.CheckEndTimes(); return(true); }
private async Task <bool> GetDataA(EpgChannel ch, DateTime date) { if (EpgData1.Source == "api") { return(false); } string url = GetURL(ch, date); string page = await ADownloader.GetString(url, LTC.Properties.Settings.Default.HTTPClientTimeOut); if (page == null) { TaskFormMsg( string.Format("Failed to download programs for {0}: {1}", task_cur_ch.Name, task_date.ToString("yyyy.MM.dd")) ); return(false); } //File.WriteAllText(GetBasePath()+"\\e1.html", page); bool ret1 = await Task <bool> .Run(() => { return(task_cur_ch.ReadProgrammsA(page, task_date)); }); if (!ret1) { TaskFormMsg( string.Format("Failed to read programs for {0}: {1}", task_cur_ch.Name, task_date.ToString("yyyy.MM.dd")) ); return(false); } return(true); }