1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2024-09-16 05:30:09 +00:00

Merge pull request #3 from Difegue/dev

1.2
This commit is contained in:
Difegue 2021-10-09 23:02:55 +02:00 committed by GitHub
commit 0194291779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 2 deletions

View File

@ -31,7 +31,7 @@ jobs:
working-directory: ./Sources
run: |
msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
# Build package and upload to github packages
- name: Build package
working-directory: ./Sources
@ -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

View 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);
}
}
}