// Token: 0x060155A9 RID: 87465 RVA: 0x0056AFA4 File Offset: 0x005691A4
    public static DebugCmdManager Create(IConsoleMode debugConsoleMode)
    {
        DebugCmdManager debugCmdManager = new DebugCmdManager();

        debugCmdManager._Init(debugConsoleMode);
        return(debugCmdManager);
    }
 // Token: 0x060155AC RID: 87468 RVA: 0x0056B058 File Offset: 0x00569258
 private void _Init(IConsoleMode consoleMode)
 {
     this.LoadIDebugCmds(Assembly.GetExecutingAssembly());
     this.LoadOldCommands();
 }
Exemple #3
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false);
            IConfigurationRoot configuration = builder.Build();

            var dbFileName = configuration.GetSection("wordDb").Value;

            var yadicapiKey     = configuration.GetSection("yadicapi").GetSection("key").Value;
            var yadicapiTimeout = TimeSpan.FromSeconds(5);

            var yatransapiKey     = configuration.GetSection("yatransapi").GetSection("key").Value;
            var yatransapiTimeout = TimeSpan.FromSeconds(5);

            var addWordService = new AddWordService(
                new UsersWordsService(new UserWordsRepo(dbFileName)),
                new YandexDictionaryApiClient(yadicapiKey, yadicapiTimeout),
                new YandexTranslateApiClient(yatransapiKey, yatransapiTimeout),
                new DictionaryService(new DictionaryRepository(dbFileName)));

            var examService = new ExamService(
                new ExamsAndMetricService(new ExamsAndMetricsRepo(dbFileName)),
                new DictionaryService(new DictionaryRepository(dbFileName)),
                new UsersWordsService(new UserWordsRepo(dbFileName))
                );
            var authorizeService = new AuthorizeService(new UserService(new UserRepo(dbFileName)));

            var modes = new IConsoleMode[]
            {
                new ExamMode(addWordService, examService),
                new WordAdditionMode(addWordService),
                //  new GraphsStatsMode(),
                //   new RandomizeMode(),
                //   new AddPhraseToWordsMode(yapiDicClient),
            };

            DoMigration.ApplyMigrations(dbFileName);

            Console.WriteLine("Dic started");

            ConsoleKeyInfo val;
            int            choice;

            //var metrics = repo.GetAllQuestionMetrics();

            //string path = "T:\\Dictionary\\eng_rus_full.json";
            //Console.WriteLine("Loading dictionary");
            //var dictionary = Dic.Logic.Dictionaries.Tools.ReadFromFile(path);

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(@"
     ____ _  _ ____ ___ _ ____ _  _ ____ ___  ____ _    
     |    |__| |  |  |  | [__  |_/  |__|   /  |__| |    
     |___ |  | |__|  |  | ___] | \_ |  |  /__ |  | |___                                                    
");
            Console.ResetColor();

            //--------begin registration

            User user = null;

            while (user == null)
            {
                Console.WriteLine();
                Console.WriteLine("ESC: Quit");

                Console.WriteLine("1: NewUser");
                Console.WriteLine("2: Login");
                Console.WriteLine();
                Console.Write("Choose action:");
                val = Console.ReadKey();
                Console.WriteLine();
                choice = ((int)val.Key - (int)ConsoleKey.D1) + 1;
                if (choice == 1)
                {
                    Console.Write("Enter your name: ");
                    var name = Console.ReadLine();
                    Console.WriteLine("Enter login: "******"Enter password: "******"Enter email: ");
                    var email = Console.ReadLine();

                    user = authorizeService.CreateUser(name, login, password, email);

                    if (user != null)
                    {
                        Console.WriteLine("New user has been added!");
                        Console.WriteLine($"Hello, {user.Name}. Press any key to continue.");
                    }
                    else
                    {
                        Console.WriteLine("Error in registration. Try again.");
                    }
                }
                if (choice == 2)
                {
                    Console.WriteLine("Enter login: "******"Enter password: "******"Hello, {user.Name}. Press any key to continue.");
                    }
                    else
                    {
                        Console.WriteLine("Wrong Password or Name. Try again. Press any key to continue.");
                    }
                }
                Console.ReadKey();
            }

            Console.Clear();
            //---------end registration-------


            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("ESC: Quit");

                for (int i = 0; i < modes.Length; i++)
                {
                    Console.WriteLine($"{i+1}: {modes[i].Name}");
                }

                Console.WriteLine();
                Console.Write("Choose mode:");

                val = Console.ReadKey();
                Console.WriteLine();

                if (val.Key == ConsoleKey.Escape)
                {
                    return;
                }

                choice = ((int)val.Key - (int)ConsoleKey.D1);
                if (choice > -1 && choice < modes.Length)
                {
                    var selected = modes[choice];
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("======   " + selected.Name + "    ======");
                    Console.ResetColor();

                    modes[choice].Enter(1);
                }
                Console.WriteLine();

                Console.WriteLine("===========================================");
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false);
            IConfigurationRoot configuration = builder.Build();

            var yadicapiKey     = configuration.GetSection("yadicapi").GetSection("key").Value;
            var yadicapiTimeout = TimeSpan.FromSeconds(5); //Configuration.GetValue<TimeSpan>("yadicapi:timeout");

            var dbFileName        = configuration.GetSection("wordDb").Value;
            var yatransapiKey     = configuration.GetSection("yatransapi").GetSection("key").Value;
            var yatransapiTimeout = TimeSpan.FromSeconds(5); //Configuration.GetValue<TimeSpan>("yatransapi:timeout");

            var yapiDicClient      = new YandexDictionaryApiClient(yadicapiKey, yadicapiTimeout);
            var yapiTransClient    = new YandexTranslateApiClient(yatransapiKey, yatransapiTimeout);
            var dicRepo            = new DictionaryRepository(dbFileName);
            var examsAndMetricRepo = new ExamsAndMetricsRepo(dbFileName);
            var userRepo           = new UserRepo(dbFileName);
            var userWordRepo       = new UserWordsRepo(dbFileName);

            var dictionaryService     = new DictionaryService(dicRepo);
            var examsAndMetricService = new ExamsAndMetricService(examsAndMetricRepo);
            var userService           = new UserService(userRepo);
            var userWordService       = new UsersWordService(userWordRepo);

            DoMigration.ApplyMigrations(dbFileName);

            var modes = new IConsoleMode[]
            {
                //      new ExamMode(userWordService,userService,examsAndMetricService),
                new WordAdditionMode(yapiTransClient, yapiDicClient, userWordService, dictionaryService),
                //   new GraphsStatsMode(),
                //   new RandomizeMode(),
                //   new AddPhraseToWordsMode(yapiDicClient),
            };


            //  Console.Clear();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(@"
     ____ _  _ ____ ___ _ ____ _  _ ____ ___  ____ _    
     |    |__| |  |  |  | [__  |_/  |__|   /  |__| |    
     |___ |  | |__|  |  | ___] | \_ |  |  /__ |  | |___    (test)                                                
");
            Console.ResetColor();


            //Registration user


            ConsoleKeyInfo val;
            int            choice;
            User           user = null;

            while (user == null)
            {
                Console.WriteLine();
                Console.WriteLine("ESC: Quit");

                Console.WriteLine("1: NewUser");
                Console.WriteLine("2: Login");
                Console.WriteLine();
                Console.Write("Choose action:");
                val = Console.ReadKey();
                Console.WriteLine();
                choice = ((int)val.Key - (int)ConsoleKey.D1) + 1;
                if (choice == 1)
                {
                    user = Autorize.CreateNewUser(userService);
                    if (user != null)
                    {
                        Console.WriteLine("New user has been added!");
                        Console.WriteLine($"Hello, {user.Name}. Press any key to continue.");
                    }
                    else
                    {
                        Console.WriteLine("Error in registration. Try again.");
                    }
                }
                if (choice == 2)
                {
                    user = Autorize.LoginUser(userService);
                    if (user != null)
                    {
                        Console.WriteLine($"Hello, {user.Name}");
                    }
                    else
                    {
                        Console.WriteLine("Wrong Password or Name. Try again.");
                    }
                }
                Console.ReadKey();
            }


            Console.Clear();

            /* var users = userRepo.GetAllUsers();
             * foreach(var us in users)
             * {
             *   Console.WriteLine(us.Name + ":" + us.Login + ":" + us.Password);
             * }
             */

            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("ESC: Quit");

                for (int i = 0; i < modes.Length; i++)
                {
                    Console.WriteLine($"{i + 1}: {modes[i].Name}");
                }

                Console.WriteLine();
                Console.Write("Choose mode:");

                val = Console.ReadKey();
                Console.WriteLine();

                if (val.Key == ConsoleKey.Escape)
                {
                    return;
                }

                choice = ((int)val.Key - (int)ConsoleKey.D1);
                if (choice > -1 && choice < modes.Length)
                {
                    var selected = modes[choice];
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("======   " + selected.Name + "    ======");
                    Console.ResetColor();

                    modes[choice].Enter(user);
                }
                Console.WriteLine();

                Console.WriteLine("===========================================");
            }
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false);
            IConfigurationRoot configuration = builder.Build();

            var yadicapiKey     = configuration.GetSection("yadicapi").GetSection("key").Value;
            var yadicapiTimeout = TimeSpan.FromSeconds(5);

            var dbFileName        = configuration.GetSection("wordDb").Value;
            var yatransapiKey     = configuration.GetSection("yatransapi").GetSection("key").Value;
            var yatransapiTimeout = TimeSpan.FromSeconds(5);


            var yapiDicClient = new YandexDictionaryApiClient(yadicapiKey, yadicapiTimeout);

            var yapiTransClient = new YandexTranslateApiClient(yatransapiKey, yatransapiTimeout);

            var modes = new IConsoleMode[]
            {
                new ExamMode(),
                new WordAdditionMode(yapiTransClient, yapiDicClient),
                new GraphsStatsMode(),
                //   new RandomizeMode(),
                //   new AddPhraseToWordsMode(yapiDicClient),
            };

            var repo = new WordsRepository(dbFileName);

            repo.ApplyMigrations();

            Console.WriteLine("Dic started");

            //var metrics = repo.GetAllQuestionMetrics();

            //string path = "T:\\Dictionary\\eng_rus_full.json";
            //Console.WriteLine("Loading dictionary");
            //var dictionary = Dic.Logic.Dictionaries.Tools.ReadFromFile(path);
            var service = new NewWordsService(new RuengDictionary(), repo);

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(@"
     ____ _  _ ____ ___ _ ____ _  _ ____ ___  ____ _    
     |    |__| |  |  |  | [__  |_/  |__|   /  |__| |    
     |___ |  | |__|  |  | ___] | \_ |  |  /__ |  | |___                                                    
");
            Console.ResetColor();
            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("ESC: Quit");

                for (int i = 0; i < modes.Length; i++)
                {
                    Console.WriteLine($"{i+1}: {modes[i].Name}");
                }

                Console.WriteLine();
                Console.Write("Choose mode:");

                var val = Console.ReadKey();
                Console.WriteLine();

                if (val.Key == ConsoleKey.Escape)
                {
                    return;
                }

                var choice = ((int)val.Key - (int)ConsoleKey.D1);
                if (choice > -1 && choice < modes.Length)
                {
                    var selected = modes[choice];
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("======   " + selected.Name + "    ======");
                    Console.ResetColor();

                    modes[choice].Enter(service);
                }
                Console.WriteLine();

                Console.WriteLine("===========================================");
            }
        }