Skip to content

Commit

Permalink
docs: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
phnx47 committed Nov 15, 2023
1 parent 9364000 commit 1a0b055
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/FingerprintBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ private FingerprintBuilder(Func<byte[], byte[]> computeHash)
_computeHash = computeHash ?? throw new ArgumentNullException(nameof(computeHash));
}

/// <summary>
/// Create FingerprintBuilder from HashAlgorithm
/// </summary>
public static IFingerprintBuilder<T> Create(HashAlgorithm hashAlgorithm) => Create(hashAlgorithm.ComputeHash);

/// <summary>
/// Create FingerprintBuilder from Func
/// </summary>
public static IFingerprintBuilder<T> Create(Func<byte[], byte[]> computeHash) => new FingerprintBuilder<T>(computeHash);

public IFingerprintBuilder<T> For<TProperty>(Expression<Func<T, TProperty>> expression) => For(expression, f => f);
Expand Down
1 change: 0 additions & 1 deletion src/FingerprintBuilder.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<Description>Compute hash for specified .NET object</Description>
<Copyright>2019 © Serge K</Copyright>
<Authors>Serge K</Authors>
Expand Down
3 changes: 0 additions & 3 deletions src/FingerprintBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public static string ToUpperHexString(this byte[] source)
return source.ToString("X2");
}

/// <summary>
/// Convert to string
/// </summary>
private static string ToString(this byte[] source, string format)
{
if (source == null)
Expand Down
12 changes: 12 additions & 0 deletions src/IFingerprintBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ namespace FingerprintBuilder;

public interface IFingerprintBuilder<T>
{
/// <summary>
/// Add Expression
/// </summary>
IFingerprintBuilder<T> For<TProperty>(Expression<Func<T, TProperty>> expression);

/// <summary>
/// Add Expression
/// </summary>
IFingerprintBuilder<T> For(Expression<Func<T, string>> expression, bool toLower, bool trim);

/// <summary>
/// Add Expression
/// </summary>
IFingerprintBuilder<T> For<TProperty>(Expression<Func<T, TProperty>> expression, Expression<Func<TProperty, string>> fingerprint);

/// <summary>
/// Build Func
/// </summary>
Func<T, byte[]> Build();
}
1 change: 0 additions & 1 deletion tests/units/FingerprintBuilder.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<TargetFramework Condition="'$(OS)' == 'Unix'">net6.0</TargetFramework>
<TargetFrameworks Condition="'$(OS)' != 'Unix'">net462;net6.0</TargetFrameworks>
<CollectCoverage>true</CollectCoverage>
Expand Down

0 comments on commit 1a0b055

Please sign in to comment.