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


C# Block.IndexOf方法代码示例

本文整理汇总了C#中Block.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# Block.IndexOf方法的具体用法?C# Block.IndexOf怎么用?C# Block.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block的用法示例。


在下文中一共展示了Block.IndexOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main(string[] args)
 {
     InitComplements();
       var seq = new List<byte[]>();
       var b = new Block { Count = -1 };
       Index line = Index.None, start = Index.None, end = Index.None;
       using (var r = new BinaryReader(Console.OpenStandardInput())) {
      using (var w = Console.OpenStandardOutput()) {
         while (b.Read(r) > 0) {
            seq.Add(b.Data);
            if (line.Pos < 0) line = b.IndexOf(Gt, 0);
            while (line.Pos >= 0) {
               if (start.Pos < 0) {
                  var off = line.InBlock(b) ? line.Pos : 0;
                  start = b.IndexOf(Lf, off);
                  if (start.Pos < 0) {
                      w.Write(b.Data, off, b.Data.Length - off);
                      seq.Clear(); break;
                  }
                  w.Write(b.Data, off, start.Pos + 1 - off);
               }
               if (end.Pos < 0) {
                  end = b.IndexOf(Gt, start.InBlock(b) ? start.Pos : 0);
                  if (end.Pos < 0) break;
               }
               w.Reverse(start.Pos, end.Pos, seq);
               if (seq.Count > 1) seq.RemoveRange(0, seq.Count - 1);
               line = end; end = Index.None; start = Index.None;
            }
         }
         if (start.Pos >= 0 && end.Pos < 0)
            w.Reverse(start.Pos, seq[seq.Count -1].Length, seq);
      }
       }
 }
开发者ID:kjk,项目名称:kjkpub,代码行数:35,代码来源:revcomp.cs

示例2: PreviousStatementIndex

        private static int PreviousStatementIndex(Block node, AstNode child)
        {
            // get the index of the statement before the last return
            // (skip over function decls and importand comments)
            var indexPrevious = node.IndexOf(child) - 1;
            while (indexPrevious >= 0 && (node[indexPrevious] is FunctionObject || node[indexPrevious] is ImportantComment))
            {
                --indexPrevious;
            }

            return indexPrevious;
        }
开发者ID:nuxleus,项目名称:ajaxmin,代码行数:12,代码来源:AnalyzeNodeVisitor.cs


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