forked from dk307/HSPI_InfluxDBPersistence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
54 lines (48 loc) · 1.57 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
44
45
46
47
48
49
50
51
52
53
54
using System.Diagnostics;
namespace Hspi
{
/// <summary>
/// Class for the main program.
/// </summary>
public static class Program
{
/// <summary>
/// The homeseer server address. Defaults to the local computer but can be changed through the command line argument, server=address.
/// </summary>
private static string serverAddress = "127.0.0.1";
private const int serverPort = 10400;
private static ConsoleTraceListener consoleTracer = new ConsoleTraceListener();
/// <summary>
/// Defines the entry point of the application.
/// </summary>
/// <param name="args">Command line arguments</param>
private static void Main(string[] args)
{
Trace.Listeners.Add(consoleTracer);
Trace.WriteLine("Starting...");
// parse command line arguments
foreach (string sCmd in args)
{
string[] parts = sCmd.Split('=');
switch (parts[0].ToUpperInvariant())
{
case "SERVER":
serverAddress = parts[1];
break;
}
}
try
{
using (var plugin = new HSPI_InfluxDBPersistence.HSPI())
{
plugin.Connect(serverAddress, serverPort);
plugin.WaitforShutDownOrDisconnect();
}
}
finally
{
Trace.WriteLine("Bye!!!");
}
}
}
}