public ActionResult <GetIndexesResponse> GetRoot()
        {
            m_Logger.Info($"[GET] {APIRoutes.CodeSearcherRoute} (GetAllIndexes)");
            var indexes = m_Manager.GetAllIndexes();

            return(new GetIndexesResponse
            {
                Indexes = indexes.ToArray()
            });
        }
예제 #2
0
        internal static void ShowAllIndexesMenu(ICodeSearcherManager manager, ITextBasedUserInterface tui, IMenuNavigator nav)
        {
            string answer;

            do
            {
                tui.Clear();
                var indexes = manager.GetAllIndexes().ToList();
                int count   = 0;
                foreach (var index in indexes)
                {
                    tui.WriteLine($"[{++count}] - ID {index.ID} - SourcePath {index.SourcePath}");
                }

                if (indexes.Count == 0)
                {
                    tui.WriteLine("There are currently no folders indexed!");
                }

                tui.WriteLine($"[{++count}] Return to main menu");
                tui.WriteLine("Please choose: ");
                answer = tui.ReadLine();
                if (int.TryParse(answer, out int selection))
                {
                    if (indexes.Count > 0 && selection < count)
                    {
                        var selectedIndex = indexes[selection - 1];
                        nav.GoToSelectedIndexMenu(manager, selectedIndex, tui);
                    }
                    else
                    {
                        nav.GoToMainMenu(tui);
                    }
                }
            } while (tui.ShouldLoop());
        }