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

C# ISegment类代码示例

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

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



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

示例1: Complete

 public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs)
 {
     var instance = ServiceLocator.Current.GetInstance<MainViewModel>();
     var text = instance.ActiveEditor.TextBox.FindWord();
     var offset = completionSegment.Offset - text.Length;
     textArea.Document.Replace(offset, text.Length, Text);
 }
开发者ID:mookiejones,项目名称:miEditor,代码行数:7,代码来源:CodeCompletion.cs


示例2: SegmentReader

        public SegmentReader(ISegment segment, IWebReader webReader, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices)
        {
            if (null == segment)
                throw new ArgumentNullException(nameof(segment));
            if (null == webReader)
                throw new ArgumentNullException(nameof(webReader));
            if (null == webMetadataFactory)
                throw new ArgumentNullException(nameof(webMetadataFactory));
            if (null == retryManager)
                throw new ArgumentNullException(nameof(retryManager));
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));

            _segment = segment;
            _webReader = webReader;
            _webMetadataFactory = webMetadataFactory;
            _retryManager = retryManager;
            _platformServices = platformServices;

            if ((segment.Offset >= 0) && (segment.Length > 0))
            {
                _startOffset = segment.Offset;
                _endOffset = segment.Offset + segment.Length - 1;
            }
        }
开发者ID:henricj,项目名称:phonesm,代码行数:25,代码来源:SegmentReader.cs


示例3: IsInOriginal

		public bool IsInOriginal (ISegment segment)
		{
			if (segment == null)
				throw new ArgumentNullException ("segment");

			return segment.Contains(Offset) && segment.Contains (Offset + Length); 
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:ProjectedSegment.cs


示例4: PackMessage

 internal static Sequence PackMessage(VersionCode version, ISegment header, SecurityParameters parameters, ISegment scope, IPrivacyProvider privacy)
 {
     if (scope == null)
     {
         throw new ArgumentNullException("scope");
     }
     
     if (parameters == null)
     {
         throw new ArgumentNullException("parameters");
     }
     
     if (header == null)
     {
         throw new ArgumentNullException("header");
     }
     
     if (privacy == null)
     {
         throw new ArgumentNullException("privacy");
     }
     
     ISnmpData[] collection = new ISnmpData[4]
                                      {
                                          new Integer32((int)version),
                                          header.GetData(version),
                                          parameters.GetData(version),
                                          privacy.Encrypt(scope.GetData(version), parameters)
                                      };
     return new Sequence(collection);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:31,代码来源:SnmpMessageExtension.cs


示例5: 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


示例6: Complete

 public virtual void Complete(TextArea textArea, ISegment completionSegment,
     EventArgs insertionRequestEventArgs)
 {
   textArea.Document.Replace(completionSegment, Action == null ? this.Text : Action.Invoke());
   if (CaretOffset != 0)
     textArea.Caret.Offset += CaretOffset;
 }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:7,代码来源:BasicCompletionData.cs


示例7: SimpleSelection

 /// <summary>
 /// Creates a new SimpleSelection instance.
 /// </summary>
 public SimpleSelection(ISegment segment)
 {
     if (segment == null)
         throw new ArgumentNullException("segment");
     this.startOffset = segment.Offset;
     this.endOffset = startOffset + segment.Length;
 }
开发者ID:richardschneider,项目名称:ILSpy,代码行数:10,代码来源:SimpleSelection.cs


示例8: CodeSegmentPreviewWindow

		public CodeSegmentPreviewWindow (TextEditor editor, bool hideCodeSegmentPreviewInformString, ISegment segment, int width, int height) : base (Gtk.WindowType.Popup)
		{
			this.HideCodeSegmentPreviewInformString = hideCodeSegmentPreviewInformString;
			this.editor = editor;
			this.AppPaintable = true;
			layout = PangoUtil.CreateLayout (this);
			informLayout = PangoUtil.CreateLayout (this);
			informLayout.SetText (CodeSegmentPreviewInformString);
			
			fontDescription = Pango.FontDescription.FromString (editor.Options.FontName);
			fontDescription.Size = (int)(fontDescription.Size * 0.8f);
			layout.FontDescription = fontDescription;
			layout.Ellipsize = Pango.EllipsizeMode.End;
			// setting a max size for the segment (40 lines should be enough), 
			// no need to markup thousands of lines for a preview window
			int startLine = editor.Document.OffsetToLineNumber (segment.Offset);
			int endLine = editor.Document.OffsetToLineNumber (segment.EndOffset);
			const int maxLines = 40;
			bool pushedLineLimit = endLine - startLine > maxLines;
			if (pushedLineLimit)
				segment = new Segment (segment.Offset, editor.Document.GetLine (startLine + maxLines).Offset - segment.Offset);
			layout.Ellipsize = Pango.EllipsizeMode.End;
			layout.SetMarkup (editor.Document.SyntaxMode.GetMarkup (editor.Document,
			                                                        editor.Options,
			                                                        editor.ColorStyle,
			                                                        segment.Offset,
			                                                        segment.Length,
			                                                        true) + (pushedLineLimit ? Environment.NewLine + "..." : ""));
			CalculateSize ();
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:30,代码来源:CodeSegmentPreviewWindow.cs


示例9: GetSegmentComment

 public List<string> GetSegmentComment(ISegment segment)
 {
     _Comments.Clear();
     VisitChildren(segment);
 
     return _Comments;
 }
开发者ID:desautel,项目名称:Sdl-Community,代码行数:7,代码来源:TMXTextExtractor.cs


示例10: AddSegment

 /// <summary>
 /// Adds the specified segment to the geometry.
 /// </summary>
 public void AddSegment(TextView textView, ISegment segment)
 {
     if (textView == null)
         throw new ArgumentNullException(nameof(textView));
     Size pixelSize = PixelSnapHelpers.GetPixelSize(textView);
     foreach (Rect r in GetRectsForSegment(textView, segment, ExtendToFullWidthAtLineEnd))
     {
         if (AlignToWholePixels)
         {
             AddRectangle(PixelSnapHelpers.Round(r.Left, pixelSize.Width),
                          PixelSnapHelpers.Round(r.Top + 1, pixelSize.Height),
                          PixelSnapHelpers.Round(r.Right, pixelSize.Width),
                          PixelSnapHelpers.Round(r.Bottom + 1, pixelSize.Height));
         }
         else if (AlignToMiddleOfPixels)
         {
             AddRectangle(PixelSnapHelpers.PixelAlign(r.Left, pixelSize.Width),
                          PixelSnapHelpers.PixelAlign(r.Top + 1, pixelSize.Height),
                          PixelSnapHelpers.PixelAlign(r.Right, pixelSize.Width),
                          PixelSnapHelpers.PixelAlign(r.Bottom + 1, pixelSize.Height));
         }
         else
         {
             AddRectangle(r.Left, r.Top + 1, r.Right, r.Bottom + 1);
         }
     }
 }
开发者ID:arkanoid1,项目名称:Yanitta,代码行数:30,代码来源:BackgroundGeometryBuilder.cs


示例11: GetPlainText

 // Returns the plain text representation of a segment.
 // If the includeTagText parameter is true, the returned string will
 // also contain the tag content for each tag.
 public string GetPlainText(ISegment segment, bool includeTagText)
 {
     PlainText = new StringBuilder(string.Empty);
     IncludeTagText = includeTagText;
     VisitChildren(segment);
     return PlainText.ToString();
 }
开发者ID:cromica,项目名称:SdlXliffReaderExample,代码行数:10,代码来源:ContentGenerator.cs


示例12: NumberVerifierMessageUI

        public NumberVerifierMessageUI(MessageEventArgs messageEventArgs, IBilingualDocument bilingualDocument, ISegment sourceSegment, ISegment targetSegment)
        {
            MessageEventArgs = messageEventArgs;
            BilingualDocument = bilingualDocument;
            SourceSegment = sourceSegment;
            TargetSegment = targetSegment;
            InitializeComponent();
            
            _sourceSegmentControl.Dock = DockStyle.Fill;
            _sourceSegmentControl.IsReadOnly = false;
            _sourceSegmentControl.ReplaceDocumentSegment(sourceSegment.Clone() as ISegment);
            panel_Source.Controls.Add(_sourceSegmentControl);
            _sourceSegmentControl.ReplaceDocumentSegment(sourceSegment);

            _targetSegmentControl.Dock = DockStyle.Fill;
            _targetSegmentControl.IsReadOnly = false;
            _targetSegmentControl.ReplaceDocumentSegment(targetSegment.Clone() as ISegment);
            panel_Target.Controls.Add(_targetSegmentControl);
            _targetSegmentControl.ReplaceDocumentSegment((ISegment)targetSegment.Clone());

            _targetSegmentControl.SegmentContentChanged += OnSegmentContentChanged;

            _hasSegmentChanged = false;

            UpdateMessage(messageEventArgs);


        }
开发者ID:desautel,项目名称:Sdl-Community,代码行数:28,代码来源:NumberVerifierMessageUI.cs


示例13: ShowCompletionWindow

 /// <summary>
 /// Shows completion window for passed functions.
 /// </summary>
 /// <param name="identifierSegment">optional segment that should be included in the progressive search: eg. part of an identifier that's already typed before code completion was started</param>
 /// <param name="functions"></param>
 public void ShowCompletionWindow(ISegment identifierSegment, IList<Function> functions)
 {
     FunctionCompletionData first = null;
     _completionWindow = new CompletionWindow(textEditor.TextArea);
     foreach (var function in functions)
     {
         var tooltip = string.IsNullOrWhiteSpace(function.Definition) ? function.Description : string.Format("{0}\n\n{1}", function.Definition.Replace("|", Environment.NewLine), function.Description);
         var item = new FunctionCompletionData(function.Name, tooltip);
         if (first == null) first = item;
         _completionWindow.CompletionList.CompletionData.Add(item);
     }
     _completionWindow.StartOffset = identifierSegment.Offset;
     _completionWindow.EndOffset = identifierSegment.EndOffset;
     if (first != null)
     {
         _completionWindow.CompletionList.SelectedItem = first;
     }
     _completionWindow.Show();
     _completionWindow.Closed += (sender, args) => _completionWindow = null;
     _completionWindow.PreviewTextInput += (sender, args) =>
     {
         if (args.Text == "(")
         {
             _completionWindow.CompletionList.RequestInsertion(EventArgs.Empty);
         }
         var c = args.Text[args.Text.Length - 1];
         args.Handled = !char.IsLetterOrDigit(c) && c != '_';
     };
 }
开发者ID:thomasvt,项目名称:EffectEd,代码行数:34,代码来源:HlslEdit.xaml.cs


示例14: Process

 public void Process(ISegment segment)
 {
     _plainText = new StringBuilder();
     _comments.Clear();
     _tokens.Clear();
     VisitChildren(segment);
 }
开发者ID:chiccorosso,项目名称:Sdl-Community,代码行数:7,代码来源:DataExtractor.cs


示例15: CustomMessageControl

        /// <summary>
        /// Constructor that takes the given message event args, bilingual document, source segment and target segment.
        /// </summary>
        /// <param name="messageEventArgs">message event arguments</param>
        /// <param name="bilingualDocument">bilingual document</param>
        /// <param name="sourceSegment">source segment</param>
        /// <param name="targetSegment">target segment</param>
        public CustomMessageControl(MessageEventArgs messageEventArgs, IBilingualDocument bilingualDocument, ISegment sourceSegment, ISegment targetSegment)
        {
            MessageEventArgs = messageEventArgs;
            BilingualDocument = bilingualDocument;
            SourceSegment = sourceSegment;
            TargetSegment = targetSegment;
            InitializeComponent();
            
            _sourceSegmentControl.Dock = DockStyle.Fill;
            _sourceSegmentPanel.Controls.Add(_sourceSegmentControl);

            _targetSegmentControl.Dock = DockStyle.Fill;
            _targetSegmentPanel.Controls.Add(_targetSegmentControl);

            UpdateMessage(messageEventArgs);
            UpdateSourceSegment(sourceSegment);
            UpdateTargetSegment((ISegment)targetSegment.Clone());
            UpdateProblemDescription(messageEventArgs);
            UpdateSuggestions(messageEventArgs);

            // make the target segment editable
            _targetSegmentControl.IsReadOnly = false;

            _suggestionsList.SelectedIndexChanged += _suggestionsList_SelectedIndexChanged;
        }
开发者ID:desautel,项目名称:Sdl-Community,代码行数:32,代码来源:CustomMessageControl.cs


示例16: GetDeletableSegments

		public IEnumerable<ISegment> GetDeletableSegments(ISegment segment)
		{
			if (segment == null)
				throw new ArgumentNullException("segment");
			// the segment is always deletable
			return ExtensionMethods.Sequence(segment);
		}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:NoReadOnlySections.cs


示例17: Complete

 public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs)
 {
     if (m_jsonEditorViewModel.IsBetweenQoats)
       {
     int offset = m_jsonEditorViewModel.Caret.Offset;
     List<char> startChars = new List<char> {m_autoCompleteValue.SchemaObject.AutoCompletePathSeperator, '"'};
     if (m_autoCompleteValue.SchemaObject.Prefix.Length > 0)
       startChars.Add(m_autoCompleteValue.SchemaObject.Prefix.Last());
     int indexQuotStart = m_jsonEditorViewModel.TextDocument.Text.LastIndexOfAny(startChars.ToArray(), offset - 1, offset - 1) + 1;
     int indexQuatEnd = m_jsonEditorViewModel.TextDocument.Text.IndexOf('"', offset);
     int indexLineBreak = m_jsonEditorViewModel.TextDocument.Text.IndexOf('\n', offset);
     if (indexQuatEnd >= indexQuotStart && indexQuatEnd < indexLineBreak)
       completionSegment = new SelectionSegment(indexQuotStart, indexQuatEnd);
       }
       int endOffset = completionSegment.Offset + Text.Length;
       textArea.Document.Replace(completionSegment, (Text + m_autoCompleteValue.SchemaObject.Suffix).Replace("\\", "\\\\"));
       m_jsonEditorViewModel.Caret.Offset = endOffset;
       string value = m_autoCompleteValue.SchemaObject.RemovePrefixAndSuffix(m_jsonEditorViewModel.GetCurrentValue());
       if (Text.StartsWith(".." + m_autoCompleteValue.SchemaObject.AutoCompletePathSeperator) && value.Any(char.IsLetterOrDigit))
       {
     value = value.Substring(0, value.Length - 4);
     int startIndex = value.LastIndexOf(m_autoCompleteValue.SchemaObject.AutoCompletePathSeperator);
     if (startIndex == -1)
       startIndex = m_autoCompleteValue.SchemaObject.Prefix.Length;
     else
     {
       startIndex++;
     }
     m_jsonEditorViewModel.TextDocument.Replace(
       m_jsonEditorViewModel.Caret.Offset - 4 - (value.Length - startIndex), (value.Length - startIndex) + 4, "");
       }
       m_jsonEditorViewModel.UpdateAutoCompletList = true;
 }
开发者ID:grarup,项目名称:SharpE,代码行数:33,代码来源:FileCompletionDataViewModel.cs


示例18: Reference

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Return a Reference (e.g., Scripture reference, or text abbreviation/para #/sentence#) for the specified character
		/// position (in the whole paragraph), which is assumed to belong to the specified segment.
		/// (For now, ich is not actually used, but it may become important if we decide not to split segements for
		/// verse numbers.)
		/// Overridden in ScrTxtPara to handle special cases for Scripture refs.
		/// </summary>
		/// <param name="seg">The segment.</param>
		/// <param name="ich">The character position.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public virtual ITsString Reference(ISegment seg, int ich)
		{
			IStText stText = Owner as IStText;
			if (stText == null)
			{
				// Unusual case, possibly hvoPara is not actually a para at all, for example, it may
				// be a picture caption. For now we make an empty reference so at least it won't crash.
				ITsStrFactory tsf = TsStrFactoryClass.Create();
				return tsf.MakeString("", Cache.DefaultUserWs);
			}
			ITsString tssName = null;
			bool fUsingAbbreviation = false;
			if (stText.Owner is IText)
			{
				// see if we can find an abbreviation.
				IText text = (IText)stText.Owner;
				tssName = text.Abbreviation.BestVernacularAnalysisAlternative;
				if (tssName != null && tssName.Length > 0 && tssName.Text != text.Abbreviation.NotFoundTss.Text)
					fUsingAbbreviation = true;
			}

			if (!fUsingAbbreviation)
				tssName = stText.Title.BestVernacularAnalysisAlternative;

			ITsStrBldr bldr = tssName.GetBldr();
			// If we didn't find a "best", reset to an empty string.
			if (bldr.Length > 0 && bldr.Text == stText.Title.NotFoundTss.Text)
				bldr.ReplaceTsString(0, bldr.Length, null);
			// Truncate to 8 chars, if the user hasn't specified an abbreviation.
			if (!fUsingAbbreviation && bldr.Length > 8)
				bldr.ReplaceTsString(8, bldr.Length, null);

			// Make a TsTextProps specifying just the writing system.
			ITsPropsBldr propBldr = TsPropsBldrClass.Create();
			int dummy;
			int wsActual = bldr.get_Properties(0).GetIntPropValues((int)FwTextPropType.ktptWs, out dummy);
			propBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, wsActual);
			ITsTextProps props = propBldr.GetTextProps();

			// Insert a space (if there was any title)
			if (bldr.Length > 0)
				bldr.Replace(bldr.Length, bldr.Length, " ", props);

			// if Scripture.IsResponsibleFor(stText) we should try to get the verse number of the annotation.
			//if (stText.OwningFlid == (int)Text.TextTags.kflidContents)
			//{

			// Insert paragraph number.
			int ipara = stText.ParagraphsOS.IndexOf(this) + 1;
			bldr.Replace(bldr.Length, bldr.Length, ipara.ToString(), props);

			// And a period...
			bldr.Replace(bldr.Length, bldr.Length, ".", props);

			// And now the segment number
			int iseg = SegmentsOS.IndexOf(seg) + 1;
			bldr.Replace(bldr.Length, bldr.Length, iseg.ToString(), props);
			return bldr.GetString();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:71,代码来源:StTxtPara.cs


示例19: SearchLocation

		public SearchLocation(SearchTarget target, string baseDirectory, string filter, bool searchSubdirs, ISegment selection)
		{
			this.Target = target;
			this.BaseDirectory = baseDirectory;
			this.Filter = filter ?? "*.*";
			this.SearchSubdirs = searchSubdirs;
			this.Selection = selection;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:8,代码来源:SearchLocation.cs


示例20: GetRectsForSegment

		/// <summary>
		/// Calculates the list of rectangle where the segment in shown.
		/// This returns one rectangle for each line inside the segment.
		/// </summary>
		public static IEnumerable<Rect> GetRectsForSegment(TextView textView, ISegment segment)
		{
			if (textView == null)
				throw new ArgumentNullException("textView");
			if (segment == null)
				throw new ArgumentNullException("segment");
			return GetRectsForSegmentImpl(textView, segment);
		}
开发者ID:pusp,项目名称:o2platform,代码行数:12,代码来源:BackgroundGeometryBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ISelectable类代码示例发布时间:2022-05-24
下一篇:
C# ISecurityService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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