本文整理汇总了C#中Commit.Max方法的典型用法代码示例。如果您正苦于以下问题:C# Commit.Max方法的具体用法?C# Commit.Max怎么用?C# Commit.Max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Commit
的用法示例。
在下文中一共展示了Commit.Max方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToStream
/// <summary>
/// To stream.
/// </summary>
/// <param name="commiters">The commiters.</param>
/// <param name="outputStream">The output stream.</param>
/// <returns>A stream containing markup contents.</returns>
public Stream ToStream(Commit[] commiters, Stream outputStream = null)
{
MemoryStream memory = new MemoryStream();
StreamWriter writer;
if (outputStream == null)
{
writer = new StreamWriter(memory);
}
else
{
writer = new StreamWriter(outputStream);
}
foreach (TextBlock block in this._blocks)
{
switch (block.Type)
{
case BlockType.Author:
var uniqueAuthors = commiters.Select(x => x.Author).Distinct();
foreach (var author in uniqueAuthors)
{
this.WriteAuthors(
writer,
block,
commiters.Where(x => x.Author.Equals(author)).ToArray());
if (!string.IsNullOrEmpty(block.PostText))
{
var last = uniqueAuthors.Last();
// Add the separator if it is not the last route.
if (last != author)
{
writer.Write(block.PostText);
writer.Flush();
}
}
}
break;
case BlockType.Date:
// Stub.
break;
default:
int idx;
// Search for y-min tokens.
while ((idx = block.Text.IndexOf("{ymin}", StringComparison.CurrentCultureIgnoreCase)) > -1)
{
block.Text = block.Text.Replace(
block.Text.Substring(idx, "{ymin}".Length),
commiters.Min(x => x.LinesOfChange).ToString());
}
// Search for y-max tokens.
while ((idx = block.Text.IndexOf("{ymax}", StringComparison.CurrentCultureIgnoreCase)) > -1)
{
block.Text = block.Text.Replace(
block.Text.Substring(idx, "{ymax}".Length),
commiters.Max(x => x.LinesOfChange).ToString());
}
// Search for y-min tokens.
while ((idx = block.Text.IndexOf("{xmin}", StringComparison.CurrentCultureIgnoreCase)) > -1)
{
block.Text = block.Text.Replace(
block.Text.Substring(idx, "{xmin}".Length),
ConvertToJavascriptTimestamp(commiters.Min(x => x.Date)).ToString());
}
// Search for y-max tokens.
while ((idx = block.Text.IndexOf("{xmax}", StringComparison.CurrentCultureIgnoreCase)) > -1)
{
block.Text = block.Text.Replace(
block.Text.Substring(idx, "{xmax}".Length),
ConvertToJavascriptTimestamp(commiters.Max(x => x.Date)).ToString());
}
// Nothing to see here.
writer.Write(block.Text);
writer.Flush();
break;
}
}
//.........这里部分代码省略.........