public void Download() { Serie = ServerTestData.Server.Series.FirstOrDefault(el => el.Title == Title); ChapterCount = -1; URL = Serie.URL; Serie.State = SerieState.Waiting; Serie.DownloadChapters(); if (Serie.State == SerieState.Error) { throw new Exception("Downloading chapters error"); } ChapterCount = Serie.Chapters.Count; foreach (var chapter in Chapters) { if (chapter.Index > ChapterCount) { chapter.Index = -1; continue; } chapter.Download(); } }
public void DownloadChapters(Serie a_serie, bool a_force) { if (a_serie == null) return; if (!a_serie.IsDownloadRequired(a_force)) return; lock (m_downloading) { m_downloading.Add(a_serie); } a_serie.State = SerieState.Waiting; a_serie.LimiterOrder = Catalog.NextID(); new Task(() => { a_serie.DownloadChapters(); }, TaskCreationOptions.LongRunning).Start(); }