-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
65 lines (54 loc) · 1.96 KB
/
Program.cs
File metadata and controls
65 lines (54 loc) · 1.96 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
using FileLocker;
using CommandLine;
Parser.Default.ParseArguments<Arguments>(args)
.WithParsed<Arguments>(arguments =>
{
if (arguments.DirMode && arguments.FileMode)
{
System.Console.WriteLine("Cannot use both File mode and Dir mode at the same time");
Environment.Exit(0);
}
if (!(arguments.FileMode || arguments.DirMode))
{
System.Console.WriteLine("Must specify mode to use (-f for individual files, or -d for an entire diectory)");
Environment.Exit(0);
}
if (arguments.EncryptMode && arguments.DecryptMode)
{
System.Console.WriteLine("Cannot Encrypt and Decrypt at the same time");
Environment.Exit(0);
}
if (!(arguments.EncryptMode || arguments.DecryptMode))
{
System.Console.WriteLine("Must specify mode to use (-e for encryption, or -u for unencryption)");
Environment.Exit(0);
}
System.Console.WriteLine("Please input a Password for your File(s)");
string pass = Console.ReadLine();
Console.Clear();
if (pass != null)
{
if (arguments.FileMode)
{
if (arguments.EncryptMode)
{
FileLocker.FileLocker.EncryptFile(arguments.InputPath, pass, true);
}
else if (arguments.DecryptMode)
{
FileLocker.FileLocker.DecryptFile(arguments.InputPath, pass, true);
}
}
else if (arguments.DirMode)
{
if (arguments.EncryptMode)
{
FileLocker.FileLocker.EncryptDir(arguments.InputPath, pass, true);
}
else if (arguments.DecryptMode)
{
FileLocker.FileLocker.DecryptDir(arguments.InputPath, pass, true);
}
}
}
});