/// <summary> /// Prepare for saving the configuration to disk. None of the /// modifications in this method need to be rolled back /// (for rollback, use <c>OnSavePre</c> / <c>OnSavePost</c>). /// </summary> private void PrepareSave() { AceMeta aceMeta = this.Meta; // m_meta might be null AceApplication aceApp = this.Application; // m_aceApp might be null AceDefaults aceDef = this.Defaults; // m_def might be null aceMeta.OmitItemsWithDefaultValues = true; aceMeta.DpiFactorX = DpiUtil.FactorX; // For new (not loaded) cfgs. aceMeta.DpiFactorY = DpiUtil.FactorY; aceApp.LastUsedFile.ClearCredentials(true); foreach (IOConnectionInfo iocMru in aceApp.MostRecentlyUsed.Items) { iocMru.ClearCredentials(true); } if (aceDef.RememberKeySources == false) { aceDef.KeySources.Clear(); } aceApp.TriggerSystem = Program.TriggerSystem; SearchUtil.PrepareForSerialize(aceDef.SearchParameters); }
private void Menu_DeleteClones_Click(object sender, EventArgs e) { var dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgDBDeleteCloneWarning + Environment.NewLine + MsgDBDeleteCloneAdvice, MsgContinue); if (dr != DialogResult.Yes) { return; } var deleted = 0; var db = RawDB.Where(pk => pk.Identifier.StartsWith(DatabasePath + Path.DirectorySeparatorChar, StringComparison.Ordinal)) .OrderByDescending(file => File.GetLastWriteTimeUtc(file.Identifier)); var clones = SearchUtil.GetExtraClones(db); foreach (var pk in clones) { try { File.Delete(pk.Identifier); ++deleted; } catch (Exception ex) { WinFormsUtil.Error(MsgDBDeleteCloneFail + Environment.NewLine + ex.Message + Environment.NewLine + pk.Identifier); } } if (deleted == 0) { WinFormsUtil.Alert(MsgDBDeleteCloneNone); return; } WinFormsUtil.Alert(string.Format(MsgFileDeleteCount, deleted), MsgWindowClose); Close(); }
internal void OnLoad() { AceMainWindow aceMW = this.MainWindow; // m_uiMainWindow might be null AceDefaults aceDef = this.Defaults; // m_def might be null // aceInt.UrlSchemeOverrides.SetDefaultsIfEmpty(); ObfuscateCred(false); ChangePathsRelAbs(true); // Remove invalid columns List <AceColumn> vColumns = aceMW.EntryListColumns; int i = 0; while (i < vColumns.Count) { if (((int)vColumns[i].Type < 0) || ((int)vColumns[i].Type >= (int)AceColumnType.Count)) { vColumns.RemoveAt(i); } else { ++i; } } SearchUtil.FinishDeserialize(aceDef.SearchParameters); DpiScale(); if (aceMW.EscMinimizesToTray) // For backward compatibility { aceMW.EscMinimizesToTray = false; // Default value aceMW.EscAction = AceEscAction.MinimizeToTray; } if (NativeLib.IsUnix()) { this.Security.MasterKeyOnSecureDesktop = false; AceIntegration aceInt = this.Integration; aceInt.HotKeyGlobalAutoType = (ulong)Keys.None; aceInt.HotKeySelectedAutoType = (ulong)Keys.None; aceInt.HotKeyShowWindow = (ulong)Keys.None; } if (MonoWorkarounds.IsRequired(1378)) { AceWorkspaceLocking aceWL = this.Security.WorkspaceLocking; aceWL.LockOnSessionSwitch = false; aceWL.LockOnSuspend = false; aceWL.LockOnRemoteControlChange = false; } if (MonoWorkarounds.IsRequired(1418)) { aceMW.MinimizeAfterOpeningDatabase = false; this.Application.Start.MinimizedAndLocked = false; } }
/// <summary> /// Prepare for saving the configuration to disk. None of the /// modifications in this method need to be rolled back /// (for rollback, use <c>OnSavePre</c> / <c>OnSavePost</c>). /// </summary> private void PrepareSave() { AceMeta aceMeta = this.Meta; // m_meta might be null AceApplication aceApp = this.Application; // m_aceApp might be null AceDefaults aceDef = this.Defaults; // m_def might be null aceMeta.OmitItemsWithDefaultValues = true; aceMeta.DpiFactorX = DpiUtil.FactorX; // For new (not loaded) cfgs. aceMeta.DpiFactorY = DpiUtil.FactorY; aceApp.LastUsedFile.ClearCredentials(true); foreach (IOConnectionInfo iocMru in aceApp.MostRecentlyUsed.Items) { iocMru.ClearCredentials(true); } if (aceDef.RememberKeySources == false) { aceDef.KeySources.Clear(); } aceApp.TriggerSystem = Program.TriggerSystem; SearchUtil.PrepareForSerialize(aceDef.SearchParameters); const int m = 64; // Maximum number of compatibility items List <string> l = aceApp.PluginCompatibility; if (l.Count > m) { l.RemoveRange(m, l.Count - m); // See reg. } }
internal void OnLoad() { AceMainWindow aceMainWindow = this.MainWindow; // m_uiMainWindow might be null AceDefaults aceDef = this.Defaults; // m_def might be null // aceInt.UrlSchemeOverrides.SetDefaultsIfEmpty(); ObfuscateCred(false); ChangePathsRelAbs(true); // Remove invalid columns List <AceColumn> vColumns = aceMainWindow.EntryListColumns; int i = 0; while (i < vColumns.Count) { if (((int)vColumns[i].Type < 0) || ((int)vColumns[i].Type >= (int)AceColumnType.Count)) { vColumns.RemoveAt(i); } else { ++i; } } SearchUtil.FinishDeserialize(aceDef.SearchParameters); }
public void ProcessContentSearchRequest(NSNotification obj) { var hud = new MTMBProgressHUD(View) { LabelText = "Loading", RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(animated: true); string keyword = SearchBar.Text; SearchResult res = SearchUtil.Search(AppDataUtil.Instance.GetCurrentPublication().BookId, AppDataUtil.Instance.GetOpendTOC().ID, keyword); if (AppDisplayUtil.Instance.ContentSearchResController != null) { AppDisplayUtil.Instance.ContentSearchResController.View.RemoveFromSuperview(); } AppDisplayUtil.Instance.ContentSearchResController = new ResultViewController(res); AppDisplayUtil.Instance.ContentSearchResController.View.TranslatesAutoresizingMaskIntoConstraints = false; ContainerView.AddSubview(AppDisplayUtil.Instance.ContentSearchResController.View); ContainerView.AddConstraints(new NSLayoutConstraint[] { NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0) }); hud.Hide(animated: true, delay: 0.2); }
void OnInputTextChanged(object sender, EventArgs e) { if (tree.Nodes.Count == 0) { return; } var search = input.Text; search = FormHelper.Transcriptor(search); var matches = SearchUtil.FindAll(typeToNode.Keys.ToList(), search); var mathesIsEmpty = matches.Count == 0; foreach (var k in typeToNode) { ((ClassHierarchyNode)k.Value).Enabled = mathesIsEmpty || matches.Contains(k.Key); } tree.Refresh(); if (mathesIsEmpty) { tree.SelectedNode = typeToNode[curClass.Type]; } else { matches.Sort(); tree.SelectedNode = typeToNode[matches[0]]; } }
void FillTree() { var separator = Path.PathSeparator; var search = input.Text.Replace('\\', separator).Replace('/', separator); search = FormHelper.Transcriptor(search); if (openedFiles.Count > 0) { var matches = openedFiles; if (search.Length > 0) { matches = SearchUtil.FindAll(openedFiles, search); } if (matches.Count > 0) { tree.Items.AddRange(matches.ToArray()); if (settings.EnableItemSpacer) { tree.Items.Add(settings.ItemSpacer); } } } if (recentFiles.Count > 0) { var matches = recentFiles; if (search.Length > 0) { matches = SearchUtil.FindAll(matches, search); } if (matches.Count > 0) { tree.Items.AddRange(matches.ToArray()); } } }
public void ReverseString() { var original = "abcdefghijk"; var reversed = SearchUtil.ReverseString(original); Assert.AreEqual("kjihgfedcba", reversed); }
static void FillNodes([NotNull] TreeNodeCollection nodes, [NotNull] string search, [NotNull] List <string> openedTypes, [NotNull] List <string> closedTypes, int maxItems, string separator) { if (openedTypes.Count > 0) { openedTypes = SearchUtil.FindAll(openedTypes, search); } TreeNode[] openedNodes; TreeNode[] closedNodes; if (maxItems > 0) { openedNodes = CreateClassNodes(search, openedTypes, maxItems); maxItems -= openedTypes.Count; closedNodes = maxItems > 0 ? CreateClassNodes(search, SearchUtil.FindAll(closedTypes, search), maxItems) : new TreeNode[0]; } else { openedNodes = CreateClassNodes(search, openedTypes); closedNodes = CreateClassNodes(search, SearchUtil.FindAll(closedTypes, search)); } var hasOpenedMatches = openedNodes.Length > 0; var hasClosedMatches = closedNodes.Length > 0; if (hasOpenedMatches) { nodes.AddRange(openedNodes); } if (!string.IsNullOrEmpty(separator) && hasOpenedMatches && hasClosedMatches) { nodes.Add(separator); } if (hasClosedMatches) { nodes.AddRange(closedNodes); } }
public static void Main() { var cb = ChessBoardInstances.Get(0); MainEngine.MaxDepth = MaxPly; UciOut.NoOutput = true; EngineConstants.Power2TtEntries = 2; TtUtil.Init(false); long totalNodesSearched = 0; var epdStrings = BestMoveTest.GetEpdStrings("Resources/WAC-201.epd"); for (var index = 0; index < NumberOfPositions; index++) { Console.WriteLine(index); var epdString = epdStrings[index + 20]; Statistics.Reset(); var epd = new Epd(epdString); ChessBoardUtil.SetFen(epd.GetFen(), cb); SearchUtil.Start(cb); totalNodesSearched += ChessBoardUtil.CalculateTotalMoveCount(); } Console.WriteLine("Total " + totalNodesSearched); Console.WriteLine("Average " + totalNodesSearched / NumberOfPositions); }
// Token: 0x06000D19 RID: 3353 RVA: 0x00030D18 File Offset: 0x0002EF18 protected override void InitSubscriptionInternal() { if (!base.UserContext.MailboxSessionLockedByCurrentThread()) { throw new InvalidOperationException("UserContext lock should be acquired before calling this method RowNotificationHandler.InitSubscriptionInternal"); } ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "RowNotificationHandler.InitSubscriptionInternal Start. SubscriptionId: {0}", base.SubscriptionId); if (!SearchUtil.IsViewFilterNonQuery(this.viewFilter) || this.clutterFilter != ClutterFilter.All) { this.CreateSubscriptionForFilteredView(); } else { if (this.folderId == null) { string message = string.Format(CultureInfo.InvariantCulture, "RowNotificationHandler: OriginalStoreFolderId {0} OriginalStoreFolderIdAsString {1} FolderId {2}", new object[] { this.originalFolderId, this.originalFolderIdAsString, this.folderId }); throw new OwaInvalidOperationException(message); } using (Folder folder = Folder.Bind(base.UserContext.MailboxSession, this.folderId)) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "RowNotificationHandler.InitSubscriptionInternal create folder subscription {0}", base.SubscriptionId); this.CreateSubscription(folder); } } ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "RowNotificationHandler.InitSubscriptionInternal End. subscription {0}", base.SubscriptionId); }
public ActionResult Search() { var minPrice = Request.Form["S_MinPrice"]; var maxPrice = Request.Form["S_MaxPrice"]; var input = new SearchInput { genre = Request.Form["S_Genre"], title = Request.Form["S_Title"], released = Int32.Parse(Request.Form["S_Released"]), minPrice = minPrice != "" ? Decimal.Parse(minPrice) : 0, maxPrice = maxPrice != "" ? Decimal.Parse(maxPrice) : 0, includeMin = Boolean.Parse(Request.Form["S_IncludeMin"]), includeMax = Boolean.Parse(Request.Form["S_IncludeMax"]), validMin = minPrice != "", validMax = maxPrice != "" }; inputHistory.Push(input); var searchUtil = new SearchUtil { input = input }; var result = searchUtil.search(searchHistory.Count != 0 ? searchHistory.Peek() : db.Movies.ToList()); searchHistory.Push(result); return(RedirectToAction("Index")); }
private StoreObjectId ResolveSearchFolderIdForFilteredView(StoreId inboxFolderId, OwaViewFilter viewFilter) { StoreObjectId storeObjectId = null; ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "HierarchyNotificationHandler.ResolveSearchFolderIdForFilteredView Start. SubscriptionId: {0}", base.SubscriptionId); OwaSearchContext owaSearchContext = new OwaSearchContext(); owaSearchContext.ViewFilter = viewFilter; owaSearchContext.FolderIdToSearch = inboxFolderId; StoreObjectId defaultFolderId = base.UserContext.MailboxSession.GetDefaultFolderId(DefaultFolderType.SearchFolders); using (SearchFolder owaViewFilterSearchFolder = SearchUtil.GetOwaViewFilterSearchFolder(owaSearchContext, base.UserContext.MailboxSession, defaultFolderId, null, CallContext.Current)) { if (owaViewFilterSearchFolder == null) { throw new ArgumentNullException(string.Format("HierarchyNotificationHandler.ResolveSearchFolderIdForFilteredView null searchFolder returned for subscriptionId: {0}. ViewFilter: {1}; Source folder id: {2}", base.SubscriptionId, viewFilter, inboxFolderId.ToString())); } storeObjectId = owaViewFilterSearchFolder.StoreObjectId; ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "HierarchyNotificationHandler.ResolveSearchFolderIdForFilteredView found filtered-view search folder subscriptionId: {0} . ViewFilter: {1}; Source folder id: {2}, Search folder id: {3}", new object[] { base.SubscriptionId, viewFilter, inboxFolderId.ToString(), storeObjectId.ToString() }); } return(storeObjectId); }
protected override async Task EncounterLoop(SAV8SWSH sav, CancellationToken token) { var monoffset = GetResetOffset(Hub.Config.Encounter.EncounteringType); var pkoriginal = monoffset is BoxStartOffset ? await ReadBoxPokemon(0, 0, token).ConfigureAwait(false) : new PK8(); while (!token.IsCancellationRequested) { PK8?pknew; Log("Looking for a Pokémon..."); do { await DoExtraCommands(token, Hub.Config.Encounter.EncounteringType).ConfigureAwait(false); pknew = await ReadUntilPresent(monoffset, 0_050, 0_050, BoxFormatSlotSize, token).ConfigureAwait(false); } while (pknew is null || SearchUtil.HashByDetails(pkoriginal) == SearchUtil.HashByDetails(pknew)); if (await HandleEncounter(pknew, token).ConfigureAwait(false)) { return; } Log("No match, resetting the game..."); await CloseGame(Hub.Config, token).ConfigureAwait(false); await StartGame(Hub.Config, token).ConfigureAwait(false); } }
private async Task <PokeTradeResult> ProcessGiveawayUploadAsync(PokeTradeDetail <PK8> detail, CancellationToken token) { int ctr = 0; var time = TimeSpan.FromSeconds(Hub.Config.Trade.MaxDumpTradeTime); var start = DateTime.Now; var pkprev = new PK8(); var poolEntry = detail.PoolEntry; while (ctr < 1 && DateTime.Now - start < time) { var pk = await ReadUntilPresent(LinkTradePartnerPokemonOffset, 3_000, 1_000, token).ConfigureAwait(false); if (pk == null || pk.Species < 1 || !pk.ChecksumValid || SearchUtil.HashByDetails(pk) == SearchUtil.HashByDetails(pkprev)) { continue; } // Save the new Pokémon for comparison next round. pkprev = pk; poolEntry.PK8 = pk; poolEntry.Pokemon = SpeciesName.GetSpeciesName(pk.Species, 2); if (Hub.Config.Legality.VerifyLegality) { LogUtil.LogInfo($"Performing legality check on {poolEntry.Pokemon}", "PokeTradeBot.GiveawayUpload"); var la = new LegalityAnalysis(poolEntry.PK8); var verbose = la.Report(true); LogUtil.LogInfo($"Shown Pokémon is {(la.Valid ? "Valid" : "Invalid")}.", "PokeTradeBot.GiveawayUpload"); detail.SendNotification(this, pk, $"Pokémon sent is {(la.Valid ? "Valid" : "Invalid")}."); detail.SendNotification(this, pk, verbose); if (!la.Valid) { detail.SendNotification(this, pk, $"Show a different pokemon to continue or exit the trade to end."); continue; } } LogUtil.LogInfo("Creating new database entry", "PokeTradeBot.GiveawayUpload"); Hub.GiveawayPoolDatabase.NewEntry(poolEntry); if (Hub.Config.Discord.ReturnPK8s) { detail.SendNotification(this, pk, "Here's what you showed me!"); } ctr++; } LogUtil.LogInfo($"Ended Giveaway pool upload", "PokeTradeBot.GiveawayUpload"); await ExitSeedCheckTrade(Hub.Config, token).ConfigureAwait(false); if (ctr == 0) { return(PokeTradeResult.TrainerTooSlow); } detail.Notifier.SendNotification(this, detail, $"Finished uploading Pokémon to the Giveaway Pool."); detail.Notifier.TradeFinished(this, detail, detail.TradeData); // blank pk8 return(PokeTradeResult.Success); }
public async Task <List <Song> > FindByName(string query) { var songs = await _indieWindyDb.Song .Include(s => s.Artist) .Include(s => s.Album) .ToListAsync(); return(songs.Where(s => SearchUtil.StartsWith(s.Name, query)).ToList()); }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_pgRoot != null); if (m_pgRoot == null) { throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this, this); string strTitle = KPRes.SearchTitle; if ((m_pgRoot != null) && (m_pgRoot.ParentGroup != null)) { strTitle += " - " + m_pgRoot.Name; } BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_XMag, strTitle, KPRes.SearchDesc2); this.Icon = AppIcons.Default; m_bUpdating = true; UIUtil.SetText(m_cbDerefData, m_cbDerefData.Text + " (" + KPRes.Slow + ")"); SearchParameters sp = Program.Config.Defaults.SearchParameters; m_cbTitle.Checked = sp.SearchInTitles; m_cbUserName.Checked = sp.SearchInUserNames; m_cbURL.Checked = sp.SearchInUrls; m_cbPassword.Checked = sp.SearchInPasswords; m_cbNotes.Checked = sp.SearchInNotes; m_cbOtherFields.Checked = sp.SearchInOther; m_cbStringName.Checked = sp.SearchInStringNames; m_cbTags.Checked = sp.SearchInTags; m_cbUuid.Checked = sp.SearchInUuids; m_cbGroupPath.Checked = sp.SearchInGroupPaths; m_cbGroupName.Checked = sp.SearchInGroupNames; StringComparison sc = sp.ComparisonMode; m_cbCaseSensitive.Checked = ((sc != StringComparison.CurrentCultureIgnoreCase) && (sc != StringComparison.InvariantCultureIgnoreCase) && (sc != StringComparison.OrdinalIgnoreCase)); m_cbRegEx.Checked = sp.RegularExpression; m_cbExcludeExpired.Checked = sp.ExcludeExpired; m_cbIgnoreGroupSettings.Checked = !sp.RespectEntrySearchingDisabled; string strTrf = SearchUtil.GetTransformation(sp); m_cbDerefData.Checked = (strTrf == SearchUtil.StrTrfDeref); m_bUpdating = false; EnableControlsEx(); UIUtil.SetFocus(m_tbSearch, this); }
public void BinarySearchCounter() { int searchCount; var searchArray = new int[] { 4, 6, 7, 8, 12, 18, 24, 45, 66, 78, 193, 205, 318, 500, 1024, 888923 }; var index = SearchUtil.IndexOf(searchArray, 6, out searchCount); Assert.AreEqual(1, index); Assert.AreEqual(3, searchCount); }
private void SetSearchParameters(SearchParameters sp) { if (sp == null) { Debug.Assert(false); sp = new SearchParameters(); } ++m_uBlockProfileAuto; Debug.Assert((m_cmbProfiles.Text == ProfileCustom) || (m_cmbProfiles.Text == sp.Name)); m_tbSearch.Text = sp.SearchString; if (sp.SearchMode == PwSearchMode.Regular) { m_rbModeRegular.Checked = true; } else if (sp.SearchMode == PwSearchMode.XPath) { m_rbModeXPath.Checked = true; } else { Debug.Assert(sp.SearchMode == PwSearchMode.Simple); m_rbModeSimple.Checked = true; } m_cbTitle.Checked = sp.SearchInTitles; m_cbUserName.Checked = sp.SearchInUserNames; m_cbPassword.Checked = sp.SearchInPasswords; m_cbUrl.Checked = sp.SearchInUrls; m_cbNotes.Checked = sp.SearchInNotes; m_cbStringsOther.Checked = sp.SearchInOther; m_cbStringName.Checked = sp.SearchInStringNames; m_cbTags.Checked = sp.SearchInTags; m_cbUuid.Checked = sp.SearchInUuids; m_cbGroupPath.Checked = sp.SearchInGroupPaths; m_cbGroupName.Checked = sp.SearchInGroupNames; m_cbHistory.Checked = sp.SearchInHistory; StringComparison sc = sp.ComparisonMode; m_cbCaseSensitive.Checked = ((sc != StringComparison.CurrentCultureIgnoreCase) && (sc != StringComparison.InvariantCultureIgnoreCase) && (sc != StringComparison.OrdinalIgnoreCase)); m_cbExcludeExpired.Checked = sp.ExcludeExpired; m_cbIgnoreGroupSettings.Checked = !sp.RespectEntrySearchingDisabled; string strTrf = SearchUtil.GetTransformation(sp); m_cbDerefData.Checked = (strTrf == SearchUtil.StrTrfDeref); --m_uBlockProfileAuto; }
public static void Main() { var cb = ChessBoardInstances.Get(0); ChessBoardUtil.SetFen(FenStandardMiddlegame, cb); TimeUtil.SetSimpleTimeWindow(5000); TtUtil.Init(false); SearchUtil.Start(cb); Statistics.Print(); }
static void FillNodes([NotNull] TreeNodeCollection nodes, [NotNull] ClassModel inClass, [NotNull] string search) { var inFile = inClass.InFile; var isHaxe = inFile.haXe; var items = SearchUtil.FindAll(inClass.Members.Items, search); foreach (var it in items) { nodes.Add(NodeFactory.CreateTreeNode(inFile, isHaxe, it)); } }
protected override QueryResult GetQueryResult(Folder folder) { bool flag = SearchUtil.IsComplexClutterFilteredView(base.ViewFilter, base.ClutterFilter); if (base.ViewFilter == ViewFilter.TaskOverdue || flag) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "MessageItemRowNotificationHandler.GetQueryResult Start. subscription {0}", base.SubscriptionId); QueryFilter queryFilter = flag ? SearchUtil.GetViewQueryForComplexClutterFilteredView(base.ClutterFilter, false) : SearchUtil.GetViewQueryFilter(base.ViewFilter); return(folder.ItemQuery(ItemQueryType.None, queryFilter, base.SortBy, this.SubscriptionProperties)); } return(base.GetQueryResult(folder)); }
public void FindCircularShift() { var circularSearch = "CATDOGFISH"; var validComparison = "DOGFISHCAT"; var foundCircular = SearchUtil.IsInCircularShift(circularSearch, validComparison); Assert.IsTrue(foundCircular); var invalidComparison = "DOGFISHMONKEY"; var notFoundCircular = SearchUtil.IsInCircularShift(circularSearch, invalidComparison); Assert.IsFalse(notFoundCircular); }
public void SearchContentTest_SPECIAL() { string keywords = "!@#$%^&*()_+}{|\\][\":?></.,;\'law"; Stopwatch time = new Stopwatch(); time.Start(); int bookID = 41; int tocID = 1074; List <ContentCategory> contentTypeList = new List <ContentCategory>(); var result = SearchUtil.Search(bookID, tocID, keywords); Assert.LessOrEqual(0, result.SearchDisplayResultList.Count); }
void FillNodes(TreeNodeCollection nodes, FileModel inFile, MemberList members, bool isHaxe, bool currentClass, string search) { var items = FilterTypes(members.Items.ToList()); items = SearchUtil.FindAll(items, search, isHaxe); foreach (var it in items) { nodes.Add(NodeFactory.CreateTreeNode(inFile, isHaxe, it)); } if ((search.Length > 0 && SelectedNode == null || currentClass) && nodes.Count > 0) { tree.SelectedNode = nodes[0]; } }
void FillTree() { var search = input.Text; search = FormHelper.Transcriptor(search); var projects = search.Length > 0 ? SearchUtil.FindAll(recentProjects, search) : recentProjects; if (projects.Count == 0) { return; } foreach (var it in projects) { tree.Nodes.Add(it, it, 0); } }
// Call to load from the XIB/NIB file public SearchResultsController(NSPopover popover, int bookID, int tocID, string keyword) : base("SearchResults", NSBundle.MainBundle) { parentPopover = popover; BookID = bookID; keyWord = keyword; List <ContentCategory> categoryList = new List <ContentCategory> (0); categoryList.Add(ContentCategory.All); AddTimer(); SearchResultsData = SearchUtil.Search(BookID, tocID, keyword, categoryList); Initialize(); }
private static void DoTest(IReadOnlyCollection <string> epdStrings) { var correctCounter = 0; foreach (var epdString in epdStrings) { var epd = new Epd(epdString); var cb = ChessBoardInstances.Get(0); ChessBoardUtil.SetFen(epd.GetFen(), cb); TimeUtil.Reset(); TimeUtil.SetSimpleTimeWindow(5000); SearchUtil.Start(cb); var bestMove = new MoveWrapper(ThreadData.GetBestMove()); if (epd.IsBestMove) { if (epd.MoveEquals(bestMove)) { Console.WriteLine(epd.GetId() + " BM OK"); correctCounter++; _positionTestOk++; } else { Console.WriteLine(epd.GetId() + " BM NOK " + bestMove + " - " + epd); _positionTestNok++; } } else { if (epd.MoveEquals(bestMove)) { Console.WriteLine(epd.GetId() + " AM NOK " + epd); _positionTestNok++; } else { Console.WriteLine(epd.GetId() + " AM OK"); correctCounter++; _positionTestOk++; } } } Console.WriteLine(correctCounter + "/" + epdStrings.Count); }
private async Task <PokeTradeResult> ProcessDumpTradeAsync(PokeTradeDetail <PK8> detail, CancellationToken token) { int ctr = 0; var time = TimeSpan.FromSeconds(Hub.Config.Trade.MaxDumpTradeTime); var start = DateTime.Now; var pkprev = new PK8(); while (ctr < Hub.Config.Trade.MaxDumpsPerTrade && DateTime.Now - start < time) { var pk = await ReadUntilPresent(LinkTradePartnerPokemonOffset, 3_000, 1_000, token).ConfigureAwait(false); if (pk == null || pk.Species < 1 || !pk.ChecksumValid || SearchUtil.HashByDetails(pk) == SearchUtil.HashByDetails(pkprev)) { continue; } // Save the new Pokémon for comparison next round. pkprev = pk; // Send results from separate thread; the bot doesn't need to wait for things to be calculated. if (DumpSetting.Dump) { var subfolder = detail.Type.ToString().ToLower(); DumpPokemon(DumpSetting.DumpFolder, subfolder, pk); // received } var la = new LegalityAnalysis(pk); var verbose = la.Report(true); Log($"Shown Pokémon is {(la.Valid ? "Valid" : "Invalid")}."); detail.SendNotification(this, pk, verbose); ctr++; } Log($"Ended Dump loop after processing {ctr} Pokémon"); await ExitSeedCheckTrade(Hub.Config, token).ConfigureAwait(false); if (ctr == 0) { return(PokeTradeResult.TrainerTooSlow); } Hub.Counts.AddCompletedDumps(); detail.Notifier.SendNotification(this, detail, $"Dumped {ctr} Pokémon."); detail.Notifier.TradeFinished(this, detail, detail.TradeData); // blank pk8 return(PokeTradeResult.Success); }