コード例 #1
0
 public void Modify(PerLineDiffResult perLineDiffResult)
 {
     Debug.Assert(DiffStatus == perLineDiffResult.DiffStatus, "Modification of Diff status is not allowed.");
     AffectedLines.Add(perLineDiffResult.AffectedLine);
     //With modification, it's going to effect the end range
     if (perLineDiffResult.IsSourceRecord)
     {
         SourceRange = new Range(SourceRange.Start, perLineDiffResult.LinePosition);
     }
     else
     {
         TargetRange = new Range(TargetRange.Start, perLineDiffResult.LinePosition);
     }
 }
コード例 #2
0
 public bool Equals(LinesRangeDiffResult other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     //Trying to short circuit with simple comparisons first.
     return(SourceRange.Equals(other.SourceRange) && TargetRange.Equals(other.TargetRange) &&
            DiffStatus == other.DiffStatus && AffectedLines.Count == other.AffectedLines.Count &&
            AffectedLines.SequenceEqual(other.AffectedLines));
 }
コード例 #3
0
 public override int GetHashCode()
 {
     //For Hashcode, relying on implementation of string to get a distributed hash
     return(string.Format("AffectedLines: {0}, SourceRange: {1}, TargetRange: {2}, DiffStatus: {3}",
                          string.Join(",", AffectedLines.ToArray()), SourceRange, TargetRange, DiffStatus).GetHashCode());
 }