-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
40 lines (35 loc) · 1.03 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
using System.Reflection;
string videoDeviceName = "";
int resolutionWidth = 0;
int resolutionHeight = 0;
int webPort = 8080;
var version = Assembly.GetExecutingAssembly().GetName().Version;
Console.WriteLine($"WebCamServer {version}\n");
if ((args.Length == 1) && ((args[0] == "/?") || (args[0] == "--help")))
{
Console.WriteLine("Usage:");
Console.WriteLine("WebCamServer --device=<device name> --width=<resWidth> --heigth=<resHeigth>");
return;
}
// Kommandozeilenargumente parsen
foreach (var arg in args)
{
if (arg.StartsWith("--device="))
{
videoDeviceName = arg.Split('=')[1];
}
else if (arg.StartsWith("--width="))
{
resolutionWidth = int.Parse(arg.Split('=')[1]);
}
else if (arg.StartsWith("--height="))
{
resolutionHeight = int.Parse(arg.Split('=')[1]);
}
else if (arg.StartsWith("--port="))
{
webPort = int.Parse(arg.Split('=')[1]);
}
}
var server = new HttpCameraServer(webPort, videoDeviceName, resolutionWidth, resolutionHeight);
server.Start();