From 050be311e68bb316cfc40fbd23bfd5a812e1a060 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 14 Jun 2021 20:03:36 -0500 Subject: move stuff around --- src/slskd/Common/Extensions.cs | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'src/slskd/Common/Extensions.cs') diff --git a/src/slskd/Common/Extensions.cs b/src/slskd/Common/Extensions.cs index 32cbf443..a7a89a71 100644 --- a/src/slskd/Common/Extensions.cs +++ b/src/slskd/Common/Extensions.cs @@ -54,17 +54,6 @@ namespace slskd return !type.IsGenericType ? type.Name : type.Name.Split('`')[0] + "<" + string.Join(", ", type.GetGenericArguments().Select(a => a.ToColloquialString())) + ">"; } - /// - /// Returns the SHA1 hash of the given string. - /// - /// The string to hash. - /// The hash. - public static string Sha1(this string str) - { - using var sha1 = new SHA1Managed(); - return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty); - } - /// /// Formats byte to nearest size (KB, MB, etc.) /// @@ -148,25 +137,5 @@ namespace slskd { return path.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar); } - - /// - /// Validates options. - /// - /// The options instance to validate. - /// The result of the validation, if invalid. - /// A value indicating whether the instance is valid. - public static bool TryValidate(this Options options, out CompositeValidationResult result) - { - result = null; - var results = new List(); - - if (!Validator.TryValidateObject(options, new ValidationContext(options), results, true)) - { - result = new CompositeValidationResult("Invalid configuration", results); - return false; - } - - return true; - } } } \ No newline at end of file -- cgit v1.2.3