public static List <CustomCore> GetCustomCores(string url) { if (!string.IsNullOrEmpty(url)) { XmlDownloader downloader = new XmlDownloader(); CustomCores customCores = downloader.Download <CustomCores>(url); if (customCores != null && customCores.Cores != null) { return(new List <CustomCore>(customCores.Cores)); } } List <CustomCore> customCoresList = new List <CustomCore>(); if (!Utils.IsCurrentPlatform64Bit()) { var settings = ServiceRegistration.Get <ISettingsManager>().Load <CoreUpdaterSettings>(); customCoresList.AddRange(CoreUpdaterSettings.DEFAULT_CUSTOM_CORES); } return(customCoresList); }
public void SaveTaskList() { List<XmlDownloader> xmldownloads = new List<XmlDownloader>(); using (DownloadManager.Instance.locker.LockList(true)) { List<Downloader> downloaders = DownloadManager.Instance.Downloaders; for (int i = 0; i < downloaders.Count; i++) { if (downloaders[i].State==DownloadState.Ended) { continue; } XmlDownloader xmlDownload = new XmlDownloader(); xmlDownload.CreatedTime = downloaders[i].CreatedTime; xmlDownload.LocalFilePath = downloaders[i].LocalFilePath; xmlDownload.SegmentCount = downloaders[i].SementCount; xmlDownload.URL = downloaders[i].URL; xmlDownload.Segments=new XmlSegment[downloaders[i].Segments.Count]; for (int j = 0; j < downloaders[i].Segments.Count; j++) { XmlSegment xmlSegment = new XmlSegment(); xmlSegment.StartPosition = downloaders[i].Segments[j].StartPosition; xmlSegment.InitialPosition = downloaders[i].Segments[j].InitialPosition; xmlSegment.Index = downloaders[i].Segments[j].Index; xmlSegment.EndPosition = downloaders[i].Segments[j].EndPosition; xmlDownload.Segments[j] = xmlSegment; } xmldownloads.Add(xmlDownload); } } SaveDownloads(xmldownloads.ToArray()); }
private void SaveDownloads(XmlDownloader[] xmldownloads) { try { using (FileStream fs=new FileStream(GetXmlFilePath(),FileMode.Create)) { serializer.Serialize(fs, xmldownloads); } } catch { } }
private void LoadDownloads(XmlDownloader[] downloads) { for (int i = 0; i < downloads.Length; i++) { List<Segment> segments = new List<Segment>(); for (int j = 0; j < downloads[i].Segments.Length; j++) { Segment segment = new Segment(); segment.Index = downloads[i].Segments[j].Index; segment.InitialPosition = downloads[i].Segments[j].InitialPosition; segment.StartPosition = downloads[i].Segments[j].StartPosition; segment.EndPosition = downloads[i].Segments[j].EndPosition; segments.Add(segment); } DownloadManager.Instance.Add( downloads[i].URL, downloads[i].LocalFilePath, downloads[i].SegmentCount, Settings.Default.IsRuntoStart, segments, downloads[i].CreatedTime); } }
internal async Task <List <Episode> > downloadXml(string url, Podcast p) => await XmlDownloader.LoadRssXml(url, p);