diff options
Diffstat (limited to 'Emby.Server.Implementations/Serialization/JsonSerializer.cs')
| -rw-r--r-- | Emby.Server.Implementations/Serialization/JsonSerializer.cs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs index e28acd769..d4b6b2f43 100644 --- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs +++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using MediaBrowser.Model.IO; using Microsoft.Extensions.Logging; @@ -32,12 +32,12 @@ namespace Emby.Common.Implementations.Serialization { if (obj == null) { - throw new ArgumentNullException("obj"); + throw new ArgumentNullException(nameof(obj)); } if (stream == null) { - throw new ArgumentNullException("stream"); + throw new ArgumentNullException(nameof(stream)); } ServiceStack.Text.JsonSerializer.SerializeToStream(obj, obj.GetType(), stream); @@ -53,12 +53,12 @@ namespace Emby.Common.Implementations.Serialization { if (obj == null) { - throw new ArgumentNullException("obj"); + throw new ArgumentNullException(nameof(obj)); } if (string.IsNullOrEmpty(file)) { - throw new ArgumentNullException("file"); + throw new ArgumentNullException(nameof(file)); } using (Stream stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) @@ -67,7 +67,7 @@ namespace Emby.Common.Implementations.Serialization } } - private Stream OpenFile(string path) + private static Stream OpenFile(string path) { //_logger.LogDebug("Deserializing file {0}", path); return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 131072); @@ -84,12 +84,12 @@ namespace Emby.Common.Implementations.Serialization { if (type == null) { - throw new ArgumentNullException("type"); + throw new ArgumentNullException(nameof(type)); } if (string.IsNullOrEmpty(file)) { - throw new ArgumentNullException("file"); + throw new ArgumentNullException(nameof(file)); } using (Stream stream = OpenFile(file)) @@ -110,7 +110,7 @@ namespace Emby.Common.Implementations.Serialization { if (string.IsNullOrEmpty(file)) { - throw new ArgumentNullException("file"); + throw new ArgumentNullException(nameof(file)); } using (Stream stream = OpenFile(file)) @@ -130,7 +130,7 @@ namespace Emby.Common.Implementations.Serialization { if (stream == null) { - throw new ArgumentNullException("stream"); + throw new ArgumentNullException(nameof(stream)); } return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream); @@ -140,7 +140,7 @@ namespace Emby.Common.Implementations.Serialization { if (stream == null) { - throw new ArgumentNullException("stream"); + throw new ArgumentNullException(nameof(stream)); } @@ -158,7 +158,7 @@ namespace Emby.Common.Implementations.Serialization { if (string.IsNullOrEmpty(text)) { - throw new ArgumentNullException("text"); + throw new ArgumentNullException(nameof(text)); } return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(text); @@ -175,12 +175,12 @@ namespace Emby.Common.Implementations.Serialization { if (stream == null) { - throw new ArgumentNullException("stream"); + throw new ArgumentNullException(nameof(stream)); } if (type == null) { - throw new ArgumentNullException("type"); + throw new ArgumentNullException(nameof(type)); } return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream); @@ -190,12 +190,12 @@ namespace Emby.Common.Implementations.Serialization { if (stream == null) { - throw new ArgumentNullException("stream"); + throw new ArgumentNullException(nameof(stream)); } if (type == null) { - throw new ArgumentNullException("type"); + throw new ArgumentNullException(nameof(type)); } using (var reader = new StreamReader(stream)) @@ -220,7 +220,7 @@ namespace Emby.Common.Implementations.Serialization ServiceStack.Text.JsConfig<Guid>.SerializeFn = SerializeGuid; } - private string SerializeGuid(Guid guid) + private static string SerializeGuid(Guid guid) { if (guid.Equals(Guid.Empty)) { @@ -241,12 +241,12 @@ namespace Emby.Common.Implementations.Serialization { if (string.IsNullOrEmpty(json)) { - throw new ArgumentNullException("json"); + throw new ArgumentNullException(nameof(json)); } if (type == null) { - throw new ArgumentNullException("type"); + throw new ArgumentNullException(nameof(type)); } return ServiceStack.Text.JsonSerializer.DeserializeFromString(json, type); @@ -262,7 +262,7 @@ namespace Emby.Common.Implementations.Serialization { if (obj == null) { - throw new ArgumentNullException("obj"); + throw new ArgumentNullException(nameof(obj)); } return ServiceStack.Text.JsonSerializer.SerializeToString(obj, obj.GetType()); |
