Exemplo n.º 1
0
        private static async Task Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    Console.WriteLine("Please enter a word to search.");
                    args = Console.ReadLine()?.Split(' ');
                }

                Console.WriteLine("Searching...");

                var searchManager = SearchFightFactory.CreateSearchManager();
                var result        = await searchManager.GetSearchReport(args?.ToList());

                Console.Clear();
                Console.WriteLine(result);
            }
            catch (SearchFightException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Unexpected error: {ex.Message}");
            }
            Console.ReadKey();
        }
Exemplo n.º 2
0
        private static async Task Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    Console.WriteLine("ngrese la(s) cadena(s) a buscar:");
                    args = Console.ReadLine()?.Split(' ');
                }

                Console.WriteLine("Cargando resultados ...");

                var searchManager = SearchFightFactory.CreateSearchManager();
                var result        = await searchManager.GetSearchReport(args?.ToList());

                Console.Clear();
                Console.WriteLine(result);
            }
            catch (SearchFightException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error al generar el reporte: {ex.Message}");
            }
            Console.ReadKey();
        }
        private static async Task Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    Console.WriteLine("Please enter a query to search....");
                    args = Console.ReadLine()?.Split('"')
                           .Select((element, index) => index % 2 == 0                                            // If even index
                                           ? element.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) // Split the item
                                           : new string[] { element })                                           // Keep the entire item
                           .SelectMany(element => element).ToArray();
                }

                Console.WriteLine("Loading results ...");

                var searchManager = SearchFightFactory.CreateSearchManager();
                var result        = await searchManager.GetSearchReport(args?.ToList());

                Console.Clear();
                Console.WriteLine(result);
            }
            catch (SearchFightException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Unexpected error generating the report: {ex.Message}");
            }
            Console.ReadKey();
        }
Exemplo n.º 4
0
 public void Init()
 {
     _searchManager = SearchFightFactory.CreateSearchManager();
 }