mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-01-14 22:18:43 +00:00
Namespace for commands changed
This commit is contained in:
parent
301c5adf59
commit
4b19f47946
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@
|
|||||||
|
|
||||||
/src/MpcNET.sln.DotSettings.user
|
/src/MpcNET.sln.DotSettings.user
|
||||||
/src/MpcNET.Test/MpcNET.Test.csproj.DotSettings
|
/src/MpcNET.Test/MpcNET.Test.csproj.DotSettings
|
||||||
|
/src/MpcNET/MpcNET.csproj.DotSettings
|
||||||
|
@ -8,7 +8,8 @@ namespace MpcNET.Test
|
|||||||
{
|
{
|
||||||
public MpcMock()
|
public MpcMock()
|
||||||
{
|
{
|
||||||
Client = new Mpc(new IPEndPoint(IPAddress.Loopback, 6600));
|
var mpdEndpoint = new IPEndPoint(IPAddress.Loopback, 6600);
|
||||||
|
Client = new Mpc(mpdEndpoint);
|
||||||
|
|
||||||
var connected = Task.Run(async () => await Client.ConnectAsync()).Result;
|
var connected = Task.Run(async () => await Client.ConnectAsync()).Result;
|
||||||
TestOutput.WriteLine($"Connected to MPD : {connected}; Version: {Client.Version}");
|
TestOutput.WriteLine($"Connected to MPD : {connected}; Version: {Client.Version}");
|
||||||
|
@ -11,7 +11,7 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task ListAllTest()
|
public async Task ListAllTest()
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Database.ListAll());
|
var response = await Mpc.SendAsync(new Commands.Database.ListAll());
|
||||||
|
|
||||||
TestOutput.WriteLine("ListAllTest Result:");
|
TestOutput.WriteLine("ListAllTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -22,7 +22,7 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task FindGenreTest()
|
public async Task FindGenreTest()
|
||||||
{
|
{
|
||||||
var response = await Test.LibMpcTest.Mpc.SendAsync(new Commands.Commands.Database.Find(MpdTags.Genre, "soundfx"));
|
var response = await Test.LibMpcTest.Mpc.SendAsync(new Commands.Database.Find(MpdTags.Genre, "soundfx"));
|
||||||
|
|
||||||
TestOutput.WriteLine("FindGenreTest Result:");
|
TestOutput.WriteLine("FindGenreTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
|
@ -10,10 +10,10 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task DisableOutputTest()
|
public async Task DisableOutputTest()
|
||||||
{
|
{
|
||||||
var responseOutputs = await Mpc.SendAsync(new Commands.Commands.Output.Outputs());
|
var responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||||
Assert.IsTrue(responseOutputs.Response.Body.Single(output => output.Id.Equals(0)).IsEnabled);
|
Assert.IsTrue(responseOutputs.Response.Body.Single(output => output.Id.Equals(0)).IsEnabled);
|
||||||
|
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Output.DisableOutput(0));
|
var response = await Mpc.SendAsync(new Commands.Output.DisableOutput(0));
|
||||||
|
|
||||||
TestOutput.WriteLine("DisableOutputTest Result:");
|
TestOutput.WriteLine("DisableOutputTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -21,18 +21,18 @@ namespace MpcNET.Test
|
|||||||
Assert.IsTrue(response.Response.Body.Equals(string.Empty));
|
Assert.IsTrue(response.Response.Body.Equals(string.Empty));
|
||||||
Assert.IsTrue(response.Response.State.Status.Equals("OK"));
|
Assert.IsTrue(response.Response.State.Status.Equals("OK"));
|
||||||
|
|
||||||
responseOutputs = await Mpc.SendAsync(new Commands.Commands.Output.Outputs());
|
responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||||
Assert.IsFalse(responseOutputs.Response.Body.Single(output => output.Id.Equals(0)).IsEnabled);
|
Assert.IsFalse(responseOutputs.Response.Body.Single(output => output.Id.Equals(0)).IsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task EnableOutputTest()
|
public async Task EnableOutputTest()
|
||||||
{
|
{
|
||||||
var responseOutputs = await Mpc.SendAsync(new Commands.Commands.Output.Outputs());
|
var responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||||
// By default should be disable from mpd.config
|
// By default should be disable from mpd.config
|
||||||
Assert.IsFalse(responseOutputs.Response.Body.Single(output => output.Id.Equals(1)).IsEnabled);
|
Assert.IsFalse(responseOutputs.Response.Body.Single(output => output.Id.Equals(1)).IsEnabled);
|
||||||
|
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Output.EnableOutput(1));
|
var response = await Mpc.SendAsync(new Commands.Output.EnableOutput(1));
|
||||||
|
|
||||||
TestOutput.WriteLine("EnableOutputTest Result:");
|
TestOutput.WriteLine("EnableOutputTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -40,17 +40,17 @@ namespace MpcNET.Test
|
|||||||
Assert.IsTrue(response.Response.Body.Equals(string.Empty));
|
Assert.IsTrue(response.Response.Body.Equals(string.Empty));
|
||||||
Assert.IsTrue(response.Response.State.Status.Equals("OK"));
|
Assert.IsTrue(response.Response.State.Status.Equals("OK"));
|
||||||
|
|
||||||
responseOutputs = await Mpc.SendAsync(new Commands.Commands.Output.Outputs());
|
responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||||
Assert.IsTrue(responseOutputs.Response.Body.Single(output => output.Id.Equals(1)).IsEnabled);
|
Assert.IsTrue(responseOutputs.Response.Body.Single(output => output.Id.Equals(1)).IsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task ToggleOutputTest()
|
public async Task ToggleOutputTest()
|
||||||
{
|
{
|
||||||
var responseOutputs = await Mpc.SendAsync(new Commands.Commands.Output.Outputs());
|
var responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||||
Assert.IsTrue(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);
|
Assert.IsTrue(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);
|
||||||
|
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Output.ToggleOutput(2));
|
var response = await Mpc.SendAsync(new Commands.Output.ToggleOutput(2));
|
||||||
|
|
||||||
TestOutput.WriteLine("ToggleOutputTest Result:");
|
TestOutput.WriteLine("ToggleOutputTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -58,14 +58,14 @@ namespace MpcNET.Test
|
|||||||
Assert.IsTrue(response.Response.Body.Equals(string.Empty));
|
Assert.IsTrue(response.Response.Body.Equals(string.Empty));
|
||||||
Assert.IsTrue(response.Response.State.Status.Equals("OK"));
|
Assert.IsTrue(response.Response.State.Status.Equals("OK"));
|
||||||
|
|
||||||
responseOutputs = await Mpc.SendAsync(new Commands.Commands.Output.Outputs());
|
responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||||
Assert.IsFalse(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);
|
Assert.IsFalse(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task LisOutputsTest()
|
public async Task LisOutputsTest()
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Output.Outputs());
|
var response = await Mpc.SendAsync(new Commands.Output.Outputs());
|
||||||
|
|
||||||
TestOutput.WriteLine("LisOutputsTest Result:");
|
TestOutput.WriteLine("LisOutputsTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
|
@ -13,7 +13,7 @@ namespace MpcNET.Test
|
|||||||
[DataRow("_My Playlist", 5)]
|
[DataRow("_My Playlist", 5)]
|
||||||
public async Task ListPlaylistTest(string playlistName, int numberOfFiles)
|
public async Task ListPlaylistTest(string playlistName, int numberOfFiles)
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Playlists.Stored.ListPlaylist(playlistName));
|
var response = await Mpc.SendAsync(new Commands.Playlists.Stored.ListPlaylist(playlistName));
|
||||||
|
|
||||||
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
|
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -27,7 +27,7 @@ namespace MpcNET.Test
|
|||||||
[DataRow("_My Playlist", 5)]
|
[DataRow("_My Playlist", 5)]
|
||||||
public async Task ListPlaylistInfoTest(string playlistName, int numberOfFiles)
|
public async Task ListPlaylistInfoTest(string playlistName, int numberOfFiles)
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Playlists.Stored.ListPlaylistInfo(playlistName));
|
var response = await Mpc.SendAsync(new Commands.Playlists.Stored.ListPlaylistInfo(playlistName));
|
||||||
|
|
||||||
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
|
TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -41,7 +41,7 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task ListPlaylistsTest()
|
public async Task ListPlaylistsTest()
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Playlists.Stored.ListPlaylists());
|
var response = await Mpc.SendAsync(new Commands.Playlists.Stored.ListPlaylists());
|
||||||
|
|
||||||
TestOutput.WriteLine($"ListPlaylistsTest Result:");
|
TestOutput.WriteLine($"ListPlaylistsTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
|
@ -10,7 +10,7 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task CommandsTest()
|
public async Task CommandsTest()
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Reflection.Commands());
|
var response = await Mpc.SendAsync(new Commands.Reflection.Commands());
|
||||||
|
|
||||||
TestOutput.WriteLine($"CommandsTest (commands: {response.Response.Body.Count()}) Result:");
|
TestOutput.WriteLine($"CommandsTest (commands: {response.Response.Body.Count()}) Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -28,7 +28,7 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task TagTypesTest()
|
public async Task TagTypesTest()
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Reflection.TagTypes());
|
var response = await Mpc.SendAsync(new Commands.Reflection.TagTypes());
|
||||||
|
|
||||||
TestOutput.WriteLine("TagTypesTest Result:");
|
TestOutput.WriteLine("TagTypesTest Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -39,7 +39,7 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task UrlHandlersTest()
|
public async Task UrlHandlersTest()
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Reflection.UrlHandlers());
|
var response = await Mpc.SendAsync(new Commands.Reflection.UrlHandlers());
|
||||||
|
|
||||||
TestOutput.WriteLine($"UrlHandlersTest (handlers: {response.Response.Body.Count()}) Result:");
|
TestOutput.WriteLine($"UrlHandlersTest (handlers: {response.Response.Body.Count()}) Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
@ -55,7 +55,7 @@ namespace MpcNET.Test
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task DecodersTest()
|
public async Task DecodersTest()
|
||||||
{
|
{
|
||||||
var response = await Mpc.SendAsync(new Commands.Commands.Reflection.Decoders());
|
var response = await Mpc.SendAsync(new Commands.Reflection.Decoders());
|
||||||
|
|
||||||
TestOutput.WriteLine($"DecodersTest (decoders: {response.Response.Body.Count()}) Result:");
|
TestOutput.WriteLine($"DecodersTest (decoders: {response.Response.Body.Count()}) Result:");
|
||||||
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
TestOutput.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
|
||||||
|
@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using MpcNET.Tags;
|
using MpcNET.Tags;
|
||||||
using MpcNET.Types;
|
using MpcNET.Types;
|
||||||
|
|
||||||
namespace MpcNET.Commands
|
namespace MpcNET
|
||||||
{
|
{
|
||||||
public partial class Commands
|
public partial class Commands
|
||||||
{
|
{
|
||||||
@ -70,6 +70,9 @@ namespace MpcNET.Commands
|
|||||||
|
|
||||||
// TODO: findadd
|
// TODO: findadd
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lists all songs and directories in URI.
|
||||||
|
/// </summary>
|
||||||
public class ListAll : IMpcCommand<IEnumerable<MpdDirectory>>
|
public class ListAll : IMpcCommand<IEnumerable<MpdDirectory>>
|
||||||
{
|
{
|
||||||
public string Value => "listall";
|
public string Value => "listall";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using MpcNET.Types;
|
using MpcNET.Types;
|
||||||
|
|
||||||
namespace MpcNET.Commands
|
namespace MpcNET
|
||||||
{
|
{
|
||||||
public partial class Commands
|
public partial class Commands
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MpcNET.Types;
|
using MpcNET.Types;
|
||||||
|
|
||||||
namespace MpcNET.Commands
|
namespace MpcNET
|
||||||
{
|
{
|
||||||
public partial class Commands
|
public partial class Commands
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MpcNET.Types;
|
using MpcNET.Types;
|
||||||
|
|
||||||
namespace MpcNET.Commands
|
namespace MpcNET
|
||||||
{
|
{
|
||||||
public partial class Commands
|
public partial class Commands
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MpcNET.Commands
|
namespace MpcNET
|
||||||
{
|
{
|
||||||
public interface IMpcCommand<out T>
|
public interface IMpcCommand<out T>
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using MpcNET.Commands;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MpcNET.Message
|
namespace MpcNET.Message
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using MpcNET.Commands;
|
|
||||||
|
|
||||||
namespace MpcNET.Message
|
namespace MpcNET.Message
|
||||||
{
|
{
|
||||||
public interface IMpdRequest<T>
|
public interface IMpdRequest<T>
|
||||||
|
@ -2,7 +2,6 @@ using System.Net;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MpcNET.Commands;
|
|
||||||
using MpcNET.Message;
|
using MpcNET.Message;
|
||||||
|
|
||||||
namespace MpcNET
|
namespace MpcNET
|
||||||
|
@ -5,7 +5,6 @@ using System.Linq;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MpcNET.Commands;
|
|
||||||
using MpcNET.Message;
|
using MpcNET.Message;
|
||||||
using MpcNET.Utils;
|
using MpcNET.Utils;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user