aboutsummaryrefslogtreecommitdiff
path: root/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs')
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs b/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs
new file mode 100644
index 00000000..ce94bf6b
--- /dev/null
+++ b/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Linq;
+using System.ServiceProcess;
+using System.Text;
+using System.IO;
+
+namespace MELT_Command_Websocket
+{
+ public partial class Service1 : ServiceBase
+ {
+ Process websockify;
+ public Service1()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnStart(string[] args)
+ {
+
+ string configpath = AppDomain.CurrentDomain.BaseDirectory + "\\noVNCConfig.ini";
+ string sockifypath = AppDomain.CurrentDomain.BaseDirectory + "\\websockify.exe";
+ //Load commandline arguements from config file.
+ StreamReader streamReader = new StreamReader(configpath);
+ string arguements = streamReader.ReadLine();
+ streamReader.Close();
+
+ //Start websockify.
+ websockify = System.Diagnostics.Process.Start(sockifypath, arguements);
+ }
+
+ protected override void OnStop()
+ {
+ //Service stopped. Close websockify.
+ websockify.Kill();
+ }
+ }
+}