Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added source/.vs/Funbit.Ets.Telemetry/v15/.suo
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions source/Funbit.Ets.Telemetry.Server/Controllers/ChartController.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\ChartController.cs" />
<Compile Include="Controllers\Ets2AppController.cs" />
<Compile Include="Controllers\Ets2TelemetryHub.cs" />
<Compile Include="Controllers\StaticFileController.cs" />
Expand Down
52 changes: 34 additions & 18 deletions source/Funbit.Ets.Telemetry.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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<Startup>(url: baseAddress))
{
Console.WriteLine("Starting....");

while (true)
{
Thread.Sleep(5000);
Console.WriteLine("Still running....");
}
}
}
}
}