-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (49 loc) · 1.38 KB
/
Program.cs
File metadata and controls
56 lines (49 loc) · 1.38 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
56
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using Mono.Options;
namespace Fotomojt
{
public static class Program
{
[STAThread]
static void Main(string[] args)
{
var timeBetweenImages = new TimeSpan(0, 0, 5);
var dir = Directory.GetCurrentDirectory();
var port = 80;
var showHelp = false;
var p = new OptionSet
{
{ "t|timeout=", "{seconds} between images", (int v) => timeBetweenImages = new TimeSpan(0, 0, v)},
{ "p|port=", "{port} between images", (int v) => port = v},
{ "h|help", "show this message and exit", v => { showHelp = v != null; } },
};
List<string> extra;
try
{
extra = p.Parse(args);
}
catch (OptionException e)
{
Console.WriteLine(e.Message);
return;
}
if (showHelp)
{
p.WriteOptionDescriptions(Console.Out);
return;
}
if (extra.Count > 0)
{
dir = extra[0];
}
using (var game = new Fotomojt(dir, timeBetweenImages, port))
{
game.Run();
}
}
}
}