From 2ca4b7d03adfa3cc7c9c6a597a11762142d5b34b Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 4 Mar 2013 00:43:06 -0500 Subject: Created IConfigurationManager --- .../Localization/LocalizedStrings.cs | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Controller/Localization/LocalizedStrings.cs') diff --git a/MediaBrowser.Controller/Localization/LocalizedStrings.cs b/MediaBrowser.Controller/Localization/LocalizedStrings.cs index 0d583641b..c7f4755b7 100644 --- a/MediaBrowser.Controller/Localization/LocalizedStrings.cs +++ b/MediaBrowser.Controller/Localization/LocalizedStrings.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.Logging; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Model.Logging; using System; using System.Collections.Concurrent; using System.Globalization; @@ -14,10 +15,8 @@ namespace MediaBrowser.Controller.Localization /// public class LocalizedStrings { - /// - /// The logger - /// - static internal ILogger Logger { get; set; } + internal static IServerApplicationPaths ApplicationPaths; + /// /// The base prefix /// @@ -31,17 +30,21 @@ namespace MediaBrowser.Controller.Localization /// private static LocalizedStrings _instance; + private IServerApplicationPaths _appPaths; + /// /// Gets the instance. /// /// The instance. - public static LocalizedStrings Instance { get { return _instance ?? (_instance = new LocalizedStrings()); } } + public static LocalizedStrings Instance { get { return _instance ?? (_instance = new LocalizedStrings(ApplicationPaths)); } } /// /// Initializes a new instance of the class. /// - public LocalizedStrings() + public LocalizedStrings(IServerApplicationPaths appPaths) { + _appPaths = appPaths; + foreach (var stringObject in Kernel.Instance.StringFiles) { AddStringData(LoadFromFile(GetFileName(stringObject),stringObject.GetType())); @@ -55,7 +58,7 @@ namespace MediaBrowser.Controller.Localization /// System.String. protected string GetFileName(LocalizedStringData stringObject) { - var path = Kernel.Instance.ApplicationPaths.LocalizationPath; + var path = _appPaths.LocalizationPath; var name = Path.Combine(path, stringObject.Prefix + "strings-" + CultureInfo.CurrentCulture + ".xml"); if (File.Exists(name)) { @@ -125,17 +128,17 @@ namespace MediaBrowser.Controller.Localization } catch (TargetException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } catch (FieldAccessException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } catch (NotSupportedException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } -- cgit v1.2.3