Example #1
0
 private void startSegment()
 {
     curSegment = new XmlSegment()
     {
         TimeIn = DateTime.Now.Subtract(recorder.StartTime).Add(TimeSpan.FromSeconds(AudiobookerMp3Utils.CutSecondsBefore)),
     };
     if (CurSegmentUpdated != null)
     {
         CurSegmentUpdated();
     }
 }
Example #2
0
 private void startSegment()
 {
     curSegment = new XmlSegment() {
         TimeIn = DateTime.Now.Subtract(recorder.StartTime).Add(TimeSpan.FromSeconds(AudiobookerMp3Utils.CutSecondsBefore)),
     };
     if (CurSegmentUpdated != null)
         CurSegmentUpdated();
 }
        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());
        }