From 1713c707f7f579085ee238dc5a08972827996fa9 Mon Sep 17 00:00:00 2001 From: glucaci Date: Thu, 1 Dec 2016 17:52:00 +0100 Subject: [PATCH] Type-safe commands for Audio output devices (partial implemented). --- LibMpc/Commands/Commands.Output.cs | 66 ++++++++++++++++++++++++++++++ LibMpc/Commands/IMpcCommand.cs | 10 +++++ 2 files changed, 76 insertions(+) create mode 100644 LibMpc/Commands/Commands.Output.cs create mode 100644 LibMpc/Commands/IMpcCommand.cs diff --git a/LibMpc/Commands/Commands.Output.cs b/LibMpc/Commands/Commands.Output.cs new file mode 100644 index 0000000..c644aea --- /dev/null +++ b/LibMpc/Commands/Commands.Output.cs @@ -0,0 +1,66 @@ +namespace LibMpc +{ + public partial class Commands + { + /// + /// https://www.musicpd.org/doc/protocol/output_commands.html + /// + public class Output + { + /// + /// Turns an output off. + /// + public class DisableOutput : IMpcCommand + { + private readonly int _outputId; + + public DisableOutput(int outputId) + { + _outputId = outputId; + } + + public string Value => string.Join(" ", "disableoutput", _outputId); + + public object ParseResponse(object response) + { + throw new System.NotImplementedException(); + } + } + + /// + /// Turns an output on. + /// + public class EnableOutput : IMpcCommand + { + private readonly int _outputId; + + public EnableOutput(int outputId) + { + _outputId = outputId; + } + + public string Value => string.Join(" ", "enableoutput", _outputId); + + public object ParseResponse(object response) + { + throw new System.NotImplementedException(); + } + } + + // TODO: toggleoutput // Turns an output on or off, depending on the current state. + + /// + /// Shows information about all outputs. + /// + public class Outputs : IMpcCommand + { + public string Value => "outputs"; + + public object ParseResponse(object response) + { + throw new System.NotImplementedException(); + } + } + } + } +} \ No newline at end of file diff --git a/LibMpc/Commands/IMpcCommand.cs b/LibMpc/Commands/IMpcCommand.cs new file mode 100644 index 0000000..e15db91 --- /dev/null +++ b/LibMpc/Commands/IMpcCommand.cs @@ -0,0 +1,10 @@ +namespace LibMpc +{ + public interface IMpcCommand + { + string Value { get; } + + // TODO: Return IMpdResponse and create type-safe input. + object ParseResponse(object response); + } +} \ No newline at end of file