internal void SetSegmentStatus(int segment, NZBDriveDLL.SegmentState state) { if (segment < FileSegmentStatusCollection.Count) { ChangeStatusCount(FileSegmentStatusCollection[segment], -1); ChangeStatusCount(state, 1); FileSegmentStatusCollection[segment] = state; } }
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); } })); }
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; } }
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++; } } } }
internal void FileSegmentStateChangedEvent(int fileID, int segment, NZBDriveDLL.SegmentState state) { MountedNZBFileList.FileSegmentStateChangedEvent(fileID, segment, state); }