internal static void ShowSelectedIndexMenu(ICodeSearcherManager manager, ICodeSearcherIndex selectedIndex, ITextBasedUserInterface tui, IMenuNavigator nav) { string answer; do { tui.WriteLine($"ID:\t\t{selectedIndex.ID}"); tui.WriteLine($"Source:\t\t{selectedIndex.SourcePath}"); tui.Write($"File Extensions:\t\t"); foreach (var extension in selectedIndex.FileExtensions) { tui.Write($"{extension}, "); } tui.WriteLine(); tui.WriteLine($"Created on: {selectedIndex.CreatedTime.ToString("yyyy-MM-dd H:mm:ss")}"); tui.WriteLine("[1] Search in Index"); tui.WriteLine("[2] Delete Index"); tui.WriteLine("[3] Return to main menu"); tui.WriteLine("Please choose: "); answer = tui.ReadLine(); if (int.TryParse(answer, out int selection)) { if (1.Equals(selection)) { var logic = GetCodeSearcherLogicByIndex(selectedIndex); logic.SearchWithinExistingIndex( startCallback: () => { }, getSearchWord: () => { bool exit = ReadWordToSearch(out string word); word?.Trim(); return(word, exit); }, getMaximumNumberOfHits: () => { return(200); }, getHitsPerPage: () => { return(50); }, getExporter: () => { return(false, null); }, getSingleResultPrinter: () => { return(new WildcardResultPrinter()); }, finishedCallback: (timeSpan) => { Console.WriteLine("Press any key to continue"); Console.ReadKey(); }, endOfSearchCallback: () => { }, wildcardSearch: true ); } else if (2.Equals(selection)) { manager.DeleteIndex(selectedIndex.ID); tui.WriteLine($"Index with ID {selectedIndex.ID} deleted!"); } else if (3.Equals(selection)) { nav.GoToMainMenu(tui); } } } while (tui.ShouldLoop()); }
public ActionResult <DeleteIndexResponse> DeleteExistingIndex(DeleteIndexRequest model) { m_Logger.Info($"[DELETE] {APIRoutes.CreateIndexRoute}"); bool success = true; try { m_Manager.DeleteIndex(model.IndexID); } catch (NotSupportedException e) { m_Logger.Error(e.Message); success = false; } return(new DeleteIndexResponse { Succeeded = success }); }