diff --git a/source/.vs/Funbit.Ets.Telemetry/v15/.suo b/source/.vs/Funbit.Ets.Telemetry/v15/.suo new file mode 100644 index 00000000..5dd59727 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..f77e0095 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/ChartController.cs b/source/Funbit.Ets.Telemetry.Server/Controllers/ChartController.cs new file mode 100644 index 00000000..93faa4a6 --- /dev/null +++ b/source/Funbit.Ets.Telemetry.Server/Controllers/ChartController.cs @@ -0,0 +1,15 @@ +using System.Web.Http; + +namespace Funbit.Ets.Telemetry.Server.Controllers +{ + public partial class Ets2AppController + { + [HttpGet] + [Route("chart/{dbname}/{tablename}")] + public IHttpActionResult GetData(string dbname, string tablename) + { + var result = new[] { "hello", "world" }; + return Ok(result); + } + } +} \ No newline at end of file diff --git a/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs b/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs index 0491584d..ffcf6c84 100644 --- a/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs +++ b/source/Funbit.Ets.Telemetry.Server/Controllers/Ets2AppController.cs @@ -10,11 +10,12 @@ using Funbit.Ets.Telemetry.Server.Helpers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System.Collections.Generic; namespace Funbit.Ets.Telemetry.Server.Controllers { [RoutePrefix("")] - public class Ets2AppController : StaticFileController + public partial class Ets2AppController : StaticFileController { static readonly log4net.ILog Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public const string TelemetryAppUriPath = "/"; diff --git a/source/Funbit.Ets.Telemetry.Server/Funbit.Ets.Telemetry.Server.csproj b/source/Funbit.Ets.Telemetry.Server/Funbit.Ets.Telemetry.Server.csproj index 6f955bd8..7c84c946 100644 --- a/source/Funbit.Ets.Telemetry.Server/Funbit.Ets.Telemetry.Server.csproj +++ b/source/Funbit.Ets.Telemetry.Server/Funbit.Ets.Telemetry.Server.csproj @@ -127,6 +127,7 @@ + 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...."); + } + } } } }