当前位置: 首页>>代码示例>>C#>>正文


C# IStringReader.SkipWhitespace方法代码示例

本文整理汇总了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;
 }
开发者ID:GregPerez83,项目名称:kudu,代码行数:30,代码来源:GitExeRepository.cs

示例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();
            }
        }
开发者ID:GregPerez83,项目名称:kudu,代码行数:13,代码来源:GitExeRepository.cs

示例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);
                }
            }
        }
开发者ID:GregPerez83,项目名称:kudu,代码行数:36,代码来源:GitExeRepository.cs

示例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));
        }
开发者ID:GregPerez83,项目名称:kudu,代码行数:59,代码来源:GitExeRepository.cs


注:本文中的IStringReader.SkipWhitespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。