コード例 #1
0
ファイル: Program.cs プロジェクト: willsmith9182/Inquirer.cs
        private static void Main(string[] args)
        {
            string answer = string.Empty;

            Inquirer.Prompt(Question.Input("1")).Bind(() => answer);
            Inquirer.Prompt(Question.Input("2")).Bind(() => answer).After(() =>
            {
                int x = 1;
            });
            Inquirer.Prompt(() =>
            {
                if (answer.Length > 5)
                {
                    return(Question.Input("3"));
                }

                return(null);
            }).Then(answer2 =>
            {
                Inquirer.Prompt(Question.Input("3.1")).Bind(() => answer);
                Inquirer.Prompt(Question.Input("3.2")).Bind(() => answer).After(() =>
                {
                    answer = "Do this after";
                });
                Inquirer.Prompt(Question.Input("3.3")).Bind(() => answer);
            });
            Inquirer.Go();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            bool              done              = false;
            ConfigRepository  config            = new ConfigRepository();
            HexConverter      hex               = new HexConverter();
            FPSFixRepository  fPSFixRepository  = new FPSFixRepository(config, hex);
            ProcessRepository processRepository = new ProcessRepository(config.Get("FF7ProcessName"));

            List <CommandOption> colors = Enum.GetValues(typeof(CommandOption)).Cast <CommandOption>().ToList();

            for (;;)
            {
                Inquirer.Prompt(Question.List("Choose favourite color", colors)).Then((command) => {
                    switch (command)
                    {
                    case CommandOption.Exit:
                        done = true;
                        return;

                    case CommandOption.GetFPSFixValueFromFile:
                        Console.Clear();
                        Console.WriteLine("Get FPSFix value");
                        Console.WriteLine(fPSFixRepository.GetFPSFIXValue().ToString());
                        Console.ReadLine();
                        break;

                    case CommandOption.SaveFPSFixValueToFile:
                        Console.Clear();
                        Console.WriteLine("Enter a new value: (integer only!)");
                        int newValue = int.Parse(Console.ReadLine());
                        Console.WriteLine($"New value is: {newValue.ToString()}");
                        fPSFixRepository.SaveFPSFixValue(newValue);
                        Console.ReadLine();
                        break;

                    case CommandOption.AttachToGame:
                        Task.Run(() => RunGame());
                        break;

                    case CommandOption.DetatchFromGame:
                        break;
                    }
                });
                Inquirer.Go();

                if (done)
                {
                    return;
                }
            }
        }