forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
55 lines (49 loc) · 1.18 KB
/
Copy pathProgram.cs
File metadata and controls
55 lines (49 loc) · 1.18 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
54
55
using System;
using System.Globalization;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Mono.Options;
using Microsoft.Extensions.Logging;
namespace Uno.UI.RemoteControl.Host
{
class Program
{
static void Main(string[] args)
{
var httpPort = 0;
var p = new OptionSet() {
{
"httpPort=", s => {
if(!int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out httpPort))
{
throw new ArgumentException($"The httpPort parameter is invalid {s}");
}
}
},
};
p.Parse(args);
if(httpPort == 0)
{
throw new ArgumentException($"The httpPort parameter is required.");
}
var host = new WebHostBuilder()
.UseSetting("UseIISIntegration", false.ToString())
.UseKestrel()
.UseUrls($"http://*:{httpPort}/")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureLogging(logging =>
logging
.ClearProviders()
.AddConsole()
.SetMinimumLevel(LogLevel.Debug))
.ConfigureAppConfiguration((hostingContext, config) =>
{
config.AddCommandLine(args);
})
.Build();
host.Run();
}
}
}