Exemplo n.º 1
0
        public void Create()
        {
            var remotesDir = _config.GetRemotesDirectory();

            if (!remotesDir.Exists)
            {
                Console.WriteLine("The remotes directory does not exist. It must exist and be writeable.");
                Console.WriteLine("  Path:" + remotesDir.FullName);
                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("Press any key to return to the main menu.");
                Console.ReadKey(true);
                return;
            }

            var      remote = MakeNewRemote();
            FileInfo file   = AskForNameToSaveWith();

            if (file == null)
            {
                return;
            }
            _config.SaveRemote(remote, file);
            Console.WriteLine("New remote profile saved to " + file.FullName);
            Console.WriteLine("To add buttons to this new remote modify it.");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine();
            Console.WriteLine("Raspberry IR Blaster - Remote Builder");

            if (!Common.ConfigManager.TryMakeFromCommandLineArgs(args, out var configManager))
            {
                return;
            }
            Config = configManager;
            Config.LoadGeneralConfig();

            while (true)
            {
                Console.WriteLine();
                Console.WriteLine();
                int action = AskMultipleChoice("What do you want to do?", "Exit", "Clear server cache", "List remotes", "Add a new remote", "Modify a remote", "Delete a remote", "View Raw IR");
                switch (action)
                {
                case 0:
                    Console.WriteLine("Exiting.");
                    return;

                case 1:
                    HttpRequestMaker.SignalClearCache();
                    break;

                case 2:
                    Console.WriteLine("Remote profiles:");
                    var remotes = Config.GetRemotes();
                    if (remotes.Length > 0)
                    {
                        foreach (var file in remotes)
                        {
                            Console.WriteLine("  " + file.FullName);
                        }
                    }
                    else
                    {
                        Console.WriteLine($"No remotes found in '{Config.GetRemotesDirectory()}'.");
                    }
                    Console.WriteLine();
                    Console.WriteLine();
                    break;

                case 3:
                    new RemoteCreator(Config).Create();
                    break;

                case 4:
                    ModifyRemote();
                    break;

                case 5:
                    DeleteRemote();
                    break;

                case 6:
                    LogRawIR();
                    break;

                default:
                    throw new Exception();
                }
            }
        }