本文整理汇总了C#中SearchType类的典型用法代码示例。如果您正苦于以下问题:C# SearchType类的具体用法?C# SearchType怎么用?C# SearchType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SearchType类属于命名空间,在下文中一共展示了SearchType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
public List<GrepSearchResult> Search(string file, string searchPattern, SearchType searchType, GrepSearchOption searchOptions, Encoding encoding)
{
using (FileStream fileStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
return Search(fileStream, file, searchPattern, searchType, searchOptions, encoding);
}
}
示例2: Click
//Attempts to click the element on the page, with specific and default exception handling
public void Click(SearchType type, string text){
try{
if (type == SearchType.Id){
WebDriver.FindElement(By.Id(text)).Click();
}
else if (type == SearchType.LinkText){
WebDriver.FindElement(By.LinkText(text)).Click();
}
else if (type == SearchType.Name){
WebDriver.FindElement(By.Name(text)).Click();
}
else if (type == SearchType.Xpath){
WebDriver.FindElement(By.XPath(text)).Click();
}
else{
System.Console.WriteLine(type.ToString() + " is an unsupported SearchType for this method.");
}
}
catch (NoSuchElementException ex){
System.Console.WriteLine("Error, could not find webElement of type " + type.ToString() + " with id {0}", text);
System.Console.WriteLine(ex.ToString());
return;
}
catch (Exception ex){
System.Console.WriteLine("Unspecified exception in Click().");
System.Console.WriteLine(ex.ToString());
return;
}
}
示例3: TextEntry
//Attempts to enter the given text string in a specific element on the page, with specific and default exception handling
public void TextEntry(SearchType type, string searchText, string input)
{
try{
IWebElement textField;
if (type == SearchType.Id){
textField = WebDriver.FindElement(By.Id(searchText));
}
else if (type == SearchType.LinkText){
textField = WebDriver.FindElement(By.LinkText(searchText));
}
else if (type == SearchType.Name){
textField = WebDriver.FindElement(By.Name(searchText));
}
else if (type == SearchType.Xpath){
textField = WebDriver.FindElement(By.XPath(searchText));
}
else{
textField = null;
System.Console.WriteLine(type.ToString() + " is an unsupported SearchType for this method.");
}
textField.Clear();
textField.SendKeys(input);
System.Console.WriteLine("Text '{0}' entered successfully in '{1}'", input, searchText);
}
catch (NoSuchElementException ex){
System.Console.WriteLine("Could not successfully enter text '{0}' in '{1}'", input, searchText);
System.Console.WriteLine(ex.ToString());
return;
}
catch (Exception ex){
System.Console.WriteLine("Unspecified exception in TextEntry().");
System.Console.WriteLine(ex.ToString());
return;
}
}
示例4: OpenSearchStreams
/// <summary>動画を検索するストリームを取得する</summary>
/// <param name="Keyword">検索キーワード</param>
/// <param name="SearchPage">検索ページの指定、1~nの間の数値を指定する</param>
/// <param name="SearchType">検索方法を指定する</param>
/// <param name="SearchOption">検索オプションを指定する</param>
public Streams<Video.VideoInfoResponse> OpenSearchStreams(
string Keyword,
int SearchPage,
SearchType SearchType,
SearchOption SearchOption)
{
var serialize = new DataContractJsonSerializer(typeof(Serial.Search.Contract));
var streamDataList = new List<StreamData>();
Video.VideoInfoResponse lastData = null;
streamDataList.Add(
new StreamData()
{
StreamType = StreamType.Read,
GetStream = () =>
{
return context.Client.OpenDownloadStream(
String.Format(
ApiUrls.VideoSearch,
SearchType.ToKey(),
Keyword,
SearchPage,
SearchOption.ToKey()));
},
SetReadData = (data) =>
{
lastData = converter.ConvertVideoInfoResponse(
(Serial.Search.Contract)serialize.ReadObject(new MemoryStream(data)));
}
});
return new Streams<Video.VideoInfoResponse>(
streamDataList.ToArray(),
() => lastData);
}
示例5: SearchForm
/// <summary>
/// Creates a new form used to get input for a search
/// </summary>
/// <param name="type">The type of search</param>
public SearchForm( SearchType type )
{
InitializeComponent();
Pandora.Localization.LocalizeControl( this );
if ( type != SearchType.Deco )
{
rID.Visible = false;
rName.Visible = false;
}
switch ( type )
{
case SearchType.Deco:
case SearchType.Item:
Text = "Find Item";
break;
case SearchType.Location:
Text = Pandora.Localization.TextProvider[ "Misc.FindLoc" ];
break;
case SearchType.Mobile:
Text = Pandora.Localization.TextProvider[ "Misc.FindMob" ];
break;
}
}
示例6: SelectPersonBySearchText
/// <summary>
/// Selects the person by search text.
/// </summary>
/// <param name="personsParty">The persons party.</param>
/// <param name="searchText">The search text.</param>
/// <param name="searchType">Type of the search.</param>
/// <param name="visitorSearchType">Type of the visitor search.</param>
/// <returns>Instance of PersonsParty</returns>
internal static PersonsParty SelectPersonBySearchText(PersonsParty personsParty, string searchText, SearchType searchType, VisitorSearchType visitorSearchType)
{
if (visitorSearchType != VisitorSearchType.None)
{
AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null);
}
else if (searchType == SearchType.LastName)
{
AssignSelectedPerson(personsParty, RetrievePersonByName(personsParty.RetrievePersons(), searchText).FirstOrDefault(), null);
}
else if (searchType == SearchType.Stateroom)
{
AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null);
}
else if (searchType == SearchType.Reservation)
{
AssignSelectedPerson(personsParty, RetrievePersonByReservationNumber(personsParty.RetrievePersons(), searchText).FirstOrDefault(), null);
}
else if (searchType == SearchType.PassportNumber)
{
AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null);
}
else if (searchType == SearchType.EmployeeNumber)
{
AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null);
}
else if (searchType == SearchType.BarcodeScanning || searchType == SearchType.MagneticStripe || searchType == SearchType.RFID)
{
AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null);
}
return personsParty;
}
示例7: Search
/// <summary>
/// Performs a breadth-first-search on the TreeView's nodes in search of the passed value. The matching conditions are based on the passed search type parameter.
/// </summary>
/// <param name="value">Value to search for in the TreeView. Matching on this value is based on the search type.</param>
/// <param name="searchType">Determines the matching of the value. For example, full/partial text search or full path search.</param>
/// <returns>A collection of nodes who match the conditions based on the search type.</returns>
public IReadOnlyCollection<TreeNode> Search(string value, bool isCaseSensitive, SearchType searchType)
{
IReadOnlyCollection<TreeNode> results = new List<TreeNode>().AsReadOnly();
// if the user is not choosing case sensitive, then lower everything so we clear out any case
if(!isCaseSensitive) { value = value.ToLower(); }
if(searchType == SearchType.FileNameExactMatch)
{
results = this.Nodes.Find(value, true).ToList();
}
else if(searchType == SearchType.FileNamePartialMatch)
{
Func<TreeNode, string, bool> matchFunction = (node, searchText) =>
{
return node.Text.ToLower().Contains(searchText);
};
results = Search(value, matchFunction);
}
else if(searchType == SearchType.FullPath)
{
Func<TreeNode, string, bool> matchFunction = (node, searchText) =>
{
return node.FullPath.ToLower().Contains(searchText);
};
results = Search(value, matchFunction);
}
return results;
}
示例8: addCriteria
public FormitizeCMSWhere addCriteria(string key, object value, SearchType searchType = SearchType.Equals)
{
string search = "equal";
switch(searchType)
{
case SearchType.Equals:
search = "equal";
break;
case SearchType.Contains:
search = "contain";
break;
case SearchType.NotEquals:
search = "notequal";
break;
}
Dictionary<string, object> newVal = new Dictionary<string, object>();
newVal["value"] = value;
newVal["search"] = search;
values[key] = newVal;
return this;
}
示例9: Replace
public bool Replace(Stream readStream, Stream writeStream, string searchPattern, string replacePattern, SearchType searchType, GrepSearchOption searchOptions, Encoding encoding)
{
SearchDelegates.DoReplace replaceMethod = doTextReplaceCaseSensitive;
switch (searchType)
{
case SearchType.PlainText:
if ((searchOptions & GrepSearchOption.CaseSensitive) == GrepSearchOption.CaseSensitive)
{
replaceMethod = doTextReplaceCaseSensitive;
}
else
{
replaceMethod = doTextReplaceCaseInsensitive;
}
break;
case SearchType.Regex:
replaceMethod = doRegexReplace;
break;
case SearchType.XPath:
replaceMethod = doXPathReplace;
break;
case SearchType.Soundex:
replaceMethod = doFuzzyReplace;
break;
}
if ((searchOptions & GrepSearchOption.Multiline) == GrepSearchOption.Multiline)
return replaceMultiline(readStream, writeStream, searchPattern, replacePattern, searchOptions, replaceMethod, encoding);
else
return replace(readStream, writeStream, searchPattern, replacePattern, searchOptions, replaceMethod, encoding);
}
示例10: Search
/// <summary>動画を検索する</summary>
/// <param name="Keyword">検索キーワード</param>
/// <param name="SearchPage">検索ページの指定、1~nの間の数値を指定する</param>
/// <param name="SearchType">検索方法を指定する</param>
/// <param name="SearchOption">検索オプションを指定する、Filterメンバは無効</param>
public Session<Response<VideoInfo[]>> Search(
string Keyword,
int SearchPage,
SearchType SearchType,
SearchOption SearchOption)
{
var session = new Session<Response<VideoInfo[]>>();
session.SetAccessers(new Func<byte[], APIs.IAccesser>[]
{
(data) =>
{
var accesser = new APIs.search.Accesser();
accesser.Setting(
context.CookieContainer,
SearchType.ToKey(),
Keyword,
SearchPage.ToString(),
SearchOption.SortOrder.ToKey(),
SearchOption.SortTarget.ToKey());
return accesser;
}
},
(data) =>
Converter.VideoInfoResponse(context, new APIs.search.Parser().Parse(data)));
return session;
}
示例11: LaunchSearch
public static void LaunchSearch(string searchTerm, SearchType searchType)
{
if (!string.IsNullOrEmpty(searchTerm))
{
searchTerm = searchTerm.Replace(' ', '+');
string str = string.Empty;
switch (searchType)
{
case SearchType.GOOGLE:
str = "http://www.google.com/search?q={0}";
break;
case SearchType.LINKEDIN:
str = "http://www.linkedin.com/search?pplSearchOrigin=GLHD&keywords={0}&search=";
break;
case SearchType.FACEBOOK:
str = "http://www.facebook.com/srch.php?nm={0}";
break;
case SearchType.TWITTER:
str = "http://twitter.com/search/users?q={0}&category=people&source=users";
break;
}
if (!string.IsNullOrEmpty(str))
{
LaunchUrl(Uri.EscapeUriString(string.Format(CultureInfo.InvariantCulture, str, new object[] { searchTerm })));
}
}
}
示例12: Search
internal Search(SearchType searchMethod)
{
IsDone = false;
NextKey = null;
Matches = new List<Document>();
SearchMethod = searchMethod;
}
示例13: Explore
private static void Explore(CASCFolder folder, string findFile, SearchType type, List<CASCFile> found)
{
foreach (KeyValuePair<string, ICASCEntry> node in folder.Entries)
{
ICASCEntry entry = node.Value;
if (entry is CASCFolder)
{
Explore((CASCFolder)entry, findFile, type, found);
}
else if (entry is CASCFile)
{
CASCFile file = (CASCFile)entry;
string fileName = file.FullName.ToLower();
if (type == SearchType.COMPLETE && fileName.Equals(fileName))
{
found.Add(file);
break;
}
if (type == SearchType.STARTS_WITH && fileName.StartsWith(findFile))
{
found.Add(file);
continue;
}
if (type == SearchType.ENDS_WITH && fileName.EndsWith(findFile))
{
found.Add(file);
continue;
}
}
}
}
示例14: SearchTypeVM
public SearchTypeVM(SearchType searchType, string name, string toolTip, ImageReference imageReference, VisibleMembersFlags flags) {
SearchType = searchType;
Name = name;
ToolTip = toolTip;
Image = imageReference;
Flags = flags;
}
示例15: SearchCriteria
public SearchCriteria(string search)
{
if (string.IsNullOrEmpty(search))
{
throw new ArgumentNullException("search");
}
SearchType = SearchType.Unknown;
if (StringHelper.IndexOfIgnoreCase(search, "upnp:class") != -1 &&
StringHelper.IndexOfIgnoreCase(search, "derivedfrom") != -1)
{
if (StringHelper.IndexOfIgnoreCase(search, "object.item.audioItem") != -1)
{
SearchType = SearchType.Audio;
}
else if (StringHelper.IndexOfIgnoreCase(search, "object.item.imageItem") != -1)
{
SearchType = SearchType.Image;
}
else if (StringHelper.IndexOfIgnoreCase(search, "object.item.videoItem") != -1)
{
SearchType = SearchType.Video;
}
else if (StringHelper.IndexOfIgnoreCase(search, "object.container.playlistContainer") != -1)
{
SearchType = SearchType.Playlist;
}
}
}