aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Common
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-11-09 21:37:20 -0600
committerGitHub <noreply@github.com>2021-11-09 21:37:20 -0600
commit7fe7771af831bb6d46629869dc2490d8f14b7cf9 (patch)
tree4499b75e43e9a3395a7d02ea75d959a40447ff46 /src/slskd/Common
parent746f40934d56637a1af529285a4054720f22f4a8 (diff)
parent86f5e46c2dfe595d8a970cc2f9e49d2520f14b55 (diff)
downloadslskd-7fe7771af831bb6d46629869dc2490d8f14b7cf9.tar.gz
Merge pull request #245 from slskd/config
Move the default configuration location to the App directory, create a Docker volume for /app
Diffstat (limited to 'src/slskd/Common')
-rw-r--r--src/slskd/Common/Extensions.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/slskd/Common/Extensions.cs b/src/slskd/Common/Extensions.cs
index 30b35d14..03bec7fe 100644
--- a/src/slskd/Common/Extensions.cs
+++ b/src/slskd/Common/Extensions.cs
@@ -25,6 +25,8 @@ namespace slskd
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
+ using YamlDotNet.Serialization;
+ using YamlDotNet.Serialization.NamingConventions;
/// <summary>
/// Extensions.
@@ -214,6 +216,16 @@ namespace slskd
public static string ToJson(this object obj) => JsonSerializer.Serialize(obj, GetJsonSerializerOptions());
/// <summary>
+ /// Serializes this object to yaml.
+ /// </summary>
+ /// <param name="obj">The object to serialize.</param>
+ /// <returns>A string containing the serialized object.</returns>
+ public static string ToYaml(this object obj) => new SerializerBuilder()
+ .WithNamingConvention(UnderscoredNamingConvention.Instance)
+ .Build()
+ .Serialize(obj);
+
+ /// <summary>
/// Converts a fully qualified remote filename to a local filename based in the provided
/// <paramref name="baseDirectory"/>, swapping directory characters for those specific to the local OS, removing any
/// characters that are invalid for the local OS, and making the path relative to the remote store (including the