ChrisCompleteCodeTrunk
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
|
using CommandLine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WilksMergeModule
{
static class Program
{
public static CommandLineArguments CommandLineArguments;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string[] args = Environment.GetCommandLineArgs();
Parser.Default.ParseArguments<CommandLineArguments>(args)
.WithParsed<CommandLineArguments>(opts => RunOptionsAndReturnExitCode(opts))
.WithNotParsed<CommandLineArguments>((errs) => HandleParseError(errs));
Application.Run(new FormMain());
}
private static void HandleParseError(IEnumerable<Error> errs)
{
if (MessageBox.Show("Unable to parse command line arguments.", "Pardon our error.", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
{
Application.Exit();
}
}
private static void RunOptionsAndReturnExitCode(CommandLineArguments opts)
{
CommandLineArguments = opts;
}
}
}
|
Revision |
Author |
Commited |
Message |
1
|
BBDSCHRIS
|
Wed 22 Aug, 2018 20:08:03 +0000 |
|