mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-01-14 22:18:43 +00:00
Clean up
This commit is contained in:
parent
2c245acaad
commit
61b6e33b79
@ -1,8 +1,9 @@
|
|||||||
<img src="Sources/MpcNET/icon.png" width="128">
|
<img src="icon.png" width="128">
|
||||||
|
|
||||||
MpcNET
|
MpcNET
|
||||||
===========
|
===========
|
||||||
Pure .NET Client Library for [**Music Player Daemon**](https://www.musicpd.org/) Servers.
|
Pure .NET Client Library for [**Music Player Daemon**](https://www.musicpd.org/) Servers.
|
||||||
|
The heart and soul of [Stylophone](https://github.com/Difegue/Stylophone).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
### Connection
|
### Connection
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="FindCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Database
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using MpcNET.Tags;
|
|
||||||
using MpcNET.Types;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finds songs in the database that is exactly "searchText".
|
|
||||||
/// https://www.musicpd.org/doc/protocol/database.html.
|
|
||||||
/// </summary>
|
|
||||||
public class FindCommand : IMpcCommand<IEnumerable<IMpdFile>>
|
|
||||||
{
|
|
||||||
private readonly List<KeyValuePair<ITag, string>> filters;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="FindCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tag">The tag.</param>
|
|
||||||
/// <param name="searchText">The search text.</param>
|
|
||||||
public FindCommand(ITag tag, string searchText)
|
|
||||||
{
|
|
||||||
this.filters = new List<KeyValuePair<ITag, string>>();
|
|
||||||
this.filters.Add(new KeyValuePair<ITag, string>(tag, searchText));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="FindCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filters">List of key/value filters</param>
|
|
||||||
public FindCommand(List<KeyValuePair<ITag, string>> filters)
|
|
||||||
{
|
|
||||||
this.filters = filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() =>
|
|
||||||
string.Join(" ",
|
|
||||||
"find",
|
|
||||||
string.Join(" ",
|
|
||||||
this.filters
|
|
||||||
.Select(x => string.Join(" ",
|
|
||||||
x.Key.Value, escape(x.Value)))
|
|
||||||
.ToArray()));
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public IEnumerable<IMpdFile> Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return MpdFile.CreateList(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string escape(string value) => string.Format("\"{0}\"", value.Replace("\\", "\\\\").Replace("\"", "\\\""));
|
|
||||||
}
|
|
||||||
// TODO: rescan
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="AddCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds the file URI to the playlist (directories add recursively). URI can also be a single file.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class AddCommand : IMpcCommand<string>
|
|
||||||
{
|
|
||||||
private readonly string uri;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="AddCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uri">The URI.</param>
|
|
||||||
public AddCommand(string uri)
|
|
||||||
{
|
|
||||||
this.uri = uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => string.Join(" ", "add", $"\"{this.uri}\"");
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public string Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return string.Join(", ", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="AddIdCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a song to the playlist (non-recursive) and returns the song id.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class AddIdCommand : IMpcCommand<string>
|
|
||||||
{
|
|
||||||
private readonly string uri;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="AddIdCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uri">The URI.</param>
|
|
||||||
public AddIdCommand(string uri)
|
|
||||||
{
|
|
||||||
this.uri = uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => string.Join(" ", "addid", $"\"{this.uri}\"");
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public string Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return string.Join(", ", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="ClearCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clears the current playlist.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class ClearCommand : IMpcCommand<string>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => "clear";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public string Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return string.Join(", ", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="DeleteCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deletes a song from the playlist.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class DeleteCommand : IMpcCommand<string>
|
|
||||||
{
|
|
||||||
private readonly int position;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="DeleteCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position">The position.</param>
|
|
||||||
public DeleteCommand(int position)
|
|
||||||
{
|
|
||||||
this.position = position;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => string.Join(" ", "delete", this.position);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public string Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return string.Join(", ", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="DeleteIdCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deletes the song SONGID from the playlist.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class DeleteIdCommand : IMpcCommand<string>
|
|
||||||
{
|
|
||||||
private readonly int songId;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="DeleteIdCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="songId">The song identifier.</param>
|
|
||||||
public DeleteIdCommand(int songId)
|
|
||||||
{
|
|
||||||
this.songId = songId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => string.Join(" ", "deleteid", this.songId);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public string Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return string.Join(", ", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="AddCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Moves the song with FROM (songid) to TO (playlist index) in the playlist.
|
|
||||||
/// If TO is negative, it is relative to the current song in the playlist (if there is one)
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class MoveIdCommand : IMpcCommand<string>
|
|
||||||
{
|
|
||||||
private readonly int from;
|
|
||||||
private readonly int to;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="MoveIdCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="from">From (songid)</param>
|
|
||||||
/// <param name="to">To (playlist index)</param>
|
|
||||||
public MoveIdCommand(int from, int to)
|
|
||||||
{
|
|
||||||
this.from = from;
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => string.Join(" ", "moveid", from, to);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public string Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return string.Join(", ", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="PlaylistCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using MpcNET.Types;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Displays the current playlist.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class PlaylistCommand : IMpcCommand<IEnumerable<IMpdFile>>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => "playlist";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public IEnumerable<IMpdFile> Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
var results = response.Select(line => MpdFile.Create(line.Value, int.Parse(line.Key)));
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="PlaylistIdCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using MpcNET.Types;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Displays song ID in the playlist.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class PlaylistIdCommand : IMpcCommand<IEnumerable<IMpdFile>>
|
|
||||||
{
|
|
||||||
private readonly int songId;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="PlaylistIdCommand"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="songId">The song identifier.</param>
|
|
||||||
public PlaylistIdCommand(int songId)
|
|
||||||
{
|
|
||||||
this.songId = songId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => string.Join(" ", new[] { "playlistid" }, this.songId);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public IEnumerable<IMpdFile> Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return MpdFile.CreateList(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="PlaylistInfoCommand.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
namespace MpcNET.Commands.Playlist
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using MpcNET.Types;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Displays a list of all songs in the playlist.
|
|
||||||
/// https://www.musicpd.org/doc/protocol/queue.html.
|
|
||||||
/// </summary>
|
|
||||||
public class PlaylistInfoCommand : IMpcCommand<IEnumerable<IMpdFile>>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Serializes the command.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// The serialize command.
|
|
||||||
/// </returns>
|
|
||||||
public string Serialize() => "playlistinfo";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserializes the specified response text pairs.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The response.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// The deserialized response.
|
|
||||||
/// </returns>
|
|
||||||
public IEnumerable<IMpdFile> Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
|
|
||||||
{
|
|
||||||
return MpdFile.CreateList(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="IMpcConnectionReporter.cs" company="MpcNET">
|
|
||||||
// Copyright (c) MpcNET. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
// </copyright>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace MpcNET
|
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using Sundew.Base.Reporting;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Interface for implementing an observer for <see cref="MpcConnection"/>.
|
|
||||||
/// </summary>
|
|
||||||
public interface IMpcConnectionReporter : IReporter
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Called when connecting.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isReconnect">if set to <c>true</c> [is reconnect].</param>
|
|
||||||
/// <param name="connectAttempt">The connect attempt.</param>
|
|
||||||
void Connecting(bool isReconnect, int connectAttempt);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when connection is accepted.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isReconnect">if set to <c>true</c> [is reconnect].</param>
|
|
||||||
/// <param name="connectAttempt">The connect attempt.</param>
|
|
||||||
void ConnectionAccepted(bool isReconnect, int connectAttempt);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when connected.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isReconnect">if set to <c>true</c> [is reconnect].</param>
|
|
||||||
/// <param name="connectAttempt">The connect attempt.</param>
|
|
||||||
/// <param name="connectionInfo">The connection information.</param>
|
|
||||||
void Connected(bool isReconnect, int connectAttempt, string connectionInfo);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when sending command.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="command">The command.</param>
|
|
||||||
void Sending(string command);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when send exception occured.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="commandText">The command text.</param>
|
|
||||||
/// <param name="sendAttempt">The send attempt.</param>
|
|
||||||
/// <param name="exception">The exception.</param>
|
|
||||||
void SendException(string commandText, int sendAttempt, Exception exception);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when send is retried.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="command">The command.</param>
|
|
||||||
/// <param name="sendAttempt">The send attempt.</param>
|
|
||||||
void RetrySend(string command, int sendAttempt);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when response is read.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="responseLine">The response line.</param>
|
|
||||||
/// <param name="commandText">The command text.</param>
|
|
||||||
void ReadResponse(string responseLine, string commandText);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when disconnecting.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isExplicitDisconnect">if set to <c>true</c> the disconnect was explicitly called.</param>
|
|
||||||
void Disconnecting(bool isExplicitDisconnect);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when disconnected.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isExplicitDisconnect">if set to <c>true</c> the disconnect was explicitly called.</param>
|
|
||||||
void Disconnected(bool isExplicitDisconnect);
|
|
||||||
}
|
|
||||||
}
|
|
@ -22,7 +22,7 @@
|
|||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<RepositoryUrl>https://github.com/Difegue/MpcNET</RepositoryUrl>
|
<RepositoryUrl>https://github.com/Difegue/MpcNET</RepositoryUrl>
|
||||||
<PackageTags>mpd;client;mpcNET</PackageTags>
|
<PackageTags>mpd;client;mpcNET</PackageTags>
|
||||||
<PackageLicenseFile>D:\Projects\LibMpcNETNuGet\LICENSE</PackageLicenseFile>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@ -55,6 +55,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="..\..\icon.png">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath></PackagePath>
|
||||||
|
</None>
|
||||||
<None Include="..\..\README.md">
|
<None Include="..\..\README.md">
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath></PackagePath>
|
<PackagePath></PackagePath>
|
||||||
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Loading…
Reference in New Issue
Block a user