本文整理汇总了C#中IStringReader.SkipWhitespace方法的典型用法代码示例。如果您正苦于以下问题:C# IStringReader.SkipWhitespace方法的具体用法?C# IStringReader.SkipWhitespace怎么用?C# IStringReader.SkipWhitespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStringReader
的用法示例。
在下文中一共展示了IStringReader.SkipWhitespace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static DiffRange Parse(IStringReader reader)
{
var range = new DiffRange();
reader.Skip("@@");
reader.SkipWhitespace();
reader.Skip('-');
range.LeftFrom = reader.ReadInt();
if (reader.Skip(','))
{
range.LeftTo = range.LeftFrom + reader.ReadInt();
}
else
{
range.LeftTo = range.LeftFrom;
}
reader.SkipWhitespace();
reader.Skip('+');
range.RightFrom = reader.ReadInt();
if (reader.Skip(','))
{
range.RightTo = range.RightFrom + reader.ReadInt();
}
else
{
range.RightTo = range.RightFrom;
}
reader.SkipWhitespace();
reader.Skip("@@");
return range;
}
示例2: ParseStatus
internal static IEnumerable<FileStatus> ParseStatus(IStringReader reader)
{
reader.SkipWhitespace();
while (!reader.Done)
{
var subReader = reader.ReadLine().AsReader();
string status = subReader.ReadUntilWhitespace().Trim();
string path = subReader.ReadLine().Trim();
yield return new FileStatus(path, ConvertStatus(status));
reader.SkipWhitespace();
}
}
示例3: ParseSummary
internal static void ParseSummary(IStringReader reader, ChangeSetDetail detail)
{
reader.SkipWhitespace();
while (!reader.Done)
{
string line = reader.ReadLine();
if (ParserHelpers.IsSingleNewLine(line))
{
break;
}
else if (line.Contains('\t'))
{
// n n path
string[] parts = line.Split('\t');
int insertions;
Int32.TryParse(parts[0], out insertions);
int deletions;
Int32.TryParse(parts[1], out deletions);
string path = parts[2].TrimEnd();
detail.Files[path] = new FileInfo
{
Insertions = insertions,
Deletions = deletions,
Binary = parts[0] == "-" && parts[1] == "-"
};
}
else
{
// n files changed, n insertions(+), n deletions(-)
ParserHelpers.ParseSummaryFooter(line, detail);
}
}
}
示例4: ParseCommit
internal static ChangeSet ParseCommit(IStringReader reader)
{
// commit hash
reader.ReadUntilWhitespace();
reader.SkipWhitespace();
string id = reader.ReadUntilWhitespace();
// Merges will have (from hash) so we're skipping that
reader.ReadLine();
string author = null;
string email = null;
string date = null;
while (!reader.Done)
{
string line = reader.ReadLine();
if (ParserHelpers.IsSingleNewLine(line))
{
break;
}
var subReader = line.AsReader();
string key = subReader.ReadUntil(':');
// Skip :
subReader.Skip();
subReader.SkipWhitespace();
string value = subReader.ReadToEnd().Trim();
if (key.Equals("Author", StringComparison.OrdinalIgnoreCase))
{
// Author <email>
var authorReader = value.AsReader();
author = authorReader.ReadUntil('<').Trim();
authorReader.Skip();
email = authorReader.ReadUntil('>');
}
else if (key.Equals("Date", StringComparison.OrdinalIgnoreCase))
{
date = value;
}
}
var messageBuilder = new StringBuilder();
while (!reader.Done)
{
string line = reader.ReadLine();
if (ParserHelpers.IsSingleNewLine(line))
{
break;
}
messageBuilder.Append(line);
}
string message = messageBuilder.ToString();
return new ChangeSet(id, author, email, message, DateTimeOffset.ParseExact(date, "ddd MMM d HH:mm:ss yyyy zzz", CultureInfo.InvariantCulture));
}