-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram_Original.cs
More file actions
54 lines (49 loc) · 950 Bytes
/
Copy pathProgram_Original.cs
File metadata and controls
54 lines (49 loc) · 950 Bytes
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
using PacManager.IO;
using System;
using System.IO;
namespace PacManager
{
public class Program
{
public static void Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Missing parameters");
return;
}
// Prepare values
var command = args[0];
var source = args[1];
string destination;
if (args.Length < 3)
{
destination = source;
Console.WriteLine("Using default destination");
}
else
{
destination = args[2];
}
// Run operation
if (command == "-p")
{
destination = Path.ChangeExtension(destination, ".pac");
var encoder = new PacEncoder(source);
encoder.Encode(destination);
}
else if (command == "-u")
{
destination = Path.ChangeExtension(destination, null);
using (var decoder = new PacDecoder(source))
{
decoder.Decode(destination);
}
}
else
{
Console.WriteLine("Invalid command");
}
}
}
}