-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
33 lines (29 loc) · 1.05 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
using System;
using Topshelf;
namespace DiscordSettingsGistSync
{
public class Program
{
public static void Main()
{
while (true)
{
TopshelfExitCode topshelfExitCode = HostFactory.Run(config =>
{
config.Service<Heartbeat>(service =>
{
service.ConstructUsing(heartbeat => new());
service.WhenStarted(heartbeat => heartbeat.Start());
service.WhenStopped(heartbeat => heartbeat.Stop());
});
config.RunAsLocalService();
config.SetServiceName(Config.ServiceName);
config.SetDisplayName(Config.ServiceDisplayName);
config.SetDescription(Config.ServiceDescription);
});
int exitCode = (int)Convert.ChangeType(topshelfExitCode, topshelfExitCode.GetTypeCode());
Environment.ExitCode = exitCode;
}
}
}
}