diff options
Diffstat (limited to 'Emby.Server.Implementations/Configuration')
| -rw-r--r-- | Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs index 2291345be..4def7ca40 100644 --- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs +++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Globalization; using System.IO; using Emby.Server.Implementations.AppBase; using MediaBrowser.Common.Configuration; @@ -17,7 +19,6 @@ namespace Emby.Server.Implementations.Configuration /// </summary> public class ServerConfigurationManager : BaseConfigurationManager, IServerConfigurationManager { - /// <summary> /// Initializes a new instance of the <see cref="ServerConfigurationManager" /> class. /// </summary> @@ -31,6 +32,9 @@ namespace Emby.Server.Implementations.Configuration UpdateMetadataPath(); } + /// <summary> + /// Configuration updating event. + /// </summary> public event EventHandler<GenericEventArgs<ServerConfiguration>> ConfigurationUpdating; /// <summary> @@ -97,7 +101,7 @@ namespace Emby.Server.Implementations.Configuration /// Validates the SSL certificate. /// </summary> /// <param name="newConfig">The new configuration.</param> - /// <exception cref="DirectoryNotFoundException"></exception> + /// <exception cref="FileNotFoundException">The certificate path doesn't exist.</exception> private void ValidateSslCertificate(BaseApplicationConfiguration newConfig) { var serverConfig = (ServerConfiguration)newConfig; @@ -105,12 +109,16 @@ namespace Emby.Server.Implementations.Configuration var newPath = serverConfig.CertificatePath; if (!string.IsNullOrWhiteSpace(newPath) - && !string.Equals(Configuration.CertificatePath ?? string.Empty, newPath)) + && !string.Equals(Configuration.CertificatePath, newPath, StringComparison.Ordinal)) { // Validate if (!File.Exists(newPath)) { - throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", newPath)); + throw new FileNotFoundException( + string.Format( + CultureInfo.InvariantCulture, + "Certificate file '{0}' does not exist.", + newPath)); } } } @@ -119,24 +127,32 @@ namespace Emby.Server.Implementations.Configuration /// Validates the metadata path. /// </summary> /// <param name="newConfig">The new configuration.</param> - /// <exception cref="DirectoryNotFoundException"></exception> + /// <exception cref="DirectoryNotFoundException">The new config path doesn't exist.</exception> private void ValidateMetadataPath(ServerConfiguration newConfig) { var newPath = newConfig.MetadataPath; if (!string.IsNullOrWhiteSpace(newPath) - && !string.Equals(Configuration.MetadataPath ?? string.Empty, newPath)) + && !string.Equals(Configuration.MetadataPath, newPath, StringComparison.Ordinal)) { // Validate if (!Directory.Exists(newPath)) { - throw new FileNotFoundException(string.Format("{0} does not exist.", newPath)); + throw new DirectoryNotFoundException( + string.Format( + CultureInfo.InvariantCulture, + "{0} does not exist.", + newPath)); } EnsureWriteAccess(newPath); } } + /// <summary> + /// Sets all config values to the optimal value. + /// </summary> + /// <returns>If the configuration changed.</returns> public bool SetOptimalValues() { var config = Configuration; |
