示例#1
0
文件: Program.cs 项目: Bia10/ArcNET
        private static void Main()
        {
            Terminal.RenderLogo();

            var choice = Terminal.GetMainMenuChoice();

            ConsoleExtensions.Log($"Selected choice: {choice}", "info");
            switch (choice)
            {
            case "Extract game data":
                ConsoleExtensions.Log($"Choice: {choice} is currently unsupported!", "error");
                break;

            case "Parse extracted game data":
                Parser.ParseExtractedData();
                break;

            case "Install High-Res patch":
                var pathToHighResDir = GetHighResDir();
                var files            = Directory.EnumerateFiles(
                    pathToHighResDir, "*.*", SearchOption.AllDirectories).ToList();

                if (files.Count == 0)
                {
                    ConsoleExtensions.Log("HighResFolder empty proceeding to clone latest version", "info");
                    GitHub.CloneHighResPatch(pathToHighResDir);
                }

                var configPath = Path.Combine(pathToHighResDir + "\\config.ini");
                if (!File.Exists(configPath))
                {
                    throw new InvalidOperationException($"Config file not found at path: {configPath}");
                }

                ConsoleExtensions.Log("Gathering environment info", "info");
                var envInfo = new EnvironmentInfo();
                envInfo.Print();

                ConsoleExtensions.Log("Auto-config according to environment info", "info");
                HighResConfig.AutoConfigure(envInfo);

                ConsoleExtensions.Log("Summary of config.ini:", "info");
                AnsiConsole.Render(Terminal.ConfigTable());

                if (AnsiConsole.Confirm("Would you like to change config?"))
                {
                    AnsiConsole.WriteException(new NotImplementedException());
                    return;
                }

                HighResConfig.Write(configPath);
                LaunchWeidu(CmdArgs.Weidu.InstallHighResPatch, pathToHighResDir);
                break;

            case "Uninstall High-Res patch":
                LaunchWeidu(CmdArgs.Weidu.UninstallHighResPatch);
                break;

            default:
                ConsoleExtensions.Log($"Choice: {choice} is currently unsupported!", "error");
                break;
            }
        }