コード例 #1
0
 public Context(ReShadeManagerRuntime runtime)
 {
     Runtime  = runtime;
     Commands = new Dictionary <string, Action <IReadOnlyList <string> > >
     {
         { "install", Install },
         { "help", Help },
         { "quit", Quit },
         { "exit", Quit },
         { "save", Save },
         { "update", Update },
         { "list", List }
     };
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: luluco250/ReShadeManager
        static void Main()
        {
            try
            {
                var mgr = new ReShadeManagerRuntime
                          (
                    rootPath: Directory.GetCurrentDirectory()
                    // Does not seem to work when publish as a self-contained exe.
                    //rootPath: AppDomain.CurrentDomain.SetupInformation.ApplicationBase ?? ""
                          );

                Console.WriteLine($"Starting with root path: {mgr.RootPath}");

                Console.WriteLine(
                    mgr.LoadConfig()
                                                ? "Configuration loaded."
                                                : "No configuration found, using defaults.");

                if (!mgr.TryLoadGit())
                {
                    Console.WriteLine("Failed to find git path!");
                    Console.Write("Please specify (empty to quit): ");

                    var gitCmdLine = Console.ReadLine();
                    if (string.IsNullOrWhiteSpace(gitCmdLine))
                    {
                        return;
                    }

                    mgr.TryLoadGit(gitCmdLine);
                }

                Console.WriteLine("Starting interpreter...");
                var repl = new Interpreter(new Context(mgr));
                repl.Start();
            }
            catch (AggregateException e)
            {
                Console.Error.WriteLine(
                    $"Fatal error: {e.Message}\n{e.InnerExceptions}");
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(
                    $"Fatal error: {e.Message}\n{e.InnerException}");
            }
        }