From e4cc82d72c89285e1a0fd85398d381fdb6736410 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Thu, 23 Jun 2022 00:32:17 -0500 Subject: [PATCH 1/2] Consolidated TargetFrameworks. Fixed build and updated packages. --- IpfsCore.sln | 2 - src/CoreApi/IGenericApi.cs | 130 +++++++++++++++--------------- src/Cryptography/Keccak.cs | 46 ++--------- src/Cryptography/KeccakManaged.cs | 15 +--- src/IpfsCore.csproj | 27 +++---- test/IpfsCoreTests.csproj | 12 +-- 6 files changed, 83 insertions(+), 149 deletions(-) diff --git a/IpfsCore.sln b/IpfsCore.sln index cebfd03d..1f5ab75e 100644 --- a/IpfsCore.sln +++ b/IpfsCore.sln @@ -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 diff --git a/src/CoreApi/IGenericApi.cs b/src/CoreApi/IGenericApi.cs index d8908917..676c2076 100644 --- a/src/CoreApi/IGenericApi.cs +++ b/src/CoreApi/IGenericApi.cs @@ -10,40 +10,40 @@ namespace Ipfs.CoreApi /// /// Some miscellaneous methods. /// - /// Generic API spec + /// Generic API spec public interface IGenericApi { - /// - /// Information about an IPFS peer. - /// - /// - /// The id of the IPFS peer. If not specified (e.g. null), then the local - /// peer is used. - /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// A task that represents the asynchronous operation. The task's value is - /// the information. - /// - Task IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken)); - - /// - /// Get the version information. - /// - /// - /// A task that represents the asynchronous operation. The task's value is - /// a of values. - /// + /// + /// Information about an IPFS peer. + /// + /// + /// The id of the IPFS peer. If not specified (e.g. null), then the local + /// peer is used. + /// + /// + /// Is used to stop the task. When cancelled, the is raised. + /// + /// + /// A task that represents the asynchronous operation. The task's value is + /// the information. + /// + Task IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken)); + + /// + /// Get the version information. + /// + /// + /// A task that represents the asynchronous operation. The task's value is + /// a of values. + /// Task> VersionAsync(CancellationToken cancel = default(CancellationToken)); /// /// Stop the IPFS peer. /// - /// - /// A task that represents the asynchronous operation. - /// + /// + /// A task that represents the asynchronous operation. + /// Task ShutdownAsync(); /// @@ -55,17 +55,17 @@ public interface IGenericApi /// /// Resolve until the result is an IPFS name. Defaults to true. /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// A task that represents the asynchronous operation. The task's value is - /// the resolved path as a . - /// - /// - /// The can be + [path], "/ipfs/..." or - /// "/ipns/...". - /// + /// + /// Is used to stop the task. When cancelled, the is raised. + /// + /// + /// A task that represents the asynchronous operation. The task's value is + /// the resolved path as a . + /// + /// + /// The can be + [path], "/ipfs/..." or + /// "/ipns/...". + /// Task ResolveAsync( string name, bool recursive = true, @@ -81,13 +81,13 @@ Task ResolveAsync( /// /// The number of echo requests to send. Defaults to 10. /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// A task that represents the asynchronous operation. The task's value is - /// the sequence of . - /// + /// + /// Is used to stop the task. When cancelled, the is raised. + /// + /// + /// A task that represents the asynchronous operation. The task's value is + /// the sequence of . + /// Task> PingAsync( MultiHash peer, int count = 10, @@ -103,20 +103,19 @@ Task> PingAsync( /// /// The number of echo requests to send. Defaults to 10. /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// A task that represents the asynchronous operation. The task's value is - /// the sequence of . - /// + /// + /// Is used to stop the task. When cancelled, the is raised. + /// + /// + /// A task that represents the asynchronous operation. The task's value is + /// the sequence of . + /// Task> PingAsync( MultiAddress address, int count = 10, CancellationToken cancel = default(CancellationToken) ); -#if ASYNCSTREAM /// /// Send echo requests to a peer. /// @@ -126,12 +125,12 @@ Task> PingAsync( /// /// The number of echo requests to send. Defaults to 10. /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// An asynchronous stream of . - /// + /// + /// Is used to stop the task. When cancelled, the is raised. + /// + /// + /// An asynchronous stream of . + /// IAsyncEnumerable Ping( MultiHash peer, int count = 10, @@ -147,17 +146,16 @@ IAsyncEnumerable Ping( /// /// The number of echo requests to send. Defaults to 10. /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// An asynchronous stream of . - /// + /// + /// Is used to stop the task. When cancelled, the is raised. + /// + /// + /// An asynchronous stream of . + /// IAsyncEnumerable Ping( MultiAddress address, int count = 10, CancellationToken cancel = default ); -#endif } } diff --git a/src/Cryptography/Keccak.cs b/src/Cryptography/Keccak.cs index b6bd7413..7a24bbd3 100644 --- a/src/Cryptography/Keccak.cs +++ b/src/Cryptography/Keccak.cs @@ -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 @@ -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 @@ -65,11 +56,7 @@ public int HashByteLength } } - public -#if (!PORTABLE && !NETSTANDARD14) - override -#endif - bool CanReuseTransform + public override bool CanReuseTransform { get { @@ -141,11 +128,7 @@ 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 { @@ -153,11 +136,7 @@ byte[] Hash } } - public -#if !PORTABLE - override -#endif - int HashSize + public override int HashSize { get { @@ -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"); @@ -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 } } \ No newline at end of file diff --git a/src/Cryptography/KeccakManaged.cs b/src/Cryptography/KeccakManaged.cs index 9ea83874..378740bc 100644 --- a/src/Cryptography/KeccakManaged.cs +++ b/src/Cryptography/KeccakManaged.cs @@ -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 { @@ -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) @@ -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]; diff --git a/src/IpfsCore.csproj b/src/IpfsCore.csproj index ea422360..358e2a5e 100644 --- a/src/IpfsCore.csproj +++ b/src/IpfsCore.csproj @@ -1,9 +1,10 @@  - netstandard14;netstandard2;net45;netcoreapp3.0 + netstandard2; Ipfs.Core Ipfs + 10.0 portable true @@ -21,12 +22,10 @@ The InterPlanetary File System is the permanent web. It is a new hypermedia distribution protocol, addressed by content and identities. IPFS enables the creation of completely distributed applications. It aims to make the web faster, safer, and more open. false - https://github.com/richardschneider/net-ipfs-core/releases - © 2015-2019 Richard Schneider ipfs peer-to-peer distributed file-system True - https://github.com/richardschneider/net-ipfs-core - https://raw.githubusercontent.com/richardschneider/net-ipfs-core/master/doc/images/ipfs-cs-logo-64x64.png + https://github.com/ipfs-shipyard/net-ipfs-core + https://raw.githubusercontent.com/ipfs-shipyard/net-ipfs-core/master/doc/images/ipfs-cs-logo-64x64.png true true @@ -46,13 +45,13 @@ - - + + + - - - + + @@ -60,12 +59,4 @@ - - NETSTANDARD14 - - - - ASYNCSTREAM - - diff --git a/test/IpfsCoreTests.csproj b/test/IpfsCoreTests.csproj index b309203f..e57ab4c3 100644 --- a/test/IpfsCoreTests.csproj +++ b/test/IpfsCoreTests.csproj @@ -1,26 +1,18 @@  - net45;netcoreapp1.1;netcoreapp2.1;netcoreapp3.0 + net6.0 + 10.0 false portable Ipfs - - - - false - opencover - - - - From 689bf6a3c101f6eb23c68e6073034774de65c64c Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Thu, 23 Jun 2022 00:35:58 -0500 Subject: [PATCH 2/2] Remove Documentation.csproj --- doc/Documentation.csproj | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 doc/Documentation.csproj diff --git a/doc/Documentation.csproj b/doc/Documentation.csproj deleted file mode 100644 index 20a3e3d3..00000000 --- a/doc/Documentation.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - netstandard2 - - - \ No newline at end of file