Ejemplo n.º 1
0
 internal void SetSegmentStatus(int segment, NZBDriveDLL.SegmentState state)
 {
     if (segment < FileSegmentStatusCollection.Count)
     {
         ChangeStatusCount(FileSegmentStatusCollection[segment], -1);
         ChangeStatusCount(state, 1);
         FileSegmentStatusCollection[segment] = state;
     }
 }
Ejemplo n.º 2
0
 void _nzbDrive_FileSegmentStateChanged(int fileID, int segment, NZBDriveDLL.SegmentState state)
 {
     this.Dispatcher.BeginInvoke((Action)(() =>
     {
         try
         {
             NZBDriveView.Model.FileSegmentStateChangedEvent(fileID, segment, state);
         }
         catch (Exception e)
         {
             MessageBox.Show("_nzbDrive_FileSegmentStateChanged Failed: " + e.Message);
         }
     }));
 }
Ejemplo n.º 3
0
        private void ChangeStatusCount(NZBDriveDLL.SegmentState state, int delta)
        {
            switch (state)
            {
            case NZBDriveDLL.SegmentState.None: break;

            case NZBDriveDLL.SegmentState.Loading: LoadingSegments += delta; break;

            case NZBDriveDLL.SegmentState.HasData: CachedSegments += delta; break;

            case NZBDriveDLL.SegmentState.DownloadFailed: MissingSegments += delta; break;

            case NZBDriveDLL.SegmentState.MissingSegment: MissingSegments += delta; break;
            }
        }
Ejemplo n.º 4
0
        internal void FileSegmentStateChangedEvent(int fileID, int segment, NZBDriveDLL.SegmentState state)
        {
            NZBFilePart nzbPart;

            if (_filePartMap.TryGetValue(fileID, out nzbPart))
            {
                nzbPart.SetSegmentStatus(segment, state);

                NZBFile nzbFile;
                if (_nzbFileMap.TryGetValue(nzbPart.NZBID, out nzbFile))
                {
                    if (state == NZBDriveDLL.SegmentState.HasData)
                    {
                        nzbFile.PartsLoaded++;
                    }
                    else if (state == NZBDriveDLL.SegmentState.DownloadFailed || state == NZBDriveDLL.SegmentState.MissingSegment)
                    {
                        nzbFile.PartsMissing++;
                    }
                }
            }
        }
Ejemplo n.º 5
0
 internal void FileSegmentStateChangedEvent(int fileID, int segment, NZBDriveDLL.SegmentState state)
 {
     MountedNZBFileList.FileSegmentStateChangedEvent(fileID, segment, state);
 }