Пример #1
0
        public static void Main(string[] args)
        {
            ArgParser      argParser   = new ArgParser(args);
            CMLConfig      config      = argParser.GetResult();
            CMLApplication application = new CMLApplication(config);

            application.Run();
            //CMLConfig.Write(config, "config.json");
        }
Пример #2
0
        private void init()
        {
            Random      = new Random();
            renderer    = new Renderer(50, 25);
            PlayHandler = new MusicPlayHandler(musicFolder);
            Me          = this;
            IsEnabled   = true;

            // Console Settings
            Console.OutputEncoding = Encoding.UTF8;
            Console.CursorVisible  = false;
            ConsoleUtil.FixConsoleWindowSize();

            // Keyboard
            keyBoardHandler = new KeyBoardHandler();
            // 可以非硬编码,由配置文件决定
            keyBoardHandler.Register(ConsoleKey.Q, () => { Exit(); });
            keyBoardHandler.Register(ConsoleKey.N, () => { PlayHandler.SwitchNextSong(); });
            keyBoardHandler.Register(ConsoleKey.M, () => { PlayHandler.SwitchPrevSong(); });
            keyBoardHandler.Register(ConsoleKey.S, () => { PlayHandler.Stop(); });
            keyBoardHandler.Register(ConsoleKey.A, () => { PlayHandler.Play(); });
            keyBoardHandler.Register(ConsoleKey.P, () => { PlayHandler.Pause(); });
        }