-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathProgram.cs
60 lines (48 loc) · 1.77 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
namespace FastDFSCore.Sample
{
class Program
{
private static ISampleAppService _sampleAppService;
static void Main(string[] args)
{
IServiceCollection services = new ServiceCollection();
services.AddLogging(l =>
{
l.SetMinimumLevel(LogLevel.Trace);
l.AddConsole();
});
services
.AddFastDFSCore()
//.AddFastDFSDotNetty()
.AddFastDFSSuperSocket()
.AddSingleton<ISampleAppService, SampleAppService>();
var provider = services.BuildServiceProvider();
var option = provider.GetRequiredService<IOptions<FastDFSOptions>>().Value;
option.ClusterConfigurations.Add(new ClusterConfiguration()
{
Name = "Cluster1",
Trackers = new List<Tracker>()
{
new Tracker("192.168.0.98", 22122)
},
AntiStealToken = true,
SecretKey = "123456"
});
_sampleAppService = provider.GetService<ISampleAppService>();
RunAsync();
Console.ReadLine();
}
public static async void RunAsync()
{
var groupName = "group1";
//_sampleAppService.GetToken("/00/01/123456.txt");
var uploadFileIds = await _sampleAppService.BatchUploadAsync(groupName, @"D:\DicomTests");
var downloadFiles = await _sampleAppService.BatchDownloadAsync(groupName, uploadFileIds, @"G:\Download");
}
}
}