public IndexCollection(IReadOnlyCollection<Index> latest, IndexCollection previous, FileInfo info, Encoding encoding) { Info = info; Encoding = encoding; Count = latest.Select(idx => idx.LineCount).Sum(); Indicies = latest.ToArray(); Diff = Count - (previous?.Count ?? 0); //need to check whether if (previous == null) { ChangedReason = LinesChangedReason.Loaded; TailInfo = new TailInfo(latest.Max(idx => idx.End)); } else { var mostRecent = latest.OrderByDescending(l => l.TimeStamp).First(); ChangedReason = mostRecent.Type == IndexType.Tail ? LinesChangedReason.Tailed : LinesChangedReason.Paged; TailInfo = new TailInfo(previous.Indicies.Max(idx => idx.End)); } }
public IndexCollection(IReadOnlyCollection <Index> latest, IndexCollection previous, FileInfo info, Encoding encoding) { Info = info; Encoding = encoding; Count = latest.Select(idx => idx.LineCount).Sum(); Indicies = latest.ToArray(); Diff = Count - (previous?.Count ?? 0); //need to check whether if (previous == null) { ChangedReason = LinesChangedReason.Loaded; TailInfo = new TailInfo(latest.Max(idx => idx.End)); } else { var mostRecent = latest.OrderByDescending(l => l.TimeStamp).First(); ChangedReason = mostRecent.Type == IndexType.Tail ? LinesChangedReason.Tailed : LinesChangedReason.Paged; TailInfo = new TailInfo(previous.Indicies.Max(idx => idx.End)); } }
public IndexCollection(IReadOnlyCollection <Index> latest, IndexCollection previous, FileInfo info, Encoding encoding) { Info = info; Encoding = encoding; Count = latest.Select(idx => idx.LineCount).Sum(); Indicies = latest /*.GroupBy(c => c.LineCount).Select(g => g.FirstOrDefault())*/.ToArray(); Diff = Count - (previous?.Count ?? 0); //need to check whether if (previous == null) { ChangedReason = LinesChangedReason.Loaded; TailInfo = new TailInfo(latest.Max(idx => idx.End)); } else { var mostRecent = latest.OrderByDescending(l => l.TimeStamp).First(); ChangedReason = mostRecent.Type == IndexType.Tail ? LinesChangedReason.Tailed : LinesChangedReason.Paged; TailInfo = new TailInfo(previous.Indicies.Max(idx => idx.End)); Previous = previous; previous.Next = this; NumberOfPreviousProvider = previous.NumberOfPreviousProvider + 1; //var prevPointer = previous; ////find the modified file and replace from the list //while (prevPointer != null) //{ // var lastPrevPointer = prevPointer; // if (prevPointer.Info.FullName == Info.FullName) // { // Next = prevPointer.Next; // Previous = prevPointer.Previous; // lastPrevPointer.Previous = this; // prevPointer.Previous = null; // prevPointer.Next = null; // NumberOfPreviousProvider = prevPointer.NumberOfPreviousProvider; // return; // } // prevPointer = prevPointer.Previous as IndexCollection; //} } }
public IndexCollection(IReadOnlyCollection<Index> latest, IndexCollection previous, FileInfo info, Encoding encoding) { Info = info; Encoding = encoding; Count = latest.Select(idx => idx.LineCount).Sum(); Indicies = latest.ToArray(); Diff = Count - (previous?.Count ?? 0); //need to check whether if (previous == null) { TailInfo = new TailInfo(latest.Max(idx => idx.End)); } else { TailInfo = new TailInfo(previous.Indicies.Max(idx => idx.End)); } }
public IndexCollection(IReadOnlyCollection <Index> latest, IndexCollection previous, FileInfo info, Encoding encoding) { Info = info; Encoding = encoding; Count = latest.Select(idx => idx.LineCount).Sum(); Indicies = latest.ToArray(); Diff = Count - (previous?.Count ?? 0); //need to check whether if (previous == null) { TailInfo = new TailInfo(latest.Max(idx => idx.End)); } else { TailInfo = new TailInfo(previous.Indicies.Max(idx => idx.End)); } }