123123
This commit is contained in:
@@ -5,7 +5,7 @@ namespace ZelWiki.Engine.Implementation.Utility
|
||||
public static class Differentiator
|
||||
{
|
||||
/// <summary>
|
||||
/// This leaves a lot to be desired.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="thisRev"></param>
|
||||
/// <param name="prevRev"></param>
|
||||
@@ -16,35 +16,35 @@ namespace ZelWiki.Engine.Implementation.Utility
|
||||
|
||||
var thisRevLines = thisRev.Split('\n');
|
||||
var prevRevLines = prevRev.Split('\n');
|
||||
int thisRevLineCount = thisRevLines.Length;
|
||||
int prevRevLinesCount = prevRevLines.Length;
|
||||
var thisRevLineCount = thisRevLines.Length;
|
||||
var prevRevLinesCount = prevRevLines.Length;
|
||||
|
||||
int linesAdded = prevRevLines.Except(thisRevLines).Count();
|
||||
int linesDeleted = thisRevLines.Except(prevRevLines).Count();
|
||||
var linesAdded = prevRevLines.Except(thisRevLines).Count();
|
||||
var linesDeleted = thisRevLines.Except(prevRevLines).Count();
|
||||
|
||||
if (thisRevLineCount != prevRevLinesCount)
|
||||
{
|
||||
summary.Append($"{Math.Abs(thisRevLineCount - prevRevLinesCount):N0} lines changed.");
|
||||
summary.Append($"{Math.Abs(thisRevLineCount - prevRevLinesCount):N0} 行修改.");
|
||||
}
|
||||
|
||||
if (linesAdded > 0)
|
||||
{
|
||||
if (summary.Length > 0) summary.Append(' ');
|
||||
summary.Append($"{linesAdded:N0} lines added.");
|
||||
summary.Append($"{linesAdded:N0} 行新增.");
|
||||
}
|
||||
|
||||
if (linesDeleted > 0)
|
||||
{
|
||||
if (summary.Length > 0) summary.Append(' ');
|
||||
summary.Append($"{linesDeleted:N0} lines deleted.");
|
||||
summary.Append($"{linesDeleted:N0} 行删除.");
|
||||
}
|
||||
|
||||
if (summary.Length == 0)
|
||||
{
|
||||
summary.Append($"No changes detected.");
|
||||
summary.Append($"未修改.");
|
||||
}
|
||||
|
||||
return summary.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user