コード例 #1
0
        /// <summary>
        /// Send a code with a specific controller
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static async Task <bool> Send(this IRCCCodes code, IRCCController controller)
        {
            if (controller == null)
            {
                throw new InvalidDataException("A controller must be defined");
            }

            return(await controller.Send(code));
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: roddone/BraviaIRCCControl
        private static void Main(string[] args)
        {
            System.Console.Write("Host name ? ");
            string hostname = System.Console.ReadLine();

            System.Console.Write("Pin Code ? ");
            string pin = System.Console.ReadLine();

            if (string.IsNullOrWhiteSpace(pin))
            {
                pin = "0000";
            }

            IRCCController control = new IRCCController(hostname, pinCode: pin);

            IRCCCodesExtension.InitializeController(control);

            Task.Factory.StartNew(async() =>
            {
                await control.Send(IRCCCodes.VolumeUp);
                await IRCCCodes.VolumeUp.Send();
                await IRCCCodes.VolumeUp.Send(control);
                await control.VolumeUp();

                await control.Send(IRCCCodes.VolumeDown);
                await IRCCCodes.VolumeDown.Send();
                await IRCCCodes.VolumeDown.Send(control);
                await control.VolumeDown();


                await control.Send(IRCCCodes.HDMI1);
                await control.Send(IRCCCodes.HDMI2);
                await control.Send(IRCCCodes.HDMI3);
                await control.Send(IRCCCodes.HDMI4);
            });

            System.Console.WriteLine("Press enter to quit.");
            System.Console.ReadLine();
        }
コード例 #3
0
 /// <summary>
 /// Initialize a new controller that will be used by the extensions
 /// </summary>
 /// <param name="hostName"></param>
 /// <param name="port"></param>
 /// <param name="pinCode"></param>
 public static void InitializeController(string hostName, int port = 80, string pinCode = "0000")
 {
     Controller = new IRCCController(hostName, port, pinCode);
 }
コード例 #4
0
 /// <summary>
 /// Initialize a new controller that will be used by the extensions once and for all
 /// </summary>
 /// <param name="controller"></param>
 public static void InitializeController(IRCCController controller)
 {
     Controller = controller ?? throw new ArgumentNullException(nameof(controller));
 }
コード例 #5
0
 public static async Task <bool> VolumeUp(this IRCCController controller)
 {
     return(await controller.Send(IRCCCodes.VolumeUp));
 }
コード例 #6
0
 public static async Task <bool> Stop(this IRCCController controller)
 {
     return(await controller.Send(IRCCCodes.Stop));
 }
コード例 #7
0
 public static async Task <bool> Rewind(this IRCCController controller)
 {
     return(await controller.Send(IRCCCodes.Rewind));
 }
コード例 #8
0
 public static async Task <bool> Play(this IRCCController controller)
 {
     return(await controller.Send(IRCCCodes.Play));
 }
コード例 #9
0
 public static async Task <bool> Forward(this IRCCController controller)
 {
     return(await controller.Send(IRCCCodes.Forward));
 }
コード例 #10
0
 public static async Task <bool> ChannelUp(this IRCCController controller)
 {
     return(await controller.Send(IRCCCodes.ChannelUp));
 }