From 1ba959298b0d273742a9d582baff62137913c907 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 11 Oct 2011 19:24:43 -0700 Subject: [PATCH] Added BuildDateTime to central dispatch --- NzbDrone.Core.Test/CentralDispatchTest.cs | 6 ++++++ NzbDrone.Core/CentralDispatch.cs | 14 +++++++++++++- NzbDrone/CentralDispatch.cs | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core.Test/CentralDispatchTest.cs b/NzbDrone.Core.Test/CentralDispatchTest.cs index 3df09023d..2b670fdfe 100644 --- a/NzbDrone.Core.Test/CentralDispatchTest.cs +++ b/NzbDrone.Core.Test/CentralDispatchTest.cs @@ -90,5 +90,11 @@ namespace NzbDrone.Core.Test { CentralDispatch.Version.Should().NotBeNull(); } + + [Test] + public void BuildDate_should_be_today() + { + CentralDispatch.BuildDateTime.Should().BeWithin(TimeSpan.FromHours(10)); + } } } diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 6eccb3a2c..c458bb02a 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -29,6 +29,17 @@ namespace NzbDrone.Core get { return Assembly.GetExecutingAssembly().GetName().Version; } } + + public static DateTime BuildDateTime + { + get + { + var fileLocation = Assembly.GetCallingAssembly().Location; + return new FileInfo(fileLocation).CreationTime; + } + + } + public static String AppPath { get @@ -53,12 +64,13 @@ namespace NzbDrone.Core } } + public static void InitializeApp() { BindKernel(); MigrationsHelper.Run(Connection.MainConnectionString, true); - + LogConfiguration.StartDbLogging(); _kernel.Get().SetupDefaultProfiles(); diff --git a/NzbDrone/CentralDispatch.cs b/NzbDrone/CentralDispatch.cs index a0a55dfd4..bc2df874f 100644 --- a/NzbDrone/CentralDispatch.cs +++ b/NzbDrone/CentralDispatch.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; +using NLog; using Ninject; using NzbDrone.Model; using NzbDrone.Providers; @@ -12,6 +13,7 @@ namespace NzbDrone public static class CentralDispatch { private static StandardKernel _kernel; + private static readonly Logger Logger = LogManager.GetLogger("Host.CentralDispatch"); static CentralDispatch() {