Initial Commit

This commit is contained in:
chris.watts90@outlook.com 2017-04-28 21:27:23 +01:00
commit e690c1e6a9
49 changed files with 1567 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
**.suo
**/bin/**
**/obj/**
**/packages/**
**/.vs/**

View File

@ -0,0 +1,31 @@
using System;
using System.Security.Cryptography;
using System.Text;
namespace Helpers.Encryption
{
public class Hash
{
public static string HashString(string stringToHash)
{
//var shaEngine = new SHA3.SHA3Managed(512);
//var hash = shaEngine.ComputeHash(Encoding.Unicode.GetBytes(stringToHash));
//return Encoding.Unicode.GetString(hash);
MD5 md5 = MD5.Create();
byte[] inputBytes = Encoding.ASCII.GetBytes(stringToHash);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
}
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BC7DEA8B-5029-459A-AA54-EA81EB390F87}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Helpers.Encryption</RootNamespace>
<AssemblyName>Helpers.Encryption</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Hash.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Helpers.Encrytion")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Helpers.Encrytion")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bc7dea8b-5029-459a-aa54-ea81eb390f87")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Interfaces
{
public interface IUserStorage
{
User GetUser(int id);
User GetUser(string guid);
bool DeleteUser(int id);
bool DeleteUser(string guid);
bool UpdateUser(User user);
bool CreateUser(User user);
}
}

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5C6DCC59-19F3-46AD-A479-926610F36257}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Interfaces</RootNamespace>
<AssemblyName>Interfaces</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IUserStorage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="User.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Interfaces")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Interfaces")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5c6dcc59-19f3-46ad-a479-926610f36257")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
namespace Interfaces
{
public class User
{
public string Id { get; set; }
public string Email { get; set; }
public string EncryptedPassword { get; set; }
public int SignInCount { get; set; }
public DateTime CurrentLoginTime { get; set; }
public DateTime LastLoginTime { get; set; }
public string CurrentLoginIp { get; set; }
public string LastLoginIp { get; set; }
public int FailedLoginAttempts { get; set; }
public bool AccountLocked { get; set; }
public DateTime LockedAt { get; set; }
public DateTime CreatedAt { get; set; }
public List<string> Roles { get; set; }
}
}

View File

@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RaceLapTimer", "RaceLapTimer\RaceLapTimer.csproj", "{85A3CC28-096C-40A6-8C67-3AADE40EDF32}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RaceLapTimerHost", "RaceLapTimerHost\RaceLapTimerHost.csproj", "{763192F3-FDC4-409B-B7CF-1191DCBB14EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interfaces", "Interfaces\Interfaces.csproj", "{5C6DCC59-19F3-46AD-A479-926610F36257}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helpers.Encryption", "Helpers.Encrytion\Helpers.Encryption.csproj", "{BC7DEA8B-5029-459A-AA54-EA81EB390F87}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{85A3CC28-096C-40A6-8C67-3AADE40EDF32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85A3CC28-096C-40A6-8C67-3AADE40EDF32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85A3CC28-096C-40A6-8C67-3AADE40EDF32}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85A3CC28-096C-40A6-8C67-3AADE40EDF32}.Release|Any CPU.Build.0 = Release|Any CPU
{763192F3-FDC4-409B-B7CF-1191DCBB14EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{763192F3-FDC4-409B-B7CF-1191DCBB14EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{763192F3-FDC4-409B-B7CF-1191DCBB14EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{763192F3-FDC4-409B-B7CF-1191DCBB14EB}.Release|Any CPU.Build.0 = Release|Any CPU
{5C6DCC59-19F3-46AD-A479-926610F36257}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C6DCC59-19F3-46AD-A479-926610F36257}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C6DCC59-19F3-46AD-A479-926610F36257}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C6DCC59-19F3-46AD-A479-926610F36257}.Release|Any CPU.Build.0 = Release|Any CPU
{BC7DEA8B-5029-459A-AA54-EA81EB390F87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC7DEA8B-5029-459A-AA54-EA81EB390F87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC7DEA8B-5029-459A-AA54-EA81EB390F87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC7DEA8B-5029-459A-AA54-EA81EB390F87}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,18 @@
using System;
using System.Web.Http;
namespace RaceLapTimer
{
public class InfoController:ApiController
{
/// <summary>
/// returns the last transponder Id from the ir daemon.
/// </summary>
/// <returns></returns>
[HttpGet]
public IHttpActionResult LastScannedId()
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,8 @@
using System.Web.Http;
namespace RaceLapTimer
{
public class LapTrackController:ApiController
{
}
}

View File

@ -0,0 +1,8 @@
using System.Web.Http;
namespace RaceLapTimer
{
public class MonitorController:ApiController
{
}
}

View File

@ -0,0 +1,8 @@
using System.Web.Http;
namespace RaceLapTimer
{
public class PilotController:ApiController
{
}
}

View File

@ -0,0 +1,9 @@
using System.Web.Http;
namespace RaceLapTimer
{
public class RaceSessionController:ApiController
{
}
}

View File

@ -0,0 +1,6 @@
namespace RaceLapTimer
{
public class SatelliteController
{
}
}

View File

@ -0,0 +1,8 @@
using System.Web.Http;
namespace RaceLapTimer
{
public class SoundController:ApiController
{
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<appSettings>
<add key="webPages:Enabled" value="false" />
</appSettings><system.web.webPages.razor>
<pages pageBaseType="Nancy.ViewEngines.Razor.NancyRazorViewBase">
<namespaces>
<add namespace="Nancy.ViewEngines.Razor" />
</namespaces>
</pages>
</system.web.webPages.razor>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -0,0 +1,57 @@
using Interfaces;
using Nancy;
using Nancy.Authentication.Forms;
using Nancy.Bootstrapper;
using Nancy.Diagnostics;
using Nancy.TinyIoc;
namespace RaceLapTimer
{
public class FormsAuthBootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
// We don't call "base" here to prevent auto-discovery of
// types/dependencies
}
protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
{
base.ConfigureRequestContainer(container, context);
// Here we register our user mapper as a per-request singleton.
// As this is now per-request we could inject a request scoped
// database "context" or other request scoped services.
container.Register<IUserStorage, UserStorage>(); //register the storage provider..
container.Register<IUserMapper, UserDatabase>().AsSingleton();
}
protected override void RequestStartup(TinyIoCContainer requestContainer, IPipelines pipelines, NancyContext context)
{
// At request startup we modify the request pipelines to
// include forms authentication - passing in our now request
// scoped user name mapper.
//
// The pipelines passed in here are specific to this request,
// so we can add/remove/update items in them as we please.
var formsAuthConfiguration =
new FormsAuthenticationConfiguration()
{
RedirectUrl = "~/login",
UserMapper = requestContainer.Resolve<IUserMapper>(),
};
FormsAuthentication.Enable(pipelines, formsAuthConfiguration);
}
protected override DiagnosticsConfiguration DiagnosticsConfiguration
{
get
{
return new DiagnosticsConfiguration { Password = "password" };
}
}
protected override IRootPathProvider RootPathProvider { get {return new NancyRootPathProvider();} }
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
namespace RaceLapTimer.Modules
{
public class HistoryModule:NancyModule
{
public HistoryModule():base("/history")
{
Get[""] = args => GetHistoryHomePage(args);
}
private dynamic GetHistoryHomePage(dynamic args)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
using Nancy.Authentication.Forms;
using Nancy.Extensions;
namespace RaceLapTimer.Modules
{
public class LoginModule:NancyModule
{
public LoginModule()
{
Get["/login"] = args => GetLoginPage(args);
Post["/login"] = args => PostLoginAttempt(args);
Get["/logout"] = args => {
return this.LogoutAndRedirect("~/");
};
}
private dynamic GetLoginPage(dynamic args)
{
dynamic model = new ExpandoObject();
model.Errored = this.Request.Query.error.HasValue;
return View["login", model];
}
private dynamic PostLoginAttempt(dynamic args)
{
var userGuid = UserDatabase.ValidateUser((string)this.Request.Form.Username,
(string)this.Request.Form.Password);
if (userGuid == null)
{
return this.Context.GetRedirect("~/login?error=true&username=" + (string)this.Request.Form.Username);
}
DateTime? expiry = null;
if (this.Request.Form.RememberMe.HasValue)
{
expiry = DateTime.Now.AddDays(7);
}
return this.LoginAndRedirect(userGuid.Value, expiry);
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
namespace RaceLapTimer.Modules
{
public class MonitorModule:NancyModule
{
public MonitorModule() : base("/monitor")
{
Get[""] = args => GetMonitorHomePage(args);
}
private dynamic GetMonitorHomePage(dynamic args)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
using Nancy.Security;
namespace RaceLapTimer.Modules
{
public class PilotModule:NancyModule
{
public PilotModule() : base("/pilot")
{
this.RequiresAuthentication();
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
namespace RaceLapTimer.Modules
{
public class PilotsModule:NancyModule
{
public PilotsModule() : base("/pilots")
{
Get[""] = args => GetPilotsListHomePage(args);
}
private dynamic GetPilotsListHomePage(dynamic args)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
using Nancy.Security;
namespace RaceLapTimer.Modules
{
public class RaceDirectorModule:NancyModule
{
public RaceDirectorModule() : base("/racedirector")
{
this.RequiresAuthentication();
Get[""] = args => GetRaceDirectoryHomePage(args);
//API METHOD - Get["lapTimes"]
}
private dynamic GetRaceDirectoryHomePage(dynamic args)
{
return View["RaceDirector.cshtml"];
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
using Nancy.Security;
namespace RaceLapTimer.Modules
{
public class SoundfileModule:NancyModule
{
public SoundfileModule() : base("/soundfile")
{
this.RequiresAuthentication();
Get[""] = args => GetSoundfileHomePage(args);
}
private dynamic GetSoundfileHomePage(dynamic args)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
using Nancy.Security;
namespace RaceLapTimer.Modules
{
public class SystemModule:NancyModule
{
//also needs to home system/start_race_session, this should probably be an api method with post arg.
public SystemModule() : base("/system")
{
this.RequiresAuthentication();
Get[""] = args => GetSystemHomePage(args);
Get["/pilot"] = args => GetSystemPilotPage(args);
Get["/soundfile"] = args => GetSystemSoundFilePage(args);
}
//this will return system configuration settings home page.
private dynamic GetSystemHomePage(dynamic args)
{
throw new NotImplementedException();
}
//system/pilot/create //api method
//system/pilot/delete/id //api method
//system/pilot/deactivate_token/pilotId //api method.
//system/pilot page.
private dynamic GetSystemPilotPage(dynamic args)
{
throw new NotImplementedException();
}
//system/soundfile page
private dynamic GetSystemSoundFilePage(dynamic args)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
namespace RaceLapTimer.Modules
{
public class UserModule:NancyModule
{
public UserModule() : base("/user")
{
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.IO;
using System.Reflection;
using Nancy;
namespace RaceLapTimer
{
public class NancyRootPathProvider:IRootPathProvider
{
public string GetRootPath()
{
return new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), "www")).LocalPath;
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using Nancy.Security;
namespace RaceLapTimer
{
public class NancyUser : IUserIdentity
{
public NancyUser(string username)
{
UserName = username;
}
public string UserName { get; }
public string Email { get; set; }
public string Password { get; set; }
public int SignInCount { get; set; }
public bool AccountLocked { get; set; }
public DateTime LockedAt { get; set; }
public IEnumerable<string> Claims { get; }
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace RaceLapTimer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new RaceLapTimer()
};
ServiceBase.Run(ServicesToRun);
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RaceLapTimer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RaceLapTimer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("85a3cc28-096c-40a6-8c67-3aade40edf32")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,37 @@
namespace RaceLapTimer
{
partial class RaceLapTimer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "Service1";
}
#endregion
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.ServiceProcess;
using Microsoft.Owin.Hosting;
namespace RaceLapTimer
{
public partial class RaceLapTimer : ServiceBase
{
private IDisposable _webService;
private readonly string _url = "http://*:8800";
public RaceLapTimer()
{
InitializeComponent();
}
public void Start()
{
OnStart(null);
}
public void StopService()
{
OnStop();
}
protected override void OnStart(string[] args)
{
_webService = WebApp.Start<Startup>(_url);
Console.WriteLine("Web Server is running on " + _url);
}
protected override void OnStop()
{
_webService.Dispose();
}
}
}

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{85A3CC28-096C-40A6-8C67-3AADE40EDF32}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RaceLapTimer</RootNamespace>
<AssemblyName>RaceLapTimer</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.3.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.1.0\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin.Hosting, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Hosting.3.1.0\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Nancy.Authentication.Forms, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Authentication.Forms.1.4.1\lib\net40\Nancy.Authentication.Forms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Nancy.Owin, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Owin.1.4.1\lib\net40\Nancy.Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Nancy.ViewEngines.Razor, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Viewengines.Razor.1.4.3\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApiControllers\InfoController.cs" />
<Compile Include="ApiControllers\LapTrackController.cs" />
<Compile Include="ApiControllers\MonitorController.cs" />
<Compile Include="ApiControllers\PilotController.cs" />
<Compile Include="ApiControllers\RaceSessionController.cs" />
<Compile Include="ApiControllers\SatelliteController.cs" />
<Compile Include="ApiControllers\SoundController.cs" />
<Compile Include="AuthenticationBootstrapper.cs" />
<Compile Include="Modules\HistoryModule.cs" />
<Compile Include="Modules\LoginModule.cs" />
<Compile Include="Modules\MonitorModule.cs" />
<Compile Include="Modules\PilotModule.cs" />
<Compile Include="Modules\PilotsModule.cs" />
<Compile Include="Modules\RaceDirectorModule.cs" />
<Compile Include="Modules\SoundfileModule.cs" />
<Compile Include="Modules\SystemModule.cs" />
<Compile Include="Modules\UserModule.cs" />
<Compile Include="NancyRootPathProvider.cs" />
<Compile Include="NancyUser.cs" />
<Compile Include="RaceLapTimer.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="RaceLapTimer.Designer.cs">
<DependentUpon>RaceLapTimer.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Startup.cs" />
<Compile Include="UserDatabase.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="www\Views\index.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="www\Views\login.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="www\Views\RaceDirector.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="www\Views\razor-layout.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="www\Views\secure.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="www\css\" />
<Folder Include="www\fonts\" />
<Folder Include="www\images\" />
<Folder Include="www\js\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Helpers.Encrytion\Helpers.Encryption.csproj">
<Project>{bc7dea8b-5029-459a-aa54-ea81eb390f87}</Project>
<Name>Helpers.Encryption</Name>
</ProjectReference>
<ProjectReference Include="..\Interfaces\Interfaces.csproj">
<Project>{5C6DCC59-19F3-46AD-A479-926610F36257}</Project>
<Name>Interfaces</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets" Condition="Exists('..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=apicontrollers/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,26 @@
using System.Web.Http;
using Owin;
namespace RaceLapTimer
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Configure Web API for self-host.
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.EnsureInitialized();
app.UseWebApi(config);
app.UseNancy();
}
}
}

View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Interfaces;
using Nancy;
using Nancy.Authentication.Forms;
using Nancy.Security;
namespace RaceLapTimer
{
public class UserDatabase : IUserMapper
{
private static List<Tuple<string, string, Guid>> users = new List<Tuple<string, string, Guid>>();
private IUserStorage _storage;
public UserDatabase(IUserStorage storage)
{
_storage = storage;
users.Add(new Tuple<string, string, Guid>("admin", "password", new Guid("55E1E49E-B7E8-4EEA-8459-7A906AC4D4C0")));
users.Add(new Tuple<string, string, Guid>("user", "password", new Guid("56E1E49E-B7E8-4EEA-8459-7A906AC4D4C0")));
}
/// <summary>
/// Get the user from the database
/// </summary>
/// <param name="identifier">The Guid identifier for the user</param>
/// <param name="context">NancyContext (injected)</param>
/// <returns></returns>
public IUserIdentity GetUserFromIdentifier(Guid identifier, NancyContext context)
{
var userRecord = users.FirstOrDefault(u => u.Item3 == identifier);
return userRecord == null
? null
: new NancyUser(userRecord.Item1);
}
/// <summary>
/// Validate that the user/password combo is a valid user.
/// </summary>
/// <param name="username">the username of the user attempting to authenticate</param>
/// <param name="password">the password of the user to authenticate.</param>
/// <returns>Returns Guid if valid user, null if not.</returns>
public static Guid? ValidateUser(string username, string password)
{
var pwHash = string.Empty;
if (!string.IsNullOrEmpty(password))
{
pwHash = Helpers.Encryption.Hash.HashString(password);
}
var userRecord = users.FirstOrDefault(u => u.Item1 == username && u.Item2 == password);
return userRecord?.Item3;
}
}
public class UserStorage : IUserStorage
{
public UserStorage()
{
}
public User GetUser(int id)
{
throw new NotImplementedException();
}
public User GetUser(string guid)
{
throw new NotImplementedException();
}
public bool DeleteUser(int id)
{
throw new NotImplementedException();
}
public bool DeleteUser(string guid)
{
throw new NotImplementedException();
}
public bool UpdateUser(User user)
{
throw new NotImplementedException();
}
public bool CreateUser(User user)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.Owin" version="3.1.0" targetFramework="net452" />
<package id="Microsoft.Owin.Host.HttpListener" version="3.1.0" targetFramework="net452" />
<package id="Microsoft.Owin.Hosting" version="3.1.0" targetFramework="net452" />
<package id="Nancy" version="1.4.3" targetFramework="net452" />
<package id="Nancy.Authentication.Forms" version="1.4.1" targetFramework="net452" />
<package id="Nancy.Owin" version="1.4.1" targetFramework="net452" />
<package id="Nancy.Viewengines.Razor" version="1.4.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
</packages>

View File

@ -0,0 +1,28 @@
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
@{
Layout = "razor-layout.cshtml";
ViewBag.Title = "Race Director";
ViewBag.CreateRaceApiEndpoint = "/api/racesession/create";
}
<h3>@ViewBag.Title</h3>
<h4>Last Scanned Id</h4>
<label>None</label>
<h4>Current Race</h4>
<label>None</label>
<h4>Last Lap Times</h4>
<label>None</label>
<form action="@ViewBag.CreateRaceApiEndpoint" method="post" class="form-group">
<div class="form-group">
<label>Race Title</label>
<input for="RaceTitle" type="text" class="form-control" id="raceTitle" placeholder="Awesome Race"/>
</div>
<div class="form-group">
<label>Idle Time (s)</label>
<input for="RaceIdleTime" type="text" class="form-control" id="raceIdleTime" placeholder="0"/>
</div>
<button type="submit" >Submit</button>
</form>

View File

@ -0,0 +1,20 @@
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
@{
Layout = "razor-layout.cshtml";
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Forms Authentication Demo</title>
</head>
<body>
<a href="secure">Enter the "Secure Zone"!</a><br />
<a href="partlysecure">Enter the "Partly Secure Zone"!</a><br />
@if (Html.IsAuthenticated)
{
<p>You are Logged in..</p>
<a href="logout">Log Out</a>
}
</body>
</html>

View File

@ -0,0 +1,25 @@
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
@{
Layout = "razor-layout.cshtml";
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login</title>
</head>
<body>
<form method="POST">
Username <input type="text" name="Username" />
<br />
Password <input name="Password" type="password" />
<br />
Remember Me <input name="RememberMe" type="checkbox" value="True" />
<br />
<input type="submit" value="Login" />
</form>
@if (Model.Errored)
{
<div id="errorBox" class="floatingError">Invalid Username or Password</div>
}
</body>
</html>

View File

@ -0,0 +1,96 @@
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
<!DOCTYPE html>
<html>
<head>
<script src="~/Content/js/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="~/Content/css/bootstrap.css" />
<script src="~/Content/js/bootstrap.js"></script>
<link rel="stylesheet" href="~/Content/css/site.css"/>
<title>Razor Localization Demo</title>
</head>
<body>
<div data-rails-cable-ip='192.168.42.1' id='host_data'></div>
<navbar class='navbar-default navbar-fixed-top'>
<div class='container-fluid'>
<div class='navbar-header'>
<button aria-controls='navbar' aria-expanded='false' class='navbar-toggle collapsed' data-target='#navbar' data-toggle='collapse' type='button'>
<span class='sr-only'>Toggle navigation</span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
</button>
<a class='navbar-brand' href='/'>
EasyRaceLapTimer
</a>
</div>
<div class='collapse navbar-collapse' id='navbar'>
<ul class='nav navbar-nav navbar-right'>
<li>
<a href="/race_director">Race Director</a>
</li>
<li class='dropdown'>
<a aria-expanded='false' aria-haspopup='true' class='dropdown-toggle' data-toggle='dropdown' href='#' role='button'>
Configuration
<span class='caret'></span>
</a>
<ul class='dropdown-menu'>
<li>
<a href="/system">System</a>
</li>
<li>
<a href="/system/pilot">Pilots</a>
</li>
<li>
<a href="/system/soundfile">Soundeffects</a>
</li>
</ul>
</li>
<li>
<a href="/monitor">Monitor</a>
</li>
<li>
<a href="/pilots">Pilots</a>
</li>
<li>
<a href="/history">History</a>
</li>
<li>
<a href='#'>
Version
0.5.1
</a>
</li>
</ul>
</div>
<!-- /.nav-collapse -->
</div>
</navbar>
<div class='container-fluid'>
<div class='row'>
<div class='col-xs-12 center'>
@RenderBody()
</div>
</div>
<footer>
<div class='row'>
<div class='col-lg-12'>
<p>
Made & Sponsored by
<a href='http://www.airbirds.de' rel='nofollow'>AirBirds</a>.
</p>
<p>
Code released under the
<a href='http://www.gnu.org/licenses/gpl-3.0.de.html'>GPL V3</a>.
</p>
<ul class='list-unstyled'>
<li class='pull-right'>
<a class='backtotop' href='#top'>Back to top</a>
</li>
</ul>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -0,0 +1,17 @@
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
@{
Layout = "razor-layout.cshtml";
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Secure Page!</title>
</head>
<body>
Welcome to the secure area @Model.Username !
<br />
<br />
<a href="@Url.Content("~/logout")">Logout</a>
</body>
</html>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<appSettings>
<add key="webPages:Enabled" value="false" />
</appSettings>
<system.web.webPages.razor>
<pages pageBaseType="Nancy.ViewEngines.Razor.NancyRazorViewBase">
<namespaces>
<add namespace="Nancy.ViewEngines.Razor" />
</namespaces>
</pages>
</system.web.webPages.razor>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -0,0 +1,16 @@
using System;
namespace RaceLapTimerHost
{
class Program
{
static void Main(string[] args)
{
var service = new RaceLapTimer.RaceLapTimer();
service.Start();
Console.WriteLine("Press enter to exit");
Console.ReadLine();
service.StopService();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RaceLapTimerHost")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RaceLapTimerHost")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("763192f3-fdc4-409b-b7cf-1191dcbb14eb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{763192F3-FDC4-409B-B7CF-1191DCBB14EB}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RaceLapTimerHost</RootNamespace>
<AssemblyName>RaceLapTimerHost</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.1.0\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Nancy.ViewEngines.Razor, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Viewengines.Razor.1.4.3\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RaceLapTimer\RaceLapTimer.csproj">
<Project>{85A3CC28-096C-40A6-8C67-3AADE40EDF32}</Project>
<Name>RaceLapTimer</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets" Condition="Exists('..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Nancy.Viewengines.Razor.1.4.3\build\Nancy.ViewEngines.Razor.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net452" />
<package id="Microsoft.Owin.Host.HttpListener" version="3.1.0" targetFramework="net452" />
<package id="Nancy" version="1.4.3" targetFramework="net452" />
<package id="Nancy.Viewengines.Razor" version="1.4.3" targetFramework="net452" />
</packages>