-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
43 lines (36 loc) · 1.18 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
41
42
43
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Configuration;
using Topshelf;
namespace PWSWeatherUploader
{
public class Program
{
public static WebSocketWeatherFlow ws;
static void Main(string[] args)
{
var exitCode = HostFactory.Run(x =>
{
x.Service<WeatherProcessor>(s =>
{
s.ConstructUsing(wp => new WeatherProcessor());
s.WhenStarted(wp => wp.Start());
s.WhenStopped(wp => wp.Stop());
}
);
x.RunAsLocalSystem();
x.SetServiceName("PWSWeatherUploader");
x.SetDisplayName("PWS Weather Uploader");
x.SetDescription("This service uploads data from WeatherFlow Tempest weather stations to AerisWeather's PWSWeather service.");
});
int exitCodeValue = (int)Convert.ChangeType(exitCode, exitCode.GetTypeCode());
Environment.ExitCode = exitCodeValue;
}
}
}