本文整理汇总了C#中SearchFlags类的典型用法代码示例。如果您正苦于以下问题:C# SearchFlags类的具体用法?C# SearchFlags怎么用?C# SearchFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SearchFlags类属于命名空间,在下文中一共展示了SearchFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Replace
public void Replace(string textToFind, string textToReplace, Document doc, SearchFlags flags, SearchScope scope, int startPosition, int endPosition)
{
var ed = App.Editor(doc.GetType()) as ITextEditor;
if (lastSettings != null &&
(lastSettings.LastDocument != doc || ed.SelectionStart != lastSettings.LastStartPosition || ed.SelectionEnd != lastSettings.LastEndPosition))
lastSettings = null;
if (lastSettings != null)
{
ed.ReplaceText(lastSettings.LastStartPosition, lastSettings.LastEndPosition, lastSettings.TextToReplace);
lastSettings.LastEndPosition = lastSettings.LastStartPosition + lastSettings.TextToReplace.Length;
}
var res = Search(textToFind, doc, flags, scope, (d,r) => {
var editor = (ITextEditor)App.GetService<IEditorService>().GetEditor(d.GetType()).Instance;
var docServ = App.GetService<IDocumentService>();
if (docServ.GetActiveDocument() != d)
docServ.SetActiveDocument(d);
editor.SelectText(r.StartPosition, r.EndPosition - r.StartPosition);
lastSettings.LastStartPosition = r.StartPosition;
lastSettings.TextToReplace = textToReplace;
var sci = editor.Control as ScintillaControl;
if (sci != null)
sci.PutArrow(sci.GetLineFromPosition(r.StartPosition));
return true;
}, false, lastSettings != null ? lastSettings.LastEndPosition : startPosition, endPosition, null);
IsFinished(res);
}
示例2: SearchReplaceForm
public SearchReplaceForm()
{
InitializeComponent();
// Initialise the SearchFlags
_findSearchFlags = new SearchFlags();
_replaceSearchFlags = new SearchFlags();
_findSearchFlags = SearchFlags.None;
_replaceSearchFlags = SearchFlags.None;
}
示例3: InternalSearch
private unsafe SearchResult InternalSearch(SearchFlags flags, string text, int startPosition, int endPosition)
{
fixed (byte* pt = Encoding.UTF8.GetBytes(text))
{
var pf = new TextToFind();
pf.lpstrText = (IntPtr)pt;
pf.chrg.Min = startPosition;
pf.chrg.Max = endPosition <= 0 ? startPosition + scintilla.Ref.Send(Sci.SCI_GETTEXTLENGTH) : endPosition;
var res = RunSearch(flags, ref pf);
if (res == -1)
return SearchResult.NotFound;
else
return new SearchResult(pf.chrgText.Min, pf.chrgText.Max);
}
}
示例4: Query
public Query(IntPtr replyHwnd, SearchFlags flags, string searchString)
{
Size = 22 + searchString.Length * 2;
_ptr = Marshal.AllocHGlobal(Size);
var writer = new UnmanagedMemoryWriter(_ptr);
// HWND reply_hwnd
writer.Write((uint)replyHwnd.ToInt64());
// ULONG_PTR reply_copydata_message (ULONG_PTR is defined as unsigned __int3264, but uint seems
// to work here even when running both processes as 64-bit)
writer.Write(0u);
// DWORD search_flags
writer.Write((uint)flags);
// DWORD offset
writer.Write(0u);
// DWORD max_results
writer.Write(uint.MaxValue);
// DWORD search_string[1]
writer.Write(searchString);
}
示例5: Find
public unsafe Range Find(int startPos, int endPos, string searchString, SearchFlags flags)
{
TextToFind ttf = new TextToFind();
ttf.chrg.cpMin = startPos;
ttf.chrg.cpMax = endPos;
fixed (byte* pb = Scintilla.Encoding.GetBytes(searchString))
{
ttf.lpstrText = (IntPtr)pb;
int pos = NativeScintilla.FindText((int)flags, ref ttf);
if (pos >= 0)
{
return new Range(pos, pos + searchString.Length, Scintilla);
}
else
{
return null;
}
}
}
示例6: SetFindParam
public void SetFindParam(string text, SearchFlags searchFlags = SearchFlags.None)
{
if (text != _text || searchFlags != _searchFlags)
{
_text = text;
_searchFlags = searchFlags;
_search = false;
}
//FindNext();
//else if (_positionIndex != -1)
//{
// _positionIndex++;
// if (_positionIndex == _positions.Count)
// _positionIndex = 0;
//}
//if (_positionIndex != -1)
//{
// FindPosition findPosition = _positions[_positionIndex];
// _scintillaControl.GotoPosition(findPosition.Start);
// _scintillaControl.SelectionStart = findPosition.Start;
// _scintillaControl.SelectionEnd = findPosition.End;
//}
}
示例7: ReplaceAll
public List<Range> ReplaceAll(Range rangeToSearch, string searchString, string replaceString, SearchFlags flags)
{
return ReplaceAll(rangeToSearch.Start, rangeToSearch.End, searchString, replaceString, _flags);
}
示例8: ReplacePrevious
public Range ReplacePrevious(string searchString, string replaceString, bool wrap, SearchFlags flags)
{
Range r = FindPrevious(searchString, wrap, flags);
if (r != null)
{
r.Text = replaceString;
r.End = r.Start + replaceString.Length;
}
return r;
}
示例9: FindPrevious
public Range FindPrevious(string searchString, bool wrap, SearchFlags flags, Range searchRange)
{
int caret = Scintilla.Caret.Position;
if (!searchRange.PositionInRange(caret))
return Find(searchRange.End, searchRange.Start, searchString, flags);
int anchor = Scintilla.Caret.Anchor;
if (!searchRange.PositionInRange(anchor))
anchor = caret;
Range r = Find(anchor, searchRange.Start, searchString, flags);
if (r != null)
return r;
else if (wrap)
return Find(searchRange.End, anchor, searchString, flags);
else
return null;
}
示例10: FindNext
public Range FindNext(string searchString, SearchFlags flags)
{
return FindNext(searchString, true, flags);
}
示例11: FindAll
public List<Range> FindAll(Range rangeToSearch, string searchString, SearchFlags flags)
{
return FindAll(rangeToSearch.Start, rangeToSearch.End, searchString, _flags);
}
示例12: IsSetInSearchFlags
private bool IsSetInSearchFlags(SearchFlags searchFlagBit)
{
this.InitializeSearchFlags();
return ((this.searchFlags & searchFlagBit) != SearchFlags.None);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:ActiveDirectorySchemaProperty.cs
示例13: InitializeSearchFlags
private void InitializeSearchFlags()
{
if (this.isBound && !this.searchFlagsInitialized)
{
object valueFromCache = this.GetValueFromCache(PropertyManager.SearchFlags, false);
if (valueFromCache != null)
{
this.searchFlags = (SearchFlags) ((int) valueFromCache);
}
this.searchFlagsInitialized = true;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ActiveDirectorySchemaProperty.cs
示例14: Find
public Range Find(Range rangeToSearch, string searchString, SearchFlags searchflags, bool searchUp)
{
if (searchUp)
return Find(rangeToSearch.End, rangeToSearch.Start, searchString, searchflags);
else
return Find(rangeToSearch.Start, rangeToSearch.End, searchString, searchflags);
}
示例15: SetBitInSearchFlags
private void SetBitInSearchFlags(SearchFlags searchFlagBit)
{
this.InitializeSearchFlags();
this.searchFlags |= searchFlagBit;
if (this.isBound)
{
this.GetSchemaPropertyDirectoryEntry();
this.propertyEntry.Properties[PropertyManager.SearchFlags].Value = (int) this.searchFlags;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:ActiveDirectorySchemaProperty.cs