Skip to content

Commit fad5673

Browse files
committed
feature(changing-framework-version): Changed project framework versions and cleaned code.
1 parent 6b38ef0 commit fad5673

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+139
-343
lines changed

IpfsHttpClient.sln

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26730.16
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32421.90
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6B9AA9C7-5E90-4D10-9DDE-A2AA5FE3ECA6}"
77
ProjectSection(SolutionItems) = preProject
@@ -11,8 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
README.md = README.md
1212
EndProjectSection
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Documentation", "doc\Documentation.csproj", "{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}"
15-
EndProject
1614
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpfsHttpClient", "src\IpfsHttpClient.csproj", "{F3C81C57-C283-4E07-B765-DEABCFB22136}"
1715
EndProject
1816
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpfsHttpClientTests", "test\IpfsHttpClientTests.csproj", "{B459FBC7-4A28-4170-AD83-7348A403407F}"
@@ -23,8 +21,6 @@ Global
2321
Release|Any CPU = Release|Any CPU
2422
EndGlobalSection
2523
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26-
{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}.Release|Any CPU.ActiveCfg = Release|Any CPU
2824
{F3C81C57-C283-4E07-B765-DEABCFB22136}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2925
{F3C81C57-C283-4E07-B765-DEABCFB22136}.Debug|Any CPU.Build.0 = Debug|Any CPU
3026
{F3C81C57-C283-4E07-B765-DEABCFB22136}.Release|Any CPU.ActiveCfg = Release|Any CPU

src/Block.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
1+
using System.IO;
52
using System.Runtime.Serialization;
6-
using System.Text;
7-
using System.Threading.Tasks;
83

94
namespace Ipfs.Http
105
{
@@ -48,7 +43,7 @@ public long Size
4843
size = value;
4944
}
5045
}
51-
46+
5247
}
5348

5449
}

src/CoreApi/BitswapApi.cs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
22
using Newtonsoft.Json.Linq;
3-
using System;
43
using System.Collections.Generic;
54
using System.Linq;
6-
using System.Net.Http;
7-
using System.Text;
85
using System.Threading;
96
using System.Threading.Tasks;
10-
using Ipfs.CoreApi;
11-
using System.IO;
127

138
namespace Ipfs.Http
149
{
15-
1610
class BitswapApi : IBitswapApi
1711
{
1812
IpfsClient ipfs;
@@ -33,7 +27,7 @@ internal BitswapApi(IpfsClient ipfs)
3327
var keys = (JArray)(JObject.Parse(json)["Keys"]);
3428
// https://github.com/ipfs/go-ipfs/issues/5077
3529
return keys
36-
.Select(k =>
30+
.Select(k =>
3731
{
3832
if (k.Type == JTokenType.String)
3933
return Cid.Decode(k.ToString());

src/CoreApi/BlockApi.cs

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
22
using Newtonsoft.Json.Linq;
3-
using System;
43
using System.Collections.Generic;
5-
using System.Linq;
4+
using System.IO;
65
using System.Net.Http;
7-
using System.Text;
86
using System.Threading;
97
using System.Threading.Tasks;
10-
using Ipfs.CoreApi;
11-
using System.IO;
128

139
namespace Ipfs.Http
1410
{
15-
1611
class BlockApi : IBlockApi
1712
{
1813
IpfsClient ipfs;
@@ -41,7 +36,7 @@ public async Task<Cid> PutAsync(
4136
CancellationToken cancel = default(CancellationToken))
4237
{
4338
var options = new List<string>();
44-
if (multiHash != MultiHash.DefaultAlgorithmName ||
39+
if (multiHash != MultiHash.DefaultAlgorithmName ||
4540
contentType != Cid.DefaultContentType ||
4641
encoding != MultiBase.DefaultAlgorithmName)
4742
{

src/CoreApi/BlockRepositoryApi.cs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
22
using Newtonsoft.Json.Linq;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Net.Http;
7-
using System.Text;
83
using System.Threading;
94
using System.Threading.Tasks;
10-
using Ipfs.CoreApi;
11-
using System.IO;
125

136
namespace Ipfs.Http
147
{
15-
168
class BlockRepositoryApi : IBlockRepositoryApi
179
{
1810
IpfsClient ipfs;

src/CoreApi/BootstrapApi.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
22
using Newtonsoft.Json.Linq;
3-
using System;
43
using System.Collections.Generic;
54
using System.Linq;
6-
using System.Net.Http;
7-
using System.Text;
85
using System.Threading;
96
using System.Threading.Tasks;
10-
using Ipfs.CoreApi;
11-
using System.IO;
127

138
namespace Ipfs.Http
149
{
15-
1610
class BootstrapApi : IBootstrapApi
1711
{
1812
IpfsClient ipfs;

src/CoreApi/ConfigApi.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
2+
using Newtonsoft.Json;
23
using Newtonsoft.Json.Linq;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
64
using System.Text;
75
using System.Threading;
86
using System.Threading.Tasks;
9-
using Ipfs.CoreApi;
107

118
namespace Ipfs.Http
129
{
13-
1410
class ConfigApi : IConfigApi
1511
{
1612
IpfsClient ipfs;

src/CoreApi/DagApi.cs

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
using Common.Logging;
1+
using Ipfs.CoreApi;
22
using Newtonsoft.Json;
33
using Newtonsoft.Json.Linq;
4-
using System;
5-
using System.Collections.Generic;
4+
using System.Globalization;
65
using System.IO;
7-
using System.Linq;
86
using System.Text;
97
using System.Threading;
108
using System.Threading.Tasks;
11-
using Ipfs.CoreApi;
12-
using System.Globalization;
139

1410
namespace Ipfs.Http
1511
{
16-
1712
class DagApi : IDagApi
1813
{
19-
IpfsClient ipfs;
14+
private IpfsClient ipfs;
2015

2116
internal DagApi(IpfsClient ipfs)
2217
{
2318
this.ipfs = ipfs;
2419
}
2520

26-
2721
public async Task<Cid> PutAsync(
2822
JObject data,
2923
string contentType = "dag-cbor",
@@ -49,11 +43,11 @@ public async Task<Cid> PutAsync(
4943
}
5044

5145
public async Task<Cid> PutAsync(
52-
object data,
46+
object data,
5347
string contentType = "dag-cbor",
5448
string multiHash = MultiHash.DefaultAlgorithmName,
5549
string encoding = MultiBase.DefaultAlgorithmName,
56-
bool pin = true,
50+
bool pin = true,
5751
CancellationToken cancel = default(CancellationToken))
5852
{
5953
using (var ms = new MemoryStream(
@@ -83,7 +77,7 @@ public async Task<Cid> PutAsync(
8377
}
8478

8579
public async Task<JObject> GetAsync(
86-
Cid id,
80+
Cid id,
8781
CancellationToken cancel = default(CancellationToken))
8882
{
8983
var json = await ipfs.DoCommandAsync("dag/get", cancel, id);
@@ -92,7 +86,7 @@ public async Task<JObject> GetAsync(
9286

9387

9488
public async Task<JToken> GetAsync(
95-
string path,
89+
string path,
9690
CancellationToken cancel = default(CancellationToken))
9791
{
9892
var json = await ipfs.DoCommandAsync("dag/get", cancel, path);

src/CoreApi/DhtApi.cs

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
using Common.Logging;
2-
using Newtonsoft.Json;
2+
using Ipfs.CoreApi;
33
using Newtonsoft.Json.Linq;
44
using System;
55
using System.Collections.Generic;
66
using System.IO;
7-
using System.Linq;
8-
using System.Text;
97
using System.Threading;
108
using System.Threading.Tasks;
11-
using Ipfs.CoreApi;
129

1310
namespace Ipfs.Http
1411
{
15-
1612
class DhtApi : IDhtApi
1713
{
18-
static ILog log = LogManager.GetLogger<DhtApi>();
19-
20-
IpfsClient ipfs;
14+
private static ILog log = LogManager.GetLogger<DhtApi>();
15+
private IpfsClient ipfs;
2116

2217
internal DhtApi(IpfsClient ipfs)
2318
{
@@ -57,7 +52,7 @@ internal DhtApi(IpfsClient ipfs)
5752
}
5853

5954
IEnumerable<Peer> ProviderFromStream(Stream stream, int limit = int.MaxValue)
60-
{
55+
{
6156
using (var sr = new StreamReader(stream))
6257
{
6358
var n = 0;
@@ -91,8 +86,8 @@ IEnumerable<Peer> ProviderFromStream(Stream stream, int limit = int.MaxValue)
9186
}
9287
}
9388
}
94-
}
95-
}
89+
}
90+
}
9691
}
9792

9893
}

src/CoreApi/DnsApi.cs

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
22
using Newtonsoft.Json.Linq;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Net.Http;
7-
using System.Text;
83
using System.Threading;
94
using System.Threading.Tasks;
10-
using Ipfs.CoreApi;
11-
using System.IO;
125

136
namespace Ipfs.Http
147
{
15-
168
class DnsApi : IDnsApi
179
{
18-
IpfsClient ipfs;
10+
private IpfsClient ipfs;
1911

2012
internal DnsApi(IpfsClient ipfs)
2113
{

src/CoreApi/FileSystemApi.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Common.Logging;
2+
using Ipfs.CoreApi;
23
using Newtonsoft.Json;
34
using Newtonsoft.Json.Linq;
45
using System;
@@ -8,17 +9,14 @@
89
using System.Text;
910
using System.Threading;
1011
using System.Threading.Tasks;
11-
using Ipfs.CoreApi;
1212

1313
namespace Ipfs.Http
1414
{
15-
1615
class FileSystemApi : IFileSystemApi
1716
{
18-
static ILog log = LogManager.GetLogger<FileSystemApi>();
19-
20-
IpfsClient ipfs;
21-
Lazy<DagNode> emptyFolder;
17+
private static ILog log = LogManager.GetLogger<FileSystemApi>();
18+
private IpfsClient ipfs;
19+
private Lazy<DagNode> emptyFolder;
2220

2321
internal FileSystemApi(IpfsClient ipfs)
2422
{
@@ -209,7 +207,7 @@ internal FileSystemApi(IpfsClient ipfs)
209207

210208
if (length == 0)
211209
length = int.MaxValue; // go-ipfs only accepts int lengths
212-
return ipfs.DownloadAsync("cat", cancel, path,
210+
return ipfs.DownloadAsync("cat", cancel, path,
213211
$"offset={offset}",
214212
$"length={length}");
215213
}

src/CoreApi/GenericApi.cs

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
2+
using Newtonsoft.Json.Linq;
23
using System;
34
using System.Collections.Generic;
45
using System.Globalization;
5-
using System.Linq;
6-
using System.Text;
76
using System.IO;
8-
using System.Net;
9-
using System.Threading.Tasks;
107
using System.Threading;
11-
using Ipfs.CoreApi;
12-
using Newtonsoft.Json.Linq;
8+
using System.Threading.Tasks;
139

1410
namespace Ipfs.Http
1511
{
1612
public partial class IpfsClient : IGenericApi
1713
{
18-
const double TicksPerNanosecond = (double)TimeSpan.TicksPerMillisecond * 0.000001;
14+
private const double TicksPerNanosecond = (double)TimeSpan.TicksPerMillisecond * 0.000001;
1915

2016
/// <inheritdoc />
2117
public Task<Peer> IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken))

src/CoreApi/KeyApi.cs

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
using Common.Logging;
2-
using Newtonsoft.Json;
1+
using Ipfs.CoreApi;
32
using Newtonsoft.Json.Linq;
43
using System;
54
using System.Collections.Generic;
6-
using System.IO;
75
using System.Linq;
8-
using System.Text;
96
using System.Threading;
107
using System.Threading.Tasks;
11-
using Ipfs.CoreApi;
128

139
namespace Ipfs.Http
1410
{
15-
class KeyApi : IKeyApi
11+
class KeyApi : IKeyApi
1612
{
1713
/// <summary>
1814
/// Information about a local key.
@@ -41,9 +37,9 @@ internal KeyApi(IpfsClient ipfs)
4137

4238
public async Task<IKey> CreateAsync(string name, string keyType, int size, CancellationToken cancel = default(CancellationToken))
4339
{
44-
return await ipfs.DoCommandAsync<KeyInfo>("key/gen", cancel,
45-
name,
46-
$"type={keyType}",
40+
return await ipfs.DoCommandAsync<KeyInfo>("key/gen", cancel,
41+
name,
42+
$"type={keyType}",
4743
$"size={size}");
4844
}
4945

0 commit comments

Comments
 (0)