public ListSlice <ProfileFrame> GetFramesInRange(double startMs, double endMs) { double epsilon = 1 / 1000.0; Debug.Assert(startMs > 0); int start = Frames.BinarySearch(startMs, f => f.EndTimeMS, epsilon); int end = Frames.BinarySearch(endMs, f => f.EndTimeMS, epsilon); start = Math.Abs(start); end = Math.Abs(end); return(new ListSlice <ProfileFrame>(Frames, start, end - start)); }
private int findInsertionIndex(ReplayFrame frame) { var index = Frames.BinarySearch(frame, replay_frame_comparer); if (index < 0) { index = ~index; } else { while (index < Frames.Count && frame.Time == Frames[index].Time) { ++index; } } return(index); }
private int findInsertionIndex(LegacyReplayFrame frame) { int index = Frames.BinarySearch(frame, replay_frame_comparer); if (index < 0) { index = ~index; } else { // Go to the first index which is actually bigger while (index < Frames.Count && frame.Time == Frames[index].Time) { ++index; } } return(index); }
public override void UpdateScore() { if (Frames.Count == 0) { return; } if (Clock == null) { return; } int frameIndex = Frames.BinarySearch(new TimedFrame(Clock.CurrentTime)); if (frameIndex < 0) { frameIndex = ~frameIndex; } frameIndex = Math.Clamp(frameIndex - 1, 0, Frames.Count - 1); SetFrame(Frames[frameIndex]); }