1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2025-07-01 00:37:37 +00:00
Files
MpcNET/Sources/MpcNET/Commands/Database/UpdateCommand.cs
2018-03-02 12:14:26 +01:00

46 lines
1.3 KiB
C#

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UpdateCommand.cs" company="Hukano">
// Copyright (c) Hukano. 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;
internal class UpdateCommand : IMpcCommand<string>
{
private readonly string uri;
public UpdateCommand(string uri)
{
this.uri = uri;
}
public string Serialize()
{
if (string.IsNullOrEmpty(this.uri))
{
return "update";
}
var newUri = this.uri;
if (this.uri.StartsWith(@""""))
{
newUri = @"""" + this.uri;
}
if (this.uri.EndsWith(@""""))
{
newUri = this.uri + @"""";
}
return string.Join(" ", "update", newUri);
}
public string Deserialize(IReadOnlyList<KeyValuePair<string, string>> response)
{
return string.Join(", ", response);
}
}
}