-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (34 loc) · 1.09 KB
/
Program.cs
File metadata and controls
39 lines (34 loc) · 1.09 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
using MDConvertLib;
namespace MarkdownThing
{
internal static class Program
{
[STAThread]
static int Main(string[] args)
{
if (args.Length > 0 && IsCommandLineExport(args))
return CommandLineExporter.Run(args);
ApplicationConfiguration.Initialize();
string? fileToOpen = null;
if (args.Length > 0)
{
var potentialPath = args[0];
if (!string.IsNullOrWhiteSpace(potentialPath) && File.Exists(potentialPath))
fileToOpen = potentialPath;
}
Application.Run(new Form1(fileToOpen));
return 0;
}
private static bool IsCommandLineExport(string[] args)
{
foreach (var arg in args)
{
if (arg is "-h" or "--help"
or "--batch" or "--pdf" or "--png" or "--html" or "--docx" or "--text"
or "--theme" or "--dark" or "--paper" or "--format")
return true;
}
return false;
}
}
}