forked from branstraub/gzip-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
executable file
·67 lines (58 loc) · 2.19 KB
/
Program.cs
File metadata and controls
executable file
·67 lines (58 loc) · 2.19 KB
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
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
namespace gzip
{
class Program
{
static async Task Main(string[] args)
{
var options = new Options();
// From where am I going to retrieve the paths
options.ConnectionStringSource = args[0];
// Where am I going to enqueue the paths
options.ConnectionStringDestination = args[1];
string containerSourceName = (args.Length > 2) ? args[2] : null;
var storageAccountS = CloudStorageAccount.Parse(options.ConnectionStringSource);
var storageAccountDestination = CloudStorageAccount.Parse(options.ConnectionStringDestination);
var blobClientS = storageAccountS.CreateCloudBlobClient();
var stopWatch = new Stopwatch();
stopWatch.Start();
var util = new Utility(
//new GzipBlober(storageAccountDestination)
new GzipEnqueuer(storageAccountDestination)
);
if (string.IsNullOrEmpty(containerSourceName))
{
Console.WriteLine("All containers");
foreach (var container in blobClientS.ListContainers())
{
var blobContainerS = blobClientS.GetContainerReference(container.Name);
Console.WriteLine($"Starting container {container.Name}");
await util.EnsureGzipFiles(blobContainerS);
Console.WriteLine($"Finished container {container.Name}");
}
}
else
{
Console.WriteLine("Specific container");
var container = blobClientS.GetContainerReference(containerSourceName);
Console.WriteLine($"Starting container {container.Name}");
await util.EnsureGzipFiles(container);
Console.WriteLine($"Finished container {container.Name}");
}
stopWatch.Stop();
// Get the elapsed time as a TimeSpan value.
var ts = stopWatch.Elapsed;
// Format and display the TimeSpan value.
Console.WriteLine("RunTime " + ts);
}
}
}