This commit is contained in:
ChsBuffer
2021-03-31 19:53:59 +08:00
parent 42b609b597
commit 483dccc5d2
2 changed files with 2 additions and 3 deletions

View File

@@ -1,7 +1,6 @@
using System;
using System.Linq;
using System.Reflection;
using Netch.Utils;
namespace Netch.Models
{
@@ -49,7 +48,7 @@ namespace Netch.Models
case bool b:
return b ? $"{prefix}{key}" : null;
default:
if ((value?.ToString() ?? null).IsNullOrWhiteSpace())
if (string.IsNullOrWhiteSpace(value?.ToString()))
return p.IsDefined(typeof(OptionalAttribute)) ? null : throw new RequiredArgumentValueInvalidException(p.Name, this, null);
if (p.IsDefined(typeof(QuoteAttribute)))

View File

@@ -106,7 +106,7 @@ namespace Netch.Utils
{
var sha256 = SHA256.Create();
using var fileStream = File.OpenRead(filePath);
return sha256.ComputeHash(fileStream).Aggregate(string.Empty, (current, b) => current + b.ToString("x2"));
return string.Concat(sha256.ComputeHash(fileStream).Select(b => b.ToString("x2")));
}
catch
{