-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathProgram.cs
More file actions
73 lines (60 loc) · 2.21 KB
/
Program.cs
File metadata and controls
73 lines (60 loc) · 2.21 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
68
69
70
71
72
73
using System;
using System.IO;
using System.Text;
using System.CommandLine;
using System.CommandLine.DragonFruit;
namespace DICOMcloudUploader
{
class Program
{
static void Main(string dir = null, string url = null)
{
string uploadFolder = "";
url ??= "http://localhost:44301/stowrs/";
if (string.IsNullOrWhiteSpace(dir))
{
Console.WriteLine("Enter path for DICOM directory to upload:");
uploadFolder = Console.ReadLine();
}
else
{
uploadFolder = dir;
}
string input = "";
do
{
StringBuilder sb = new StringBuilder ( );
sb.AppendLine($"1. DICOM Directory: {uploadFolder}");
sb.AppendLine($"2. DICOMweb Store Endpoint: {url}");
sb.AppendLine($"Press \"Enter\" to accept, \"1\" to change DICOM directory, \"2\" to change store endpoint or any key to exit");
Console.WriteLine(sb);
input = Console.ReadLine().Trim();
if (input == "1")
{
Console.WriteLine("Enter path for DICOM directory to upload:");
uploadFolder = Console.ReadLine();
}
else if (input == "2")
{
Console.WriteLine("Enter URL for DICOMweb Store endpoint:");
url = Console.ReadLine();
}
else if (input != "")
{
return;
}
} while (input != "");
if (!Directory.Exists(uploadFolder))
{
Console.WriteLine("DICOM upload directory doesn't exists.");
return;
}
DateTime startTime = DateTime.Now;
Console.WriteLine($"Upload start time: {startTime}");
DICOMStore.StoreDicomInDirectory(uploadFolder, url);
DateTime endTime = DateTime.Now;
Console.WriteLine($"Upload end time: {endTime}");
Console.WriteLine($"Total upload time: {endTime - startTime}");
}
}
}