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


C# Framework.Scope类代码示例

本文整理汇总了C#中RegexWizard.Framework.Scope的典型用法代码示例。如果您正苦于以下问题:C# Scope类的具体用法?C# Scope怎么用?C# Scope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Scope类属于RegexWizard.Framework命名空间,在下文中一共展示了Scope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSplitPoints

        public List<SplitPoint> GetSplitPoints(Scope root, int newScopeStartIndex, int newScopeLength)
        {
            List<SplitPoint> splitPoints = new List<SplitPoint>();
            if(root.IsFlat)
            {
                return splitPoints;
            }
            int requestedEndPos = newScopeStartIndex + newScopeLength - 1;
            Scope innerLeft = root.FindInnerScope(newScopeStartIndex, 1);
            Scope innerRight = root.FindInnerScope(requestedEndPos, 1);

            bool isSpillingLeft = (innerLeft.StartPosInRootScope < newScopeStartIndex);
            bool isSpillingRight = (innerRight.EndPosInRootScope > requestedEndPos);

            if (isSpillingLeft)
            {
                int splitLength = (innerLeft.EndPosInRootScope-newScopeStartIndex)+1;
                splitPoints.Add(new  SplitPoint(newScopeStartIndex, splitLength));
            }
            if (isSpillingRight)
            {
                int splitLength = (requestedEndPos-innerRight.StartPosInRootScope)+1;
                splitPoints.Add(new SplitPoint(innerRight.StartPosInRootScope, splitLength));
            //                splitPoints.Add(new SplitPoint(requestedEndPos, splitLength));
            }
            return splitPoints;
        }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:27,代码来源:ScopeSPlitter.cs

示例2: addScopeLeaf

        private void addScopeLeaf(TreeNode parentTreeNode, string label, Scope scope)
        {
            if (scope == null) return;

            TreeNode newNode = parentTreeNode.Nodes.Add(key(scope),"["+ scope.StartPosInRootScope + "-" + scope.Length +"]" + scope.Text.Replace("\n", "\\n"));
            newNode.Tag = scope;
            AddScope(scope, newNode);
        }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:8,代码来源:ScopeTreeView.cs

示例3: DrawCustomForSingleSurroundingRect

 protected internal override void DrawCustomForSingleSurroundingRect(Rectangle rect, Scope scopeToDraw)
 {
     startLineIndex = txt.GetLineFromCharIndex(scopeToDraw.StartPosInRootScope);
     endLineIndex = txt.GetLineFromCharIndex(scopeToDraw.EndPosInRootScope);
     string text = string.Format("Start:{0},End:{1}",startLineIndex,endLineIndex);
     txt.FindForm().Text = text;
     //            Font font = new Font(txt.Font.FontFamily,txt.Font.Size*2);
     //            graphics.DrawString(text,font,Brushes.Red,txt.Location);
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:9,代码来源:DebuggingMarker.cs

示例4: GetFirstNamedParentScopeFor

 private Scope GetFirstNamedParentScopeFor(Scope child)
 {
     Scope parent = child.ParentScope;
     while (parent!=null && parent.Name==string.Empty)
     {
         parent = parent.ParentScope;
     }
     return parent;
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:9,代码来源:VisualScopeDrawingLogic.cs

示例5: Highlight

 public void Highlight(Scope s)
 {
     HideSelection = false;
     TreeNode[] found = Nodes.Find(key(s),true);
     if(found.Length==0)
         return;
     TreeNode foundFirst = found[0];
     this.SelectedNode = foundFirst;
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:9,代码来源:ScopeTreeView.cs

示例6: doRunAutoScope

        private static void doRunAutoScope(RegexAdvisor advisor, Scope root)
        {
            ThreadStart start = delegate
                                        {
                                            advisor.AutoScope(root);
                                        };

                Thread runner = new Thread(start);
                runner.Start();
        }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:10,代码来源:MainForm.cs

示例7: VisualScopeMarker

 public VisualScopeMarker(Graphics g, Scope scopeToDraw, ScopeAwareRichTextBox txt)
     : base(g, txt, 0,0)
 {
     if (scopeToDraw==null)
     {
         return;
     }
     startIndex = scopeToDraw.StartPosInRootScope;
     length = scopeToDraw.Length;
       drawnScope = scopeToDraw;
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:11,代码来源:VisualScopeMarker.cs

示例8: AutoSplit

 public List<Scope> AutoSplit(Scope root, int startIndexForWantedScope, int lengthOfWantedScope, bool isImplicit)
 {
     List<Scope> newScopes = new List<Scope>();
     List<SplitPoint> splitPoints = GetSplitPoints(root, startIndexForWantedScope, lengthOfWantedScope);
     foreach (SplitPoint splitPoint in splitPoints)
     {
         Scope newInnerScope = Split(root, splitPoint, isImplicit);
         newScopes.Add(newInnerScope);
     }
     return newScopes;
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:11,代码来源:ScopeSPlitter.cs

示例9: DefineInnerScope_InCombinedParentOfTwoInners_SetsRootScopeOnInner

 public void DefineInnerScope_InCombinedParentOfTwoInners_SetsRootScopeOnInner()
 {
     Scope root = new     Scope("0123456789");
     Scope parent = root.DefineInnerScope(5, 4);
     //5678
     Scope combinedParent = root.DefineInnerScope(5, 5);//5678+9
     Scope innerChild = root.DefineInnerScope(6, 2);//67
     Assert.AreEqual(combinedParent.InnerLeftScope, innerChild.ParentScope);
     Assert.AreEqual(combinedParent, combinedParent.InnerLeftScope.ParentScope);
     Assert.AreEqual(combinedParent, combinedParent.InnerRightScope.ParentScope);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:11,代码来源:ScopeTests.cs

示例10: ScopeRenameAction

 public ScopeRenameAction(Scope scope, ScopeAwareRichTextBox text)
     : base(text, scope)
 {
     titlePrefix = "Rename";
     SetTitle();
     highlightFillColor = Color.Yellow;
     highlightFillOpacity = 80;
     highlightBorderColor = Color.Red;
     highlightBorderOpacity = 180;
     highlightBorderWidth = 2;
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:11,代码来源:ScopeRenameAction.cs

示例11: DefineInnerScope_WithleftMiddleandRightScopesasInner

        public void DefineInnerScope_WithleftMiddleandRightScopesasInner()
        {
            Scope root = new Scope("012345");
            root.DefineInnerScope(3, 1);//012|3|45
            ScopeSplitter splitter = new ScopeSplitter();
            splitter.AutoSplit(root, 2, 3, true);//01|(2|3|4)|5

            Scope encapsulator = root.DefineInnerScope(2, 3);
            Assert.AreEqual("2", encapsulator.InnerLeftScope.Text);
            Assert.AreEqual("3", encapsulator.InnerMiddleScope.Text);
            Assert.AreEqual("4", encapsulator.InnerRightScope.Text);
        }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:12,代码来源:ScopeTests.cs

示例12: DrawCustomForSingleSurroundingRect

        protected internal override void DrawCustomForSingleSurroundingRect(Rectangle rect, Scope scopeToDraw)
        {
            if (!IsActive && scopeToDraw.IsFlat && scopeToDraw.Name!=string.Empty)
            {
            //                new RegexMarker(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);
                new GroupNameMarker(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);
                return;
            }

            //            if (scopeToDraw.IsRoot && scopeToDraw.IsImplicit)
            //            {
            //                new VisualScopeInvisible(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);
            //                return;
            //            }

            if (IsActive)
            {
                Scope namedParent = GetFirstNamedParentScopeFor(scopeToDraw);
                if (namedParent!=null)
                {
                    new NamedParentMarker(graphics, namedParent, RTB).DrawCustomForSingleSurroundingRect(rect, namedParent);
                }
                new VisualScopeActive(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);

                return;
            }
            if (drawnScope.IsImplicit && drawnScope.IsFlat)
            {
            //                new VisualScopeImplicitFlat(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);
                return;

            }

            //            if (drawnScope.IsImplicit && !drawnScope.IsFlat)
            //            {
            //                new NamedParentMarker(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);
            //                return;
            //
            //            }
            if (!IsActive && drawnScope.IsExplicit && drawnScope.IsFlat)
            {
                new VisualScopeNonActiveNotImplicitFlat(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);
                return;
            }

            if (IsActive && drawnScope.IsExplicit  && drawnScope.IsFlat)
            {
                new VisualScopeActiveNotImplicitFlat(graphics, scopeToDraw, RTB).DrawCustomForSingleSurroundingRect(rect, scopeToDraw);
                return;
            }
        }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:51,代码来源:VisualScopeDrawingLogic.cs

示例13: DrawCustomForSingleSurroundingRect

        protected internal override void DrawCustomForSingleSurroundingRect(Rectangle rect, Scope scopeToDraw)
        {
            List<Rectangle> rects = txt.GetSurroundingRects(scopeToDraw.StartPosInRootScope,scopeToDraw.Length);
            int inflateFactor = 12;
            if(onMultipleLines(rects))
            {
                inflateFactor = 6;
            }
            foreach (Rectangle rec in rects)
            {
                Rectangle infaltedRect = GetInflated(true, rec, inflateFactor);
                txt.drawRectWithColor(infaltedRect,Color.Chocolate, graphics, 220,2);
            }

            return;
        }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:16,代码来源:NamedParentMarker.cs

示例14: GetSuggestions

 public List<Suggestion> GetSuggestions(Scope target)
 {
     RegexAdvisor advisor = new RegexAdvisor();
     advisor.MaxSuggestionLength = 45;
     TeachRules(advisor);
     string selection;
     if(target!=null)
     {
         selection = target.Text;
     }
     else
     {
         selection = txt.SelectedText;
     }
     return advisor.Suggest(selection);
 }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:16,代码来源:UIActionSuggestionProvider.cs

示例15: DrawCustomForSingleSurroundingRect

        protected internal override void DrawCustomForSingleSurroundingRect(Rectangle rect, Scope scopeToDraw)
        {
            DrawingParameters borderParameters = new DrawingParameters(Color.Empty, graphics, RTB.ImplicitScopeBorderColor, 35, RTB.NonActiveScopeBorderWidth);
            DrawingParameters fillParameters = new DrawingParameters(Color.Empty, graphics, 35);
            fillParameters.IsActive = IsActive;
            borderParameters.IsActive = IsActive;

            borderParameters.BorderColor = RTB.NonActiveScopeBorderColor;
            borderParameters.BorderWidth = RTB.NonActiveScopeBorderWidth;

            fillParameters.FillColor = RTB.NonActiveScopeFillColor;

            borderParameters.Rect = rect;
            fillParameters.Rect = rect;

            DrawBorder(borderParameters);
            DrawFill(fillParameters);
        }
开发者ID:Nullstr1ng,项目名称:dotnet-regex-tools,代码行数:18,代码来源:VisualScopeNonActiveNotImplicitFlat.cs


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