From 5b3f0bdffef6b56c98c44107cd248362301e926a Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 27 Oct 2011 22:13:56 -0700 Subject: [PATCH] Added google analytics. (only enabled in production) --- NzbDrone.6.0.ReSharper | 2 +- NzbDrone.Common/EnviromentProvider.cs | 29 +++++++++++++++--------- NzbDrone.Web/NzbDrone.Web.csproj | 4 ++++ NzbDrone.Web/Views/Shared/_Layout.cshtml | 19 ++++++++++++++-- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/NzbDrone.6.0.ReSharper b/NzbDrone.6.0.ReSharper index c4e417d31..04c374209 100644 --- a/NzbDrone.6.0.ReSharper +++ b/NzbDrone.6.0.ReSharper @@ -97,7 +97,7 @@ $object$_On$event$ $event$Handler - + diff --git a/NzbDrone.Common/EnviromentProvider.cs b/NzbDrone.Common/EnviromentProvider.cs index 60dd21a52..f06208e8e 100644 --- a/NzbDrone.Common/EnviromentProvider.cs +++ b/NzbDrone.Common/EnviromentProvider.cs @@ -7,23 +7,20 @@ namespace NzbDrone.Common { public class EnviromentProvider { - public virtual String LogPath - { - get { return Environment.CurrentDirectory; } - } - public virtual bool IsUserInteractive - { - get { return Environment.UserInteractive; } - } +#if DEBUG + private static readonly bool isInDebug = true; +#else + private static readonly bool isInDebug = false; +#endif + + private static readonly string processName = Process.GetCurrentProcess().ProcessName.ToLower(); public static bool IsProduction { get { - if (Debugger.IsAttached) return false; - - var processName = Process.GetCurrentProcess().ProcessName.ToLower(); + if (isInDebug || Debugger.IsAttached) return false; Console.WriteLine(processName); if (processName.Contains("nunit")) return false; @@ -34,6 +31,16 @@ namespace NzbDrone.Common } } + public virtual String LogPath + { + get { return Environment.CurrentDirectory; } + } + + public virtual bool IsUserInteractive + { + get { return Environment.UserInteractive; } + } + public virtual string ApplicationPath { get diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 810f1e238..d5dddc9ea 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -733,6 +733,10 @@ + + {F2BE0FDF-6E47-4827-A420-DD4EF82407F8} + NzbDrone.Common + {FF5EE3B6-913B-47CE-9CEB-11C51B4E1205} NzbDrone.Core diff --git a/NzbDrone.Web/Views/Shared/_Layout.cshtml b/NzbDrone.Web/Views/Shared/_Layout.cshtml index 029e1a298..ddffb4ded 100644 --- a/NzbDrone.Web/Views/Shared/_Layout.cshtml +++ b/NzbDrone.Web/Views/Shared/_Layout.cshtml @@ -1,5 +1,6 @@  @using Helpers; +@using NzbDrone.Common @@ -16,7 +17,6 @@ - @@ -30,7 +30,6 @@ - @MvcMiniProfiler.MiniProfiler.RenderIncludes() @RenderSection("HeaderContent", required: false) @@ -72,5 +71,21 @@ @(Html.Telerik().ScriptRegistrar().jQuery(false)) @RenderSection("Scripts", required: false) + @if (EnviromentProvider.IsProduction) + { + + }