Skip to content

Consolidated TargetFrameworks. Fixed build and updated packages. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions IpfsCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Documentation", "doc\Documentation.csproj", "{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
7 changes: 0 additions & 7 deletions doc/Documentation.csproj

This file was deleted.

130 changes: 64 additions & 66 deletions src/CoreApi/IGenericApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@ namespace Ipfs.CoreApi
/// <summary>
/// Some miscellaneous methods.
/// </summary>
/// <seealso href="https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/MISCELLANEOUS.md">Generic API spec</seealso>
/// <seealso href="https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/MISCELLANEOUS.md">Generic API spec</seealso>
public interface IGenericApi
{
/// <summary>
/// Information about an IPFS peer.
/// </summary>
/// <param name="peer">
/// The id of the IPFS peer. If not specified (e.g. null), then the local
/// peer is used.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the <see cref="Peer"/> information.
/// </returns>
Task<Peer> IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken));

/// <summary>
/// Get the version information.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// a <see cref="Dictionary{TKey, TValue}"/> of values.
/// </returns>
/// <summary>
/// Information about an IPFS peer.
/// </summary>
/// <param name="peer">
/// The id of the IPFS peer. If not specified (e.g. null), then the local
/// peer is used.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the <see cref="Peer"/> information.
/// </returns>
Task<Peer> IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken));
/// <summary>
/// Get the version information.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// a <see cref="Dictionary{TKey, TValue}"/> of values.
/// </returns>
Task<Dictionary<string, string>> VersionAsync(CancellationToken cancel = default(CancellationToken));

/// <summary>
/// Stop the IPFS peer.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
Task ShutdownAsync();

/// <summary>
Expand All @@ -55,17 +55,17 @@ public interface IGenericApi
/// <param name="recursive">
/// Resolve until the result is an IPFS name. Defaults to <b>true</b>.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the resolved path as a <see cref="string"/>.
/// </returns>
/// <remarks>
/// The <paramref name="name"/> can be <see cref="Cid"/> + [path], "/ipfs/..." or
/// "/ipns/...".
/// </remarks>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the resolved path as a <see cref="string"/>.
/// </returns>
/// <remarks>
/// The <paramref name="name"/> can be <see cref="Cid"/> + [path], "/ipfs/..." or
/// "/ipns/...".
/// </remarks>
Task<string> ResolveAsync(
string name,
bool recursive = true,
Expand All @@ -81,13 +81,13 @@ Task<string> ResolveAsync(
/// <param name="count">
/// The number of echo requests to send. Defaults to 10.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the sequence of <see cref="PingResult"/>.
/// </returns>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the sequence of <see cref="PingResult"/>.
/// </returns>
Task<IEnumerable<PingResult>> PingAsync(
MultiHash peer,
int count = 10,
Expand All @@ -103,20 +103,19 @@ Task<IEnumerable<PingResult>> PingAsync(
/// <param name="count">
/// The number of echo requests to send. Defaults to 10.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the sequence of <see cref="PingResult"/>.
/// </returns>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the sequence of <see cref="PingResult"/>.
/// </returns>
Task<IEnumerable<PingResult>> PingAsync(
MultiAddress address,
int count = 10,
CancellationToken cancel = default(CancellationToken)
);

#if ASYNCSTREAM
/// <summary>
/// Send echo requests to a peer.
/// </summary>
Expand All @@ -126,12 +125,12 @@ Task<IEnumerable<PingResult>> PingAsync(
/// <param name="count">
/// The number of echo requests to send. Defaults to 10.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// An asynchronous stream of <see cref="PingResult"/>.
/// </returns>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// An asynchronous stream of <see cref="PingResult"/>.
/// </returns>
IAsyncEnumerable<PingResult> Ping(
MultiHash peer,
int count = 10,
Expand All @@ -147,17 +146,16 @@ IAsyncEnumerable<PingResult> Ping(
/// <param name="count">
/// The number of echo requests to send. Defaults to 10.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// An asynchronous stream of <see cref="PingResult"/>.
/// </returns>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// An asynchronous stream of <see cref="PingResult"/>.
/// </returns>
IAsyncEnumerable<PingResult> Ping(
MultiAddress address,
int count = 10,
CancellationToken cancel = default
);
#endif
}
}
46 changes: 6 additions & 40 deletions src/Cryptography/Keccak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@

namespace Ipfs.Cryptography
{
internal abstract class Keccak :
#if PORTABLE
IHashAlgorithm
#else
System.Security.Cryptography.HashAlgorithm
#endif
internal abstract class Keccak : System.Security.Cryptography.HashAlgorithm
{

#region Implementation
Expand All @@ -31,10 +26,6 @@ internal abstract class Keccak :
protected ulong[] state;
protected byte[] buffer;
protected int buffLength;
#if PORTABLE || NETSTANDARD14
protected byte[] HashValue;
protected int HashSizeValue;
#endif
protected int keccakR;

public int KeccakR
Expand Down Expand Up @@ -65,11 +56,7 @@ public int HashByteLength
}
}

public
#if (!PORTABLE && !NETSTANDARD14)
override
#endif
bool CanReuseTransform
public override bool CanReuseTransform
{
get
{
Expand Down Expand Up @@ -141,23 +128,15 @@ protected void AddToBuffer(byte[] array, ref int offset, ref int count)
count -= amount;
}

public
#if !PORTABLE && !NETSTANDARD14
override
#endif
byte[] Hash
public override byte[] Hash
{
get
{
return HashValue;
}
}

public
#if !PORTABLE
override
#endif
int HashSize
public override int HashSize
{
get
{
Expand All @@ -167,22 +146,14 @@ int HashSize

#endregion

public
#if !PORTABLE
override
#endif
void Initialize()
public override void Initialize()
{
buffLength = 0;
state = new ulong[5 * 5];//1600 bits
HashValue = null;
}

protected
#if !PORTABLE
override
#endif
void HashCore(byte[] array, int ibStart, int cbSize)
protected override void HashCore(byte[] array, int ibStart, int cbSize)
{
if (array == null)
throw new ArgumentNullException("array");
Expand All @@ -193,10 +164,5 @@ void HashCore(byte[] array, int ibStart, int cbSize)
if (ibStart + cbSize > array.Length)
throw new ArgumentOutOfRangeException("ibStart or cbSize");
}

#if PORTABLE
public abstract int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset);
public abstract byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount);
#endif
}
}
15 changes: 2 additions & 13 deletions src/Cryptography/KeccakManaged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// This is a copy of https://bitbucket.org/jdluzen/sha3/raw/d1fd55dc225d18a7fb61515b62d3c8f164d2e788/SHA3Managed/SHA3Managed.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ipfs.Cryptography
{
Expand All @@ -15,11 +12,7 @@ public KeccakManaged(int hashBitLength)
{
}

protected
#if !PORTABLE
override
#endif
void HashCore(byte[] array, int ibStart, int cbSize)
protected override void HashCore(byte[] array, int ibStart, int cbSize)
{
base.HashCore(array, ibStart, cbSize);
if (cbSize == 0)
Expand Down Expand Up @@ -50,11 +43,7 @@ void HashCore(byte[] array, int ibStart, int cbSize)
}
}

protected
#if !PORTABLE
override
#endif
byte[] HashFinal()
protected override byte[] HashFinal()
{
int sizeInBytes = SizeInBytes;
byte[] outb = new byte[HashByteLength];
Expand Down
Loading