mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-01-14 22:18:43 +00:00
commit
0194291779
2
.github/workflows/build-and-test.yml
vendored
2
.github/workflows/build-and-test.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
||||
dotnet nuget add source --username Difegue --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Difegue/index.json"
|
||||
dotnet build $env:Solution_Name --configuration $env:Configuration
|
||||
dotnet pack --configuration $env:Configuration -o ./
|
||||
dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
|
||||
dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate
|
||||
|
||||
# Execute all unit tests in the solution
|
||||
#- name: Execute unit tests
|
||||
|
64
Sources/MpcNET/Commands/Playback/ConsumeCommand.cs
Normal file
64
Sources/MpcNET/Commands/Playback/ConsumeCommand.cs
Normal file
@ -0,0 +1,64 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="ConsumeCommand.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.Playback
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Command to set consume state.
|
||||
/// Sets consume state to STATE, STATE should be 0 or 1. When consume is activated, each song played is removed from playlist.
|
||||
/// https://mpd.readthedocs.io/en/stable/protocol.html#playback-options
|
||||
/// </summary>
|
||||
public class ConsumeCommand : IMpcCommand<string>
|
||||
{
|
||||
private readonly string single;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ConsumeCommand" /> class.
|
||||
/// </summary>
|
||||
/// <param name="single">if set to <c>true</c> [consume].</param>
|
||||
public ConsumeCommand(bool single)
|
||||
{
|
||||
this.single = single ? "1" : "0";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ConsumeCommand"/> class.
|
||||
/// </summary>
|
||||
public ConsumeCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the command.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The serialize command.
|
||||
/// </returns>
|
||||
public string Serialize()
|
||||
{
|
||||
if (this.single == null)
|
||||
{
|
||||
return string.Join(" ", "consume");
|
||||
}
|
||||
|
||||
return string.Join(" ", "consume", this.single);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the specified response text pairs.
|
||||
/// </summary>
|
||||
/// <param name="response">The response.</param>
|
||||
/// <returns>
|
||||
/// The deserialized response.
|
||||
/// </returns>
|
||||
public string Deserialize(SerializedResponse response)
|
||||
{
|
||||
return string.Join(", ", response.ResponseValues);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user