public TrackingSummary(IEnumerable <Tracker> trackers, string name) { Name = name; Trackers = trackers.Where(t => t.StoppedAt.HasValue).OrderByDescending(t => t.StartedAt).ToList(); TotalSeconds = Convert.ToInt32(Trackers .Select(t => (t.StoppedAt.Value - t.StartedAt).TotalSeconds) .Sum()); }
/// <summary> /// Converts the torrent to a <see cref="BDictionary"/>. /// </summary> /// <returns></returns> public virtual BDictionary ToBDictionary() { var torrent = new BDictionary(); var trackerCount = Trackers.Flatten().Count(); if (trackerCount > 0) { torrent[TorrentFields.Announce] = new BList(Trackers.First().Select(x => new BString(x, Encoding))); } if (trackerCount > 1) { torrent[TorrentFields.AnnounceList] = new BList(Trackers.Select(x => new BList(x, Encoding))); } if (Encoding != null) { torrent[TorrentFields.Encoding] = new BString(Encoding.WebName.ToUpper(), Encoding); } if (Comment != null) { torrent[TorrentFields.Comment] = new BString(Comment, Encoding); } if (CreatedBy != null) { torrent[TorrentFields.CreatedBy] = new BString(CreatedBy, Encoding); } if (CreationDate != null) { torrent[TorrentFields.CreationDate] = (BNumber)CreationDate; } var info = CreateInfoDictionary(Encoding); if (info.Any()) { torrent[TorrentFields.Info] = info; } if (ExtraFields != null) { torrent.MergeWith(ExtraFields, ExistingKeyAction.Merge); } return(torrent); }
public override bool MoveTracker(TrackerFeature trackerFeature, double deltaX, double deltaY, SnapResult snapResult = null) { if (trackerFeature == AllTracker) { if (FallOffPolicy == null) { FallOffPolicy = new NoFallOffPolicy(); } var handles = TrackerIndices.ToList(); FallOffPolicy.Move(TargetFeature.Geometry, Trackers.Select(t => t.Geometry).ToList(), handles, -1, deltaX, deltaY); foreach (var topologyRule in FeatureRelationEditors) { topologyRule.UpdateRelatedFeatures(SourceFeature, TargetFeature.Geometry, handles); } return(true); } return(base.MoveTracker(trackerFeature, deltaX, deltaY, snapResult)); }