-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
63 lines (53 loc) · 1.13 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
61
62
63
/**
* Program.cs
*
* Copyright (C) 2024 Elletra
*
* This file is part of the DSO Sharp source code. It may be used under the BSD 3-Clause License.
*
* For full terms, see the LICENSE file or visit https://spdx.org/licenses/BSD-3-Clause.html
*/
using DSO;
using DSO.Util;
using static DSO.Constants.Decompiler;
Console.Title = $"DSO Sharp ({VERSION})";
var (error, options) = CommandLineParser.Parse(args);
var exitImmediately = options.CommandLineMode;
var errorCode = error ? 1 : 0;
if (!error)
{
Logger.Quiet = options.Quiet;
if (!options.CommandLineMode)
{
Logger.LogHeader();
}
new Decompiler().Decompile(options);
}
if (!exitImmediately)
{
// The input is "redirected" when the program is called from a terminal.
var redirected = Console.IsInputRedirected;
if (redirected)
{
Console.WriteLine("\nPress enter key to exit...\n");
}
else
{
Console.WriteLine("\nPress any key to exit...\n");
}
while (true)
{
if (redirected)
{
if (Console.In.Peek() >= 0)
{
break;
}
}
else if (Console.KeyAvailable && Console.ReadKey(true).Key != ConsoleKey.None)
{
break;
}
}
}
return errorCode;