Removed the other rootpath provider

pull/470/head
TidusJar 9 years ago
parent 57442f16d8
commit 8b46925f08

@ -25,6 +25,7 @@
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Diagnostics;
using System.Net; using System.Net;
using Mono.Data.Sqlite; using Mono.Data.Sqlite;
@ -68,12 +69,14 @@ namespace PlexRequests.UI
private IKernel _kernel; private IKernel _kernel;
protected override IKernel GetApplicationContainer() protected override IKernel GetApplicationContainer()
{ {
Debug.WriteLine("GetAppContainer");
_kernel.Load<FactoryModule>(); _kernel.Load<FactoryModule>();
return _kernel; return _kernel;
} }
protected override void ApplicationStartup(IKernel container, IPipelines pipelines) protected override void ApplicationStartup(IKernel container, IPipelines pipelines)
{ {
Debug.WriteLine("Bootstrapper.ApplicationStartup");
ConfigureContainer(container); ConfigureContainer(container);
JsonSettings.MaxJsonLength = int.MaxValue; JsonSettings.MaxJsonLength = int.MaxValue;
@ -116,14 +119,18 @@ namespace PlexRequests.UI
#endif #endif
protected override void ConfigureConventions(NancyConventions nancyConventions) protected override void ConfigureConventions(NancyConventions nancyConventions)
{ {
Debug.WriteLine("Configuring the conventions");
base.ConfigureConventions(nancyConventions); base.ConfigureConventions(nancyConventions);
Debug.WriteLine("Finished BASE");
var settingsService = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
var settings = settingsService.GetSettings();
var assetLocation = settings.BaseUrl ?? string.Empty;
var settings = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider())); Debug.WriteLine($"AssetLocation {assetLocation}");
var assetLocation = settings.GetSettings().BaseUrl;
nancyConventions.StaticContentsConventions.Add( nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content_{AssemblyHelper.GetProductVersion()}", "Content") StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content_{AssemblyHelper.GetProductVersion()}", "Content")
); );
Debug.WriteLine("Added Content");
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/docs", "swagger-ui"); nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/docs", "swagger-ui");
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/fonts", "Content/fonts"); nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/fonts", "Content/fonts");
@ -166,6 +173,7 @@ namespace PlexRequests.UI
protected override void RequestStartup(IKernel container, IPipelines pipelines, NancyContext context) protected override void RequestStartup(IKernel container, IPipelines pipelines, NancyContext context)
{ {
Debug.WriteLine("RequestStartup");
//CORS Enable //CORS Enable
pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) => pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) =>
{ {
@ -179,6 +187,7 @@ namespace PlexRequests.UI
private void ConfigureContainer(IKernel container) private void ConfigureContainer(IKernel container)
{ {
Debug.WriteLine("Configuring ServiceLoc/Container");
var loc = ServiceLocator.Instance; var loc = ServiceLocator.Instance;
loc.SetContainer(container); loc.SetContainer(container);
} }

@ -26,6 +26,7 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -43,10 +44,16 @@ namespace PlexRequests.UI.Helpers
/// </summary> /// </summary>
public IEnumerable<IBinding> Resolve(Multimap<Type, IBinding> bindings, Type service) public IEnumerable<IBinding> Resolve(Multimap<Type, IBinding> bindings, Type service)
{ {
Debug.WriteLine("Contrar thing");
if (service.IsGenericType) if (service.IsGenericType)
{ {
var genericType = service.GetGenericTypeDefinition(); var genericType = service.GetGenericTypeDefinition();
var genericArguments = genericType.GetGenericArguments(); var genericArguments = genericType.GetGenericArguments();
if (!genericArguments.Any())
{
return Enumerable.Empty<IBinding>();
}
if (genericArguments.Length == 1 && genericArguments.Single().GenericParameterAttributes.HasFlag(GenericParameterAttributes.Contravariant)) if (genericArguments.Length == 1 && genericArguments.Single().GenericParameterAttributes.HasFlag(GenericParameterAttributes.Contravariant))
{ {
var argument = service.GetGenericArguments().Single(); var argument = service.GetGenericArguments().Single();

@ -25,7 +25,7 @@
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Diagnostics;
using Ninject; using Ninject;
using Ninject.Planning.Bindings.Resolvers; using Ninject.Planning.Bindings.Resolvers;
@ -47,13 +47,24 @@ namespace PlexRequests.UI
{ {
try try
{ {
Debug.WriteLine("Starting StartupConfiguration");
var resolver = new DependancyResolver(); var resolver = new DependancyResolver();
Debug.WriteLine("Created DI Resolver");
var modules = resolver.GetModules(); var modules = resolver.GetModules();
Debug.WriteLine("Getting all the modules");
Debug.WriteLine("Modules found finished.");
var kernel = new StandardKernel(modules); var kernel = new StandardKernel(modules);
Debug.WriteLine("Created Kernel and Injected Modules");
Debug.WriteLine("Added Contravariant Binder");
kernel.Components.Add<IBindingResolver, ContravariantBindingResolver>(); kernel.Components.Add<IBindingResolver, ContravariantBindingResolver>();
Debug.WriteLine("Start the bootstrapper with the Kernel.ı");
app.UseNancy(options => options.Bootstrapper = new Bootstrapper(kernel)); app.UseNancy(options => options.Bootstrapper = new Bootstrapper(kernel));
Debug.WriteLine("Finished bootstrapper");
var scheduler = new Scheduler(); var scheduler = new Scheduler();
scheduler.StartScheduler(); scheduler.StartScheduler();
} }

Loading…
Cancel
Save