From 675479d2cf61c57daf05e12d23fe53d699b50b89 Mon Sep 17 00:00:00 2001 From: "chris.watts90@outlook.com" Date: Wed, 28 Feb 2018 19:39:41 +0000 Subject: [PATCH] add fonts directory for folders. Add mapping for IDocumentPathProvider Add implementation for IDocumentPathProvider --- .../AuthenticationBootstrapper.cs | 14 ++++++++----- .../RaceLapTimer/DocumentPathProvider.cs | 20 +++++++++++++++++++ RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj | 2 ++ 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 RaceLapTimer/RaceLapTimer/DocumentPathProvider.cs diff --git a/RaceLapTimer/RaceLapTimer/AuthenticationBootstrapper.cs b/RaceLapTimer/RaceLapTimer/AuthenticationBootstrapper.cs index d593241..45b1452 100644 --- a/RaceLapTimer/RaceLapTimer/AuthenticationBootstrapper.cs +++ b/RaceLapTimer/RaceLapTimer/AuthenticationBootstrapper.cs @@ -31,6 +31,7 @@ namespace RaceLapTimer container.Bind().To(); container.Bind().To(); container.Bind().To(); + container.Bind().To(); container.Bind().To(); container.Bind().To().InSingletonScope(); //load dynamic plugins..: @@ -59,7 +60,7 @@ namespace RaceLapTimer // fs.Close(); //this still isnt saving the file.. :( //} } - + protected override void ConfigureRequestContainer(IKernel container, NancyContext context) { base.ConfigureRequestContainer(container, context); @@ -83,7 +84,7 @@ namespace RaceLapTimer new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", - UserMapper = requestContainer.Get(), + UserMapper = requestContainer.Get(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); @@ -97,19 +98,22 @@ namespace RaceLapTimer } } - protected override IRootPathProvider RootPathProvider { get {return new NancyRootPathProvider();} } + protected override IRootPathProvider RootPathProvider { get { return new NancyRootPathProvider(); } } protected override void ConfigureConventions(NancyConventions conventions) { base.ConfigureConventions(conventions); conventions.StaticContentsConventions.Add( - StaticContentConventionBuilder.AddDirectory("images","images") + StaticContentConventionBuilder.AddDirectory("images", "images") ); conventions.StaticContentsConventions.Add( StaticContentConventionBuilder.AddDirectory("js", "js") ); conventions.StaticContentsConventions.Add( - StaticContentConventionBuilder.AddDirectory("css","css") + StaticContentConventionBuilder.AddDirectory("css", "css") + ); + conventions.StaticContentsConventions.Add( + StaticContentConventionBuilder.AddDirectory("fonts", "fonts") ); } } diff --git a/RaceLapTimer/RaceLapTimer/DocumentPathProvider.cs b/RaceLapTimer/RaceLapTimer/DocumentPathProvider.cs new file mode 100644 index 0000000..cd24008 --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/DocumentPathProvider.cs @@ -0,0 +1,20 @@ +using System.IO; +using Interfaces; +using Nancy; + +namespace RaceLapTimer +{ + class DocumentPathProvider : IDocumentPathProvider + { + private IRootPathProvider _rootPathProvider; + + public DocumentPathProvider(IRootPathProvider rootPathProvider) + { + _rootPathProvider = rootPathProvider; + } + public string GetPath() + { + return Path.Combine(_rootPathProvider.GetRootPath(), "documents"); + } + } +} \ No newline at end of file diff --git a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj index 7421c84..a266652 100644 --- a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj +++ b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj @@ -114,6 +114,8 @@ + +