This repository was archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (44 loc) · 1.86 KB
/
Program.cs
File metadata and controls
53 lines (44 loc) · 1.86 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
using CommandLine;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace AstroModLoader
{
public class Options
{
[Option("server", Required = false, HelpText = "Specifies that AstroModLoader is being ran for a server.")]
public bool ServerMode { get; set; }
[Option("client", Required = false, HelpText = "Specifies that AstroModLoader is being ran for a client.")]
public bool ForceClient { get; set; }
[Option("data", Required = false, HelpText = "Specifies the %localappdata% folder or the local equivalent of it.")]
public string LocalDataPath { get; set; }
[Option("next_launch_path", Required = false, HelpText = "Specifies a path to a file to store as the launch script.")]
public string NextLaunchPath { get; set; }
}
public static class Program
{
public static Options CommandLineOptions;
[DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Parser.Default.ParseArguments<Options>(args)
.WithParsed(o =>
{
CommandLineOptions = o;
if (CommandLineOptions.ForceClient) CommandLineOptions.ServerMode = false;
else if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "AstroServer.exe"))) CommandLineOptions.ServerMode = true;
if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 f1 = new Form1();
Application.Run(f1);
});
}
}
}