コード例 #1
0
        private static void EditButtonLayout(string[] args)
        {
            if (args.Length >= 3)
            {
                if (SerialCommunication.LayoutExists(args[0]))
                {
                    switch (args[1])
                    {
                    case "a":
                        SerialCommunication.EditLayout(args[0].Trim(), 0, args.Skip(2).ToArray().ArrayString().Trim());
                        break;

                    case "b":
                        SerialCommunication.EditLayout(args[0].Trim(), 1, args.Skip(2).ToArray().ArrayString().Trim());
                        break;

                    default:
                        Console.WriteLine("Invalid Button");
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("Layout does not exist!");
                }
            }
        }
コード例 #2
0
        private static void CreateButtonLayout(string[] args)
        {
            if (args.Length == 1)
            {
                if (!SerialCommunication.LayoutExists(args[0]))
                {
                    string name = args[0].ToLower().Trim();

                    Console.Write("Button A: ");
                    string command_a = Console.ReadLine().ToLower().Trim();

                    Console.Write("Button B: ");
                    string command_b = Console.ReadLine().ToLower().Trim();

                    SerialCommunication.CreateLayout(new string[] { name, command_a, command_b });
                }
                else
                {
                    Console.WriteLine("Layout already exists!");
                }
            }
        }