Skip to content

Commit 37f106c

Browse files
authored
Merge pull request #2 from ipfs-shipyard/refactor/netstandard2.0
Consolidated TargetFrameworks. Fixed build and updated packages.
2 parents 1563475 + 689bf6a commit 37f106c

File tree

7 files changed

+83
-156
lines changed

7 files changed

+83
-156
lines changed

IpfsCore.sln

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1919
TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
2020
EndProjectSection
2121
EndProject
22-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Documentation", "doc\Documentation.csproj", "{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}"
23-
EndProject
2422
Global
2523
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2624
Debug|Any CPU = Debug|Any CPU

doc/Documentation.csproj

-7
This file was deleted.

src/CoreApi/IGenericApi.cs

+64-66
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,40 @@ namespace Ipfs.CoreApi
1010
/// <summary>
1111
/// Some miscellaneous methods.
1212
/// </summary>
13-
/// <seealso href="https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/MISCELLANEOUS.md">Generic API spec</seealso>
13+
/// <seealso href="https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/MISCELLANEOUS.md">Generic API spec</seealso>
1414
public interface IGenericApi
1515
{
16-
/// <summary>
17-
/// Information about an IPFS peer.
18-
/// </summary>
19-
/// <param name="peer">
20-
/// The id of the IPFS peer. If not specified (e.g. null), then the local
21-
/// peer is used.
22-
/// </param>
23-
/// <param name="cancel">
24-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
25-
/// </param>
26-
/// <returns>
27-
/// A task that represents the asynchronous operation. The task's value is
28-
/// the <see cref="Peer"/> information.
29-
/// </returns>
30-
Task<Peer> IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken));
31-
32-
/// <summary>
33-
/// Get the version information.
34-
/// </summary>
35-
/// <returns>
36-
/// A task that represents the asynchronous operation. The task's value is
37-
/// a <see cref="Dictionary{TKey, TValue}"/> of values.
38-
/// </returns>
16+
/// <summary>
17+
/// Information about an IPFS peer.
18+
/// </summary>
19+
/// <param name="peer">
20+
/// The id of the IPFS peer. If not specified (e.g. null), then the local
21+
/// peer is used.
22+
/// </param>
23+
/// <param name="cancel">
24+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
25+
/// </param>
26+
/// <returns>
27+
/// A task that represents the asynchronous operation. The task's value is
28+
/// the <see cref="Peer"/> information.
29+
/// </returns>
30+
Task<Peer> IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken));
31+
32+
/// <summary>
33+
/// Get the version information.
34+
/// </summary>
35+
/// <returns>
36+
/// A task that represents the asynchronous operation. The task's value is
37+
/// a <see cref="Dictionary{TKey, TValue}"/> of values.
38+
/// </returns>
3939
Task<Dictionary<string, string>> VersionAsync(CancellationToken cancel = default(CancellationToken));
4040

4141
/// <summary>
4242
/// Stop the IPFS peer.
4343
/// </summary>
44-
/// <returns>
45-
/// A task that represents the asynchronous operation.
46-
/// </returns>
44+
/// <returns>
45+
/// A task that represents the asynchronous operation.
46+
/// </returns>
4747
Task ShutdownAsync();
4848

4949
/// <summary>
@@ -55,17 +55,17 @@ public interface IGenericApi
5555
/// <param name="recursive">
5656
/// Resolve until the result is an IPFS name. Defaults to <b>true</b>.
5757
/// </param>
58-
/// <param name="cancel">
59-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
60-
/// </param>
61-
/// <returns>
62-
/// A task that represents the asynchronous operation. The task's value is
63-
/// the resolved path as a <see cref="string"/>.
64-
/// </returns>
65-
/// <remarks>
66-
/// The <paramref name="name"/> can be <see cref="Cid"/> + [path], "/ipfs/..." or
67-
/// "/ipns/...".
68-
/// </remarks>
58+
/// <param name="cancel">
59+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
60+
/// </param>
61+
/// <returns>
62+
/// A task that represents the asynchronous operation. The task's value is
63+
/// the resolved path as a <see cref="string"/>.
64+
/// </returns>
65+
/// <remarks>
66+
/// The <paramref name="name"/> can be <see cref="Cid"/> + [path], "/ipfs/..." or
67+
/// "/ipns/...".
68+
/// </remarks>
6969
Task<string> ResolveAsync(
7070
string name,
7171
bool recursive = true,
@@ -81,13 +81,13 @@ Task<string> ResolveAsync(
8181
/// <param name="count">
8282
/// The number of echo requests to send. Defaults to 10.
8383
/// </param>
84-
/// <param name="cancel">
85-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
86-
/// </param>
87-
/// <returns>
88-
/// A task that represents the asynchronous operation. The task's value is
89-
/// the sequence of <see cref="PingResult"/>.
90-
/// </returns>
84+
/// <param name="cancel">
85+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
86+
/// </param>
87+
/// <returns>
88+
/// A task that represents the asynchronous operation. The task's value is
89+
/// the sequence of <see cref="PingResult"/>.
90+
/// </returns>
9191
Task<IEnumerable<PingResult>> PingAsync(
9292
MultiHash peer,
9393
int count = 10,
@@ -103,20 +103,19 @@ Task<IEnumerable<PingResult>> PingAsync(
103103
/// <param name="count">
104104
/// The number of echo requests to send. Defaults to 10.
105105
/// </param>
106-
/// <param name="cancel">
107-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
108-
/// </param>
109-
/// <returns>
110-
/// A task that represents the asynchronous operation. The task's value is
111-
/// the sequence of <see cref="PingResult"/>.
112-
/// </returns>
106+
/// <param name="cancel">
107+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
108+
/// </param>
109+
/// <returns>
110+
/// A task that represents the asynchronous operation. The task's value is
111+
/// the sequence of <see cref="PingResult"/>.
112+
/// </returns>
113113
Task<IEnumerable<PingResult>> PingAsync(
114114
MultiAddress address,
115115
int count = 10,
116116
CancellationToken cancel = default(CancellationToken)
117117
);
118118

119-
#if ASYNCSTREAM
120119
/// <summary>
121120
/// Send echo requests to a peer.
122121
/// </summary>
@@ -126,12 +125,12 @@ Task<IEnumerable<PingResult>> PingAsync(
126125
/// <param name="count">
127126
/// The number of echo requests to send. Defaults to 10.
128127
/// </param>
129-
/// <param name="cancel">
130-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
131-
/// </param>
132-
/// <returns>
133-
/// An asynchronous stream of <see cref="PingResult"/>.
134-
/// </returns>
128+
/// <param name="cancel">
129+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
130+
/// </param>
131+
/// <returns>
132+
/// An asynchronous stream of <see cref="PingResult"/>.
133+
/// </returns>
135134
IAsyncEnumerable<PingResult> Ping(
136135
MultiHash peer,
137136
int count = 10,
@@ -147,17 +146,16 @@ IAsyncEnumerable<PingResult> Ping(
147146
/// <param name="count">
148147
/// The number of echo requests to send. Defaults to 10.
149148
/// </param>
150-
/// <param name="cancel">
151-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
152-
/// </param>
153-
/// <returns>
154-
/// An asynchronous stream of <see cref="PingResult"/>.
155-
/// </returns>
149+
/// <param name="cancel">
150+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
151+
/// </param>
152+
/// <returns>
153+
/// An asynchronous stream of <see cref="PingResult"/>.
154+
/// </returns>
156155
IAsyncEnumerable<PingResult> Ping(
157156
MultiAddress address,
158157
int count = 10,
159158
CancellationToken cancel = default
160159
);
161-
#endif
162160
}
163161
}

src/Cryptography/Keccak.cs

+6-40
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@
1313

1414
namespace Ipfs.Cryptography
1515
{
16-
internal abstract class Keccak :
17-
#if PORTABLE
18-
IHashAlgorithm
19-
#else
20-
System.Security.Cryptography.HashAlgorithm
21-
#endif
16+
internal abstract class Keccak : System.Security.Cryptography.HashAlgorithm
2217
{
2318

2419
#region Implementation
@@ -31,10 +26,6 @@ internal abstract class Keccak :
3126
protected ulong[] state;
3227
protected byte[] buffer;
3328
protected int buffLength;
34-
#if PORTABLE || NETSTANDARD14
35-
protected byte[] HashValue;
36-
protected int HashSizeValue;
37-
#endif
3829
protected int keccakR;
3930

4031
public int KeccakR
@@ -65,11 +56,7 @@ public int HashByteLength
6556
}
6657
}
6758

68-
public
69-
#if (!PORTABLE && !NETSTANDARD14)
70-
override
71-
#endif
72-
bool CanReuseTransform
59+
public override bool CanReuseTransform
7360
{
7461
get
7562
{
@@ -141,23 +128,15 @@ protected void AddToBuffer(byte[] array, ref int offset, ref int count)
141128
count -= amount;
142129
}
143130

144-
public
145-
#if !PORTABLE && !NETSTANDARD14
146-
override
147-
#endif
148-
byte[] Hash
131+
public override byte[] Hash
149132
{
150133
get
151134
{
152135
return HashValue;
153136
}
154137
}
155138

156-
public
157-
#if !PORTABLE
158-
override
159-
#endif
160-
int HashSize
139+
public override int HashSize
161140
{
162141
get
163142
{
@@ -167,22 +146,14 @@ int HashSize
167146

168147
#endregion
169148

170-
public
171-
#if !PORTABLE
172-
override
173-
#endif
174-
void Initialize()
149+
public override void Initialize()
175150
{
176151
buffLength = 0;
177152
state = new ulong[5 * 5];//1600 bits
178153
HashValue = null;
179154
}
180155

181-
protected
182-
#if !PORTABLE
183-
override
184-
#endif
185-
void HashCore(byte[] array, int ibStart, int cbSize)
156+
protected override void HashCore(byte[] array, int ibStart, int cbSize)
186157
{
187158
if (array == null)
188159
throw new ArgumentNullException("array");
@@ -193,10 +164,5 @@ void HashCore(byte[] array, int ibStart, int cbSize)
193164
if (ibStart + cbSize > array.Length)
194165
throw new ArgumentOutOfRangeException("ibStart or cbSize");
195166
}
196-
197-
#if PORTABLE
198-
public abstract int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset);
199-
public abstract byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount);
200-
#endif
201167
}
202168
}

src/Cryptography/KeccakManaged.cs

+2-13
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// This is a copy of https://bitbucket.org/jdluzen/sha3/raw/d1fd55dc225d18a7fb61515b62d3c8f164d2e788/SHA3Managed/SHA3Managed.cs
33

44
using System;
5-
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Text;
85

96
namespace Ipfs.Cryptography
107
{
@@ -15,11 +12,7 @@ public KeccakManaged(int hashBitLength)
1512
{
1613
}
1714

18-
protected
19-
#if !PORTABLE
20-
override
21-
#endif
22-
void HashCore(byte[] array, int ibStart, int cbSize)
15+
protected override void HashCore(byte[] array, int ibStart, int cbSize)
2316
{
2417
base.HashCore(array, ibStart, cbSize);
2518
if (cbSize == 0)
@@ -50,11 +43,7 @@ void HashCore(byte[] array, int ibStart, int cbSize)
5043
}
5144
}
5245

53-
protected
54-
#if !PORTABLE
55-
override
56-
#endif
57-
byte[] HashFinal()
46+
protected override byte[] HashFinal()
5847
{
5948
int sizeInBytes = SizeInBytes;
6049
byte[] outb = new byte[HashByteLength];

0 commit comments

Comments
 (0)