diff --git a/FoundationV3/FiftyOne.Foundation 4.project.lock.json b/FoundationV3/FiftyOne.Foundation 4.project.lock.json index c2707bb..7c90e34 100644 --- a/FoundationV3/FiftyOne.Foundation 4.project.lock.json +++ b/FoundationV3/FiftyOne.Foundation 4.project.lock.json @@ -10,8 +10,5 @@ ".NETFramework,Version=v4.0": [] }, "tools": {}, - "projectFileToolGroups": {}, - "packageFolders": { - "C:\\Users\\Stephen\\.nuget\\packages\\": {} - } -} \ No newline at end of file + "projectFileToolGroups": {} +} diff --git a/FoundationV3/Mobile/Detection/Feature/Bandwidth.cs b/FoundationV3/Mobile/Detection/Feature/Bandwidth.cs index 74a5e20..1cef809 100644 --- a/FoundationV3/Mobile/Detection/Feature/Bandwidth.cs +++ b/FoundationV3/Mobile/Detection/Feature/Bandwidth.cs @@ -291,10 +291,16 @@ internal int AverageBandwidth #endregion - #region HttpModule Events + #region Fields + /// + /// True if bandwidth monitoring is enabled. + /// + private static bool? _enabled; + #endregion + #region HttpModule Events /// - /// Set a property in the application state to quickly determine if bandwidth monitoring + /// Set a static field to quickly determine if bandwidth monitoring /// is supported by the data set. /// /// @@ -303,14 +309,14 @@ internal static void Init(HttpApplicationState application) if (Configuration.Manager.BandwidthMonitoringEnabled == false || WebProvider.ActiveProvider == null) { - application["51D_Bandwidth"] = new bool?(false); + _enabled = false; } else { var property = WebProvider.ActiveProvider.DataSet.Properties["JavascriptBandwidth"]; - application["51D_Bandwidth"] = new bool?(property != null); + _enabled = property != null; } - EventLog.Debug(String.Format("Bandwidth monitoring '{0}'", application["51D_Bandwidth"])); + EventLog.Debug(String.Format("Bandwidth monitoring '{0}'", _enabled)); } /// @@ -451,15 +457,14 @@ internal static void PostRequestHandlerExecute(HttpContext context) } /// - /// Determines if the feature is enabled based on the information - /// written to the application when initialised. + /// Determines if the feature is enabled based on configuration + /// when initialised. /// /// /// internal static bool GetIsEnabled(HttpContext context) { - var enabled = context.Application["51D_Bandwidth"] as bool?; - if (enabled.HasValue && enabled.Value) + if (_enabled.HasValue && _enabled.Value) { // If the bandwidth javascript is present for this device then it's enabled. var javascript = GetJavascriptValues(context.Request); diff --git a/FoundationV3/Mobile/Detection/Feature/ImageOptimiser.cs b/FoundationV3/Mobile/Detection/Feature/ImageOptimiser.cs index fc67655..f4b3d97 100644 --- a/FoundationV3/Mobile/Detection/Feature/ImageOptimiser.cs +++ b/FoundationV3/Mobile/Detection/Feature/ImageOptimiser.cs @@ -47,15 +47,29 @@ internal class ImageOptimiser private const string AUTO_STRING = "auto"; /// - /// Set a property in the application state to quickly determine if image optimisation + /// True if image optimiser is enabled. + /// + private static bool? _enabled; + + /// + /// Get or set the enabled flag against the image optimisation service + /// + public static bool Enabled + { + get { return _enabled ?? false; } + set { _enabled = value; } + } + + /// + /// Set a static field to quickly determine if image optimisation /// is supported by the data set. /// /// internal static void Init(HttpApplicationState application) { - application["51D_ImageOptimiser"] = new bool?(Manager.ImageOptimisation.Enabled && - WebProvider.ActiveProvider != null); - EventLog.Debug(String.Format("Image Optimisation '{0}'", application["51D_ImageOptimiser"])); + _enabled = Manager.ImageOptimisation.Enabled && + WebProvider.ActiveProvider != null; + EventLog.Debug(String.Format("Image Optimisation '{0}'", _enabled)); } /// @@ -126,28 +140,26 @@ private static Values GetJavascriptValues(HttpRequest request) } /// - /// Determines if the feature is enabled based on the information - /// written to the application when initialised. + /// Determines if the feature is enabled based on configuration + /// when initialised. /// /// /// internal static bool GetIsEnabled(HttpContext context) { - var enabled = context.Application["51D_ImageOptimiser"] as bool?; - return enabled.HasValue && enabled.Value; + return _enabled.HasValue && _enabled.Value; } /// - /// Determines if the feature is enabled based on the information - /// written to the application when initialised and the presence of - /// image optimiser java script in the detected device results. + /// Determines if the feature is enabled based on configuration + /// when initialised and the presence of image optimiser + /// Java script in the detected device results. /// /// /// internal static bool GetIsJavaScriptEnabled(HttpContext context) { - var enabled = context.Application["51D_ImageOptimiser"] as bool?; - if (enabled.HasValue && enabled.Value) + if (_enabled.HasValue && _enabled.Value) { // If the image optimiser javascript is present for this device then it's enabled. return GetJavascriptValues(context.Request) != null; diff --git a/FoundationV3/Mobile/Detection/Feature/ProfileOverride.cs b/FoundationV3/Mobile/Detection/Feature/ProfileOverride.cs index f9fb97a..c5653fd 100644 --- a/FoundationV3/Mobile/Detection/Feature/ProfileOverride.cs +++ b/FoundationV3/Mobile/Detection/Feature/ProfileOverride.cs @@ -37,7 +37,12 @@ internal static class ProfileOverride private static readonly char[] _split = new char[] { '|' }; /// - /// Set a property in the application state to quickly determine if profile + /// True if profile overrides are enabled. + /// + private static bool? _enabled; + + /// + /// Set a static field to quickly determine if profile /// override is supported. /// /// @@ -46,15 +51,15 @@ internal static void Init(HttpApplicationState application) if (Configuration.Manager.FeatureDetectionEnabled == false || WebProvider.ActiveProvider == null) { - application[Constants.ProfileOverrideCookieName] = new bool?(false); + _enabled = false; } else { var property = WebProvider.ActiveProvider.DataSet.Properties.FirstOrDefault(i => i.Name == "JavascriptHardwareProfile"); - application[Constants.ProfileOverrideCookieName] = new bool?(property != null); + _enabled = property != null; } - EventLog.Debug(String.Format("Profile Override '{0}'", application[Constants.ProfileOverrideCookieName])); + EventLog.Debug(String.Format("Profile Override '{0}'", _enabled)); } /// @@ -96,15 +101,14 @@ internal static string GetJavascript(HttpContext context) } /// - /// Determines if the feature is enabled based on the information - /// written to the application when initialised. + /// Determines if the feature is enabled based on configuration + /// when initialised. /// /// /// private static bool GetIsEnabled(HttpContext context) { - var enabled = context.Application[Constants.ProfileOverrideCookieName] as bool?; - if (enabled.HasValue && enabled.Value) + if (_enabled.HasValue && _enabled.Value) { // If the profile javascript is present for this device then it's enabled. return GetJavascriptValues(context.Request) != null; diff --git a/FoundationV3/Mobile/Detection/Feature/PropertyValueOverride.cs b/FoundationV3/Mobile/Detection/Feature/PropertyValueOverride.cs index 2b0b943..0b7eada 100644 --- a/FoundationV3/Mobile/Detection/Feature/PropertyValueOverride.cs +++ b/FoundationV3/Mobile/Detection/Feature/PropertyValueOverride.cs @@ -31,10 +31,17 @@ namespace FiftyOne.Foundation.Mobile.Detection.Feature { internal static class PropertyValueOverride { + #region Fields + /// + /// True if profile overrides are enabled. + /// + private static bool? _enabled; + #endregion + #region Internal Methods /// - /// Set a property in the application state to quickly determine if property + /// Set a static field to quickly determine if property /// value override is supported. /// /// @@ -43,18 +50,15 @@ internal static void Init(HttpApplicationState application) if (Configuration.Manager.FeatureDetectionEnabled == false || WebProvider.ActiveProvider == null) { - application[Constants.PropertyValueOverrideFlag] = - new bool?(false); + _enabled = false; } else { - application[Constants.PropertyValueOverrideFlag] = new bool?( - WebProvider.GetActiveProvider().DataSet. - PropertyValueOverrideProperties.Length > 0); + _enabled = WebProvider.GetActiveProvider().DataSet. + PropertyValueOverrideProperties.Length > 0; } EventLog.Debug(String.Format( - "Property Value Override '{0}'", - application[Constants.PropertyValueOverrideFlag])); + "Property Value Override '{0}'", _enabled)); } /// @@ -64,8 +68,7 @@ internal static void Init(HttpApplicationState application) /// JavaScript for the device, otherwise null. internal static string GetJavascript(HttpContext context) { - var enabled = context.Application[Constants.PropertyValueOverrideFlag] as bool?; - if (enabled.HasValue && enabled.Value) + if (_enabled.HasValue && _enabled.Value) { var jsvalues = GetJavascriptValues(context.Request); if (jsvalues.Count > 0) diff --git a/FoundationV3/Properties/AssemblyInfo.cs b/FoundationV3/Properties/AssemblyInfo.cs index ea25250..36ba331 100644 --- a/FoundationV3/Properties/AssemblyInfo.cs +++ b/FoundationV3/Properties/AssemblyInfo.cs @@ -47,7 +47,7 @@ // Build Number // Revision -[assembly: AssemblyVersion("3.2.18.2")] -[assembly: AssemblyFileVersion("3.2.18.2")] +[assembly: AssemblyVersion("3.2.19.2")] +[assembly: AssemblyFileVersion("3.2.19.2")] [assembly: NeutralResourcesLanguage("en-GB")] [assembly: AllowPartiallyTrustedCallers] diff --git a/FoundationV3/Properties/DetectionConstants.cs b/FoundationV3/Properties/DetectionConstants.cs index c7b7bf8..e803616 100644 --- a/FoundationV3/Properties/DetectionConstants.cs +++ b/FoundationV3/Properties/DetectionConstants.cs @@ -117,6 +117,7 @@ public static class Constants #region Internal Constants +#if !SQL_BUILD && !NETCORE_BUILD /// /// The name of the category /// @@ -125,7 +126,8 @@ public static class Constants /// methods must be assigned. /// internal const string PropertyValueOverrideCategory = "Property Value Override"; - +#endif + /// /// Used to split up a cookie string. /// diff --git a/FoundationV3/UI/Web/ShareUsage.cs b/FoundationV3/UI/Web/ShareUsage.cs index bfbc8fb..ad0a947 100644 --- a/FoundationV3/UI/Web/ShareUsage.cs +++ b/FoundationV3/UI/Web/ShareUsage.cs @@ -21,6 +21,7 @@ * defined by the Mozilla Public License, v. 2.0. * ********************************************************************* */ +using FiftyOne.Foundation.Mobile.Detection.Feature; using System; using System.Web.UI.WebControls; @@ -422,10 +423,7 @@ private void _checkBoxImageOptimiser_CheckedChanged(object sender, EventArgs e) try { FiftyOne.Foundation.Mobile.Configuration.Manager.ImageOptimisation.Enabled = _checkBoxImageOptimiser.Checked; - - - - Context.Application["51D_ImageOptimiser"] = _checkBoxImageOptimiser.Checked; + ImageOptimiser.Enabled = _checkBoxImageOptimiser.Checked; message = String.Format( _checkBoxImageOptimiser.Checked ? diff --git a/README.md b/README.md index def7726..2044de2 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,10 @@ Data files which are updated weekly and daily, automatically, and with more prop ## Recent Changes -### Version 3.2.18 Highlights +### Version 3.2.19 Highlights -* Updated Lite data files for Sept 2017 -* Updates to patent notification text +* ASP.NET integration features such as bandwidth monitoring and profile overrides previously stored their 'enabled' setting in HttpApplicationState. This uses a lot of locking which could cause problems in highly concurrent web applications. The setting will now be stored in a static field instead. +* Updated the Lite Binary files for November 2017. ### Major Changes in Version 3.2 diff --git a/data/51Degrees-LiteV3.1.dat b/data/51Degrees-LiteV3.1.dat index a6909eb..2b21016 100644 --- a/data/51Degrees-LiteV3.1.dat +++ b/data/51Degrees-LiteV3.1.dat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:94e70a2b68f0f61e93d9d194aa27f9baa50f6150e1870f55ed7e178941c38c0d -size 90971408 +oid sha256:2a9373524332b3e9ab4af6de5b14ebbfea6975fa628266359168f4844ee56b49 +size 94316180 diff --git a/data/51Degrees-LiteV3.2.dat b/data/51Degrees-LiteV3.2.dat index 8a33d63..974aecd 100644 --- a/data/51Degrees-LiteV3.2.dat +++ b/data/51Degrees-LiteV3.2.dat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:784af8f81286795602f308649462ef44afcf5d75c06d470d435f4ef8647bfa18 -size 77793223 +oid sha256:cf3dbd20a33f356c98abb448eca89525d943a2008e0b28ed529d255a2877c4ff +size 79295482