• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Document.TextDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SearchBracket

 public BracketSearchResult SearchBracket(TextDocument document, int offset)
 {
     BracketSearchResult result;
     if (offset > 0)
     {
         var charAt = document.GetCharAt(offset - 1);
         var num = "([{".IndexOf(charAt);
         var num2 = -1;
         if (num > -1)
         {
             num2 = SearchBracketForward(document, offset, "([{"[num], ")]}"[num]);
         }
         num = ")]}".IndexOf(charAt);
         if (num > -1)
         {
             num2 = SearchBracketBackward(document, offset - 2, "([{"[num], ")]}"[num]);
         }
         if (num2 > -1)
         {
             result = new BracketSearchResult(Math.Min(offset - 1, num2), 1, Math.Max(offset - 1, num2), 1);
             return result;
         }
     }
     result = null;
     return result;
 }
开发者ID:mookiejones,项目名称:miEditor,代码行数:26,代码来源:MyBracketSearcher.cs


示例2: RawData

 public RawData(string name, uint offset, string format, uint address, string value, int length, uint pluginLine)
     : base(name, offset, address, pluginLine)
 {
     _document = new TextDocument(new StringTextSource(value));
     _length = length;
     _format = format;
 }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:7,代码来源:RawData.cs


示例3: HeightTree

		public HeightTree(TextDocument document, double defaultLineHeight)
		{
			this.document = document;
			weakLineTracker = WeakLineTracker.Register(document, this);
			this.DefaultLineHeight = defaultLineHeight;
			RebuildDocument();
		}
开发者ID:bbqchickenrobot,项目名称:AvalonEdit,代码行数:7,代码来源:HeightTree.cs


示例4: BreakpointMarker

 public BreakpointMarker(TextMarkerService markerStrategy, Breakpoint bp, TextDocument doc, int line_begin, int line_end)
     : base(markerStrategy, doc, line_begin, line_end)
 {
     this.Breakpoint = bp;
     MarkerType = TextMarkerType.None;
     BackgroundColor = Colors.Red;
 }
开发者ID:aBothe,项目名称:DDebugger,代码行数:7,代码来源:BreakpointMarker.cs


示例5: DocumentViewModel

        public DocumentViewModel(
            IDialogService dialogService,
            IWindowManager windowManager,
            ISiteContextGenerator siteContextGenerator,
            Func<string, IMetaWeblogService> getMetaWeblog,
            ISettingsProvider settingsProvider,
            IDocumentParser documentParser)
        {
            this.dialogService = dialogService;
            this.windowManager = windowManager;
            this.siteContextGenerator = siteContextGenerator;
            this.getMetaWeblog = getMetaWeblog;
            this.settingsProvider = settingsProvider;
            this.documentParser = documentParser;

            FontSize = GetFontSize();

            title = "New Document";
            Original = "";
            Document = new TextDocument();
            Post = new Post();
            timer = new DispatcherTimer();
            timer.Tick += TimerTick;
            timer.Interval = delay;
        }
开发者ID:larsw,项目名称:DownmarkerWPF,代码行数:25,代码来源:DocumentViewModel.cs


示例6: AvalonEditDocumentAdapter

		/// <summary>
		/// Creates a new AvalonEditDocumentAdapter instance.
		/// </summary>
		/// <param name="document">The document to wrap.</param>
		/// <param name="parentServiceProvider">The service provider used for GetService calls.</param>
		public AvalonEditDocumentAdapter(TextDocument document, IServiceProvider parentServiceProvider)
		{
			if (document == null)
				throw new ArgumentNullException("document");
			this.document = document;
			this.parentServiceProvider = parentServiceProvider;
		}
开发者ID:ootsby,项目名称:SharpDevelop,代码行数:12,代码来源:AvalonEditDocumentAdapter.cs


示例7: CreateHtmlFragment

        /// <summary>
        /// Creates a HTML fragment from a part of a document.
        /// </summary>
        /// <param name="document">The document to create HTML from.</param>
        /// <param name="highlighter">The highlighter used to highlight the document. <c>null</c> is valid and will create HTML without any highlighting.</param>
        /// <param name="segment">The part of the document to create HTML for. You can pass <c>null</c> to create HTML for the whole document.</param>
        /// <param name="options">The options for the HTML creation.</param>
        /// <returns>HTML code for the document part.</returns>
        public static string CreateHtmlFragment(TextDocument document, IHighlighter highlighter, ISegment segment, HtmlOptions options)
        {
            if (document == null)
                throw new ArgumentNullException("document");
            if (options == null)
                throw new ArgumentNullException("options");
            if (highlighter != null && highlighter.Document != document)
                throw new ArgumentException("Highlighter does not belong to the specified document.");
            if (segment == null)
                segment = new SimpleSegment(0, document.TextLength);

            StringBuilder html = new StringBuilder();
            int segmentEndOffset = segment.EndOffset;
            DocumentLine line = document.GetLineByOffset(segment.Offset);
            while (line != null && line.Offset < segmentEndOffset) {
                HighlightedLine highlightedLine;
                if (highlighter != null)
                    highlightedLine = highlighter.HighlightLine(line.LineNumber);
                else
                    highlightedLine = new HighlightedLine(document, line);
                SimpleSegment s = segment.GetOverlap(line);
                if (html.Length > 0)
                    html.AppendLine("<br>");
                html.Append(highlightedLine.ToHtml(s.Offset, s.EndOffset, options));
                line = line.NextLine;
            }
            return html.ToString();
        }
开发者ID:Amichai,项目名称:PhysicsPad,代码行数:36,代码来源:HtmlClipboard.cs


示例8: ConvertTextDocumentToBlock

		public static Block ConvertTextDocumentToBlock(TextDocument document, IHighlighter highlighter)
		{
			if (document == null)
				throw new ArgumentNullException("document");
//			Table table = new Table();
//			table.Columns.Add(new TableColumn { Width = GridLength.Auto });
//			table.Columns.Add(new TableColumn { Width = new GridLength(1, GridUnitType.Star) });
//			TableRowGroup trg = new TableRowGroup();
//			table.RowGroups.Add(trg);
			Paragraph p = new Paragraph();
			foreach (DocumentLine line in document.Lines) {
				int lineNumber = line.LineNumber;
//				TableRow row = new TableRow();
//				trg.Rows.Add(row);
//				row.Cells.Add(new TableCell(new Paragraph(new Run(lineNumber.ToString()))) { TextAlignment = TextAlignment.Right });
				HighlightedInlineBuilder inlineBuilder = new HighlightedInlineBuilder(document.GetText(line));
				if (highlighter != null) {
					HighlightedLine highlightedLine = highlighter.HighlightLine(lineNumber);
					int lineStartOffset = line.Offset;
					foreach (HighlightedSection section in highlightedLine.Sections)
						inlineBuilder.SetHighlighting(section.Offset - lineStartOffset, section.Length, section.Color);
				}
//				Paragraph p = new Paragraph();
//				row.Cells.Add(new TableCell(p));
				p.Inlines.AddRange(inlineBuilder.CreateRuns());
				p.Inlines.Add(new LineBreak());
			}
			return p;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:29,代码来源:DocumentPrinter.cs


示例9: PythonConsoleHighlightingColorizer

 /// <summary>
 /// Creates a new HighlightingColorizer instance.
 /// </summary>
 /// <param name="ruleSet">The root highlighting rule set.</param>
 public PythonConsoleHighlightingColorizer(IHighlightingDefinition highlightingDefinition, TextDocument document)
     : base(new DocumentHighlighter(document, highlightingDefinition  ))
 {
     if (document == null)
         throw new ArgumentNullException("document");
     this.document = document;
 }
开发者ID:jmd,项目名称:ironlab,代码行数:11,代码来源:PythonConsoleHighlightingColorizer.cs


示例10: CreateView

		/// <summary>
		/// Creates a new <see cref="FixedHighlighter"/> for a copy of a portion
		/// of the input document (including the original highlighting).
		/// </summary>
		public static FixedHighlighter CreateView(IHighlighter highlighter, int offset, int endOffset)
		{
			var oldDocument = highlighter.Document;
			// ReadOnlyDocument would be better; but displaying the view in AvalonEdit
			// requires a TextDocument
			var newDocument = new TextDocument(oldDocument.CreateSnapshot(offset, endOffset - offset));
			
			var oldStartLine = oldDocument.GetLineByOffset(offset);
			var oldEndLine = oldDocument.GetLineByOffset(endOffset);
			int oldStartLineNumber = oldStartLine.LineNumber;
			HighlightedLine[] newLines = new HighlightedLine[oldEndLine.LineNumber - oldStartLineNumber + 1];
			highlighter.BeginHighlighting();
			try {
				for (int i = 0; i < newLines.Length; i++) {
					HighlightedLine oldHighlightedLine = highlighter.HighlightLine(oldStartLineNumber + i);
					IDocumentLine newLine = newDocument.GetLineByNumber(1 + i);
					HighlightedLine newHighlightedLine = new HighlightedLine(newDocument, newLine);
					MoveSections(oldHighlightedLine.Sections, -offset, newLine.Offset, newLine.EndOffset, newHighlightedLine.Sections);
					newHighlightedLine.ValidateInvariants();
					newLines[i] = newHighlightedLine;
				}
			} finally {
				highlighter.EndHighlighting();
			}
			return new FixedHighlighter(newDocument, newLines);
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:30,代码来源:FixedHighlighter.cs


示例11: IndentLines

		/// <summary>
		/// Reindents a set of lines.
		/// </summary>
		/// <param name="document"></param>
		/// <param name="beginLine"></param>
		/// <param name="endLine"></param>
		public void IndentLines(TextDocument document, int beginLine, int endLine)
		{
			for (var i = beginLine; i <= endLine; i++)
			{
				IndentLine(document, document.GetLineByNumber(i));
			}
		}
开发者ID:andrebelanger,项目名称:HTMLEditor,代码行数:13,代码来源:HtmlIndentationStrategy.cs


示例12: IndentLine

 public void IndentLine(TextDocument document, DocumentLine line)
 {
     if (document == null || line == null)
     {
         return;
     }
     DocumentLine previousLine = line.PreviousLine;
     if (previousLine != null)
     {
         ISegment indentationSegment = TextUtilities.GetWhitespaceAfter(document, previousLine.Offset);
         string indentation = document.GetText(indentationSegment);
         if (Program.OptionsObject.Editor_AgressiveIndentation)
         {
             string currentLineTextTrimmed = (document.GetText(line)).Trim();
             string lastLineTextTrimmed = (document.GetText(previousLine)).Trim();
             char currentLineFirstNonWhitespaceChar = ' ';
             if (currentLineTextTrimmed.Length > 0)
             {
                 currentLineFirstNonWhitespaceChar = currentLineTextTrimmed[0];
             }
             char lastLineLastNonWhitespaceChar = ' ';
             if (lastLineTextTrimmed.Length > 0)
             {
                 lastLineLastNonWhitespaceChar = lastLineTextTrimmed[lastLineTextTrimmed.Length - 1];
             }
             if (lastLineLastNonWhitespaceChar == '{' && currentLineFirstNonWhitespaceChar != '}')
             {
                 indentation += "\t";
             }
             else if (currentLineFirstNonWhitespaceChar == '}')
             {
                 if (indentation.Length > 0)
                 {
                     indentation = indentation.Substring(0, indentation.Length - 1);
                 }
                 else
                 {
                     indentation = string.Empty;
                 }
             }
             /*if (lastLineTextTrimmed == "{" && currentLineTextTrimmed != "}")
             {
                 indentation += "\t";
             }
             else if (currentLineTextTrimmed == "}")
             {
                 if (indentation.Length > 0)
                 {
                     indentation = indentation.Substring(0, indentation.Length - 1);
                 }
                 else
                 {
                     indentation = string.Empty;
                 }
             }*/
         }
         indentationSegment = TextUtilities.GetWhitespaceAfter(document, line.Offset);
         document.Replace(indentationSegment, indentation);
     }
 }
开发者ID:not1ce111,项目名称:Spedit,代码行数:60,代码来源:EditorIndetation.cs


示例13: IndentLine

        public virtual void IndentLine(TextDocument document, DocumentLine line)
        {
            if(line == null)
                throw new ArgumentNullException("line");

            formatting_strategy.IndentLine(editor, editor.Document.GetLineByNumber(line.LineNumber));
        }
开发者ID:hazama-yuinyan,项目名称:BVEEditor,代码行数:7,代码来源:IndentationStrategyAdapter.cs


示例14: LoadDocumentFromBuffer

		/// <summary>
		/// Creates a new mutable document from the specified text buffer.
		/// </summary>
		/// <remarks>
		/// Use the more efficient <see cref="LoadReadOnlyDocumentFromBuffer"/> if you only need a read-only document.
		/// </remarks>
		public static IDocument LoadDocumentFromBuffer(ITextBuffer buffer)
		{
			if (buffer == null)
				throw new ArgumentNullException("buffer");
			var doc = new TextDocument(GetTextSource(buffer));
			return new AvalonEditDocumentAdapter(doc, null);
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:13,代码来源:DocumentUtilitites.cs


示例15: TextMarkerService

 public TextMarkerService(TextDocument document)
 {
     if (document == null)
         throw new ArgumentNullException("document");
     this.document = document;
     this.markers = new TextSegmentCollection<TextMarker>(document);
 }
开发者ID:gdv1811,项目名称:PdfCodeEditor,代码行数:7,代码来源:TextMarkerService.cs


示例16: SetUpFixture

		public void SetUpFixture()
		{
			string ruby = "class Test\r\n" +
							"\tdef initialize\r\n" +
							"\t\tputs 'test'\r\n" +
							"\tend\r\n" +
							"end";
			
			DefaultProjectContent projectContent = new DefaultProjectContent();
			RubyParser parser = new RubyParser();
			compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby);			
			if (compilationUnit.Classes.Count > 0) {
				c = compilationUnit.Classes[0];
				if (c.Methods.Count > 0) {
					method = c.Methods[0];
				}
				
				TextArea textArea = new TextArea();
				document = new TextDocument();
				textArea.Document = document;
				textArea.Document.Text = ruby;
				
				// Get folds.
				ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea);
				
				ParseInformation parseInfo = new ParseInformation(compilationUnit);
				foldingStrategy.UpdateFoldings(parseInfo);
				List<FoldingSection> folds = new List<FoldingSection>(foldingStrategy.FoldingManager.AllFoldings);
			
				if (folds.Count > 1) {
					classFold = folds[0];
					methodFold = folds[1];
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:35,代码来源:ParseClassWithCtorTestFixture.cs


示例17: LineAdapter

			public LineAdapter(TextDocument document, DocumentLine line)
			{
				Debug.Assert(document != null);
				Debug.Assert(line != null);
				this.document = document;
				this.line = line;
			}
开发者ID:ootsby,项目名称:SharpDevelop,代码行数:7,代码来源:AvalonEditDocumentAdapter.cs


示例18: ClassMemberBookmark

		public ClassMemberBookmark(IMember member, TextDocument document)
		{
			this.member = member;
			int lineNr = member.Region.BeginLine;
			if (document != null && lineNr > 0 && lineNr <= document.LineCount)
				this.line = document.GetLineByNumber(lineNr);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:ClassMemberBookmark.cs


示例19: Initialize

		public void Initialize(IDocument document)
		{
			if (changeList != null && changeList.Any())
				return;
			
			this.document = document;
			this.textDocument = (TextDocument)document.GetService(typeof(TextDocument));
			this.changeList = new CompressingTreeList<LineChangeInfo>((x, y) => x.Equals(y));
			
			Stream baseFileStream = GetBaseVersion();
			
			// TODO : update baseDocument on VCS actions
			if (baseFileStream != null) {
				// ReadAll() is taking care of closing the stream
				baseDocument = DocumentUtilitites.LoadReadOnlyDocumentFromBuffer(new StringTextBuffer(ReadAll(baseFileStream)));
			} else {
				if (baseDocument == null) {
					// if the file is not under subversion, the document is the opened document
					var doc = new TextDocument(textDocument.Text);
					baseDocument = new AvalonEditDocumentAdapter(doc, null);
				}
			}
			
			SetupInitialFileState(false);
			
			this.textDocument.LineTrackers.Add(this);
			this.textDocument.UndoStack.PropertyChanged += UndoStackPropertyChanged;
		}
开发者ID:xiaochuwang,项目名称:SharpDevelop-master,代码行数:28,代码来源:DefaultChangeWatcher.cs


示例20: PythonConsoleHighlightingColorizer

 /// <summary>
 /// Creates a new HighlightingColorizer instance.
 /// </summary>
 /// <param name="ruleSet">The root highlighting rule set.</param>
 public PythonConsoleHighlightingColorizer(HighlightingRuleSet ruleSet, TextDocument document)
     : base(ruleSet)
 {
     if (document == null)
         throw new ArgumentNullException("document");
     this.document = document;
 }
开发者ID:goutkannan,项目名称:ironlab,代码行数:11,代码来源:PythonConsoleHighlightingColorizer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Editing.TextArea类代码示例发布时间:2022-05-26
下一篇:
C# Document.TextAnchorNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap