diff --git a/source/.vs/Funbit.Ets.Telemetry/v15/.suo b/source/.vs/Funbit.Ets.Telemetry/v15/.suo new file mode 100644 index 00000000..d4c62dfc Binary files /dev/null and b/source/.vs/Funbit.Ets.Telemetry/v15/.suo differ diff --git a/source/.vs/Funbit.Ets.Telemetry/v15/sqlite3/storage.ide b/source/.vs/Funbit.Ets.Telemetry/v15/sqlite3/storage.ide new file mode 100644 index 00000000..5b103211 Binary files /dev/null and b/source/.vs/Funbit.Ets.Telemetry/v15/sqlite3/storage.ide differ diff --git a/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs b/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs index 0491584d..1b3f2cc4 100644 --- a/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs +++ b/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs @@ -10,6 +10,7 @@ using Funbit.Ets.Telemetry.Server.Helpers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System.Collections.Generic; namespace Funbit.Ets.Telemetry.Server.Controllers { @@ -58,6 +59,14 @@ public async Task GetRoot() return rootResponse; } + [HttpGet] + [Route("chart/{dbname}/{tablename}")] + public IHttpActionResult GetData(string dbname, string tablename) + { + var result = new[] { "hello", "world" }; + return Ok(result); + } + [HttpGet] [Route("{fileName:regex(^(?!.*api))}", Name = "GetRootFile")] public HttpResponseMessage GetRootFile( diff --git a/source/Funbit.Ets.Telemetry.Server/Program.cs b/source/Funbit.Ets.Telemetry.Server/Program.cs index aff56ef6..5f11a08b 100644 --- a/source/Funbit.Ets.Telemetry.Server/Program.cs +++ b/source/Funbit.Ets.Telemetry.Server/Program.cs @@ -3,6 +3,8 @@ using System.Runtime.InteropServices; using System.Windows.Forms; using Funbit.Ets.Telemetry.Server.Helpers; +using Microsoft.Owin.Hosting; +using System.Threading; namespace Funbit.Ets.Telemetry.Server { @@ -22,26 +24,40 @@ static class Program [STAThread] static void Main(string[] args) { - // check if another instance is running - CreateMutex(0, -1, - Uac.IsProcessElevated() - ? "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001_UAC" - : "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001"); - bool bAnotherInstanceRunning = GetLastError() == ErrorAlreadyExists; - if (bAnotherInstanceRunning) - { - MessageBox.Show(@"Another ETS2/ATS Telemetry Server instance is already running!", @"Warning", - MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } + //// check if another instance is running + //CreateMutex(0, -1, + // Uac.IsProcessElevated() + // ? "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001_UAC" + // : "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001"); + //bool bAnotherInstanceRunning = GetLastError() == ErrorAlreadyExists; + //if (bAnotherInstanceRunning) + //{ + // MessageBox.Show(@"Another ETS2/ATS Telemetry Server instance is already running!", @"Warning", + // MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + // return; + //} + + //log4net.Config.XmlConfigurator.Configure(); + + //Application.EnableVisualStyles(); + //Application.SetCompatibleTextRenderingDefault(false); + //UninstallMode = args.Length >= 1 && args.Any(a => a.Trim() == "-uninstall"); - log4net.Config.XmlConfigurator.Configure(); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - UninstallMode = args.Length >= 1 && args.Any(a => a.Trim() == "-uninstall"); + // Application.Run(new MainForm()); - Application.Run(new MainForm()); + string baseAddress = "http://localhost:9000/"; + + // Start OWIN host + using (WebApp.Start(url: baseAddress)) + { + Console.WriteLine("Starting...."); + + while (true) + { + Thread.Sleep(5000); + Console.WriteLine("Still running...."); + } + } } } }