aboutsummaryrefslogtreecommitdiff
path: root/Emby.Dlna/PlayTo/Device.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Dlna/PlayTo/Device.cs')
-rw-r--r--Emby.Dlna/PlayTo/Device.cs73
1 files changed, 20 insertions, 53 deletions
diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs
index 13bed6b2fd..68aa0a6a71 100644
--- a/Emby.Dlna/PlayTo/Device.cs
+++ b/Emby.Dlna/PlayTo/Device.cs
@@ -1,21 +1,17 @@
-using MediaBrowser.Common.Net;
-using MediaBrowser.Controller.Configuration;
-using Emby.Dlna.Common;
-using Emby.Dlna.Ssdp;
-using Microsoft.Extensions.Logging;
-using MediaBrowser.Model.Net;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using System.Net;
-using System.Security;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
+using Emby.Dlna.Common;
using Emby.Dlna.Server;
+using Emby.Dlna.Ssdp;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Threading;
-using MediaBrowser.Model.Extensions;
+using Microsoft.Extensions.Logging;
namespace Emby.Dlna.PlayTo
{
@@ -39,10 +35,7 @@ namespace Emby.Dlna.PlayTo
RefreshVolumeIfNeeded();
return _volume;
}
- set
- {
- _volume = value;
- }
+ set => _volume = value;
}
public TimeSpan? Duration { get; set; }
@@ -50,41 +43,17 @@ namespace Emby.Dlna.PlayTo
private TimeSpan _position = TimeSpan.FromSeconds(0);
public TimeSpan Position
{
- get
- {
- return _position;
- }
- set
- {
- _position = value;
- }
+ get => _position;
+ set => _position = value;
}
public TRANSPORTSTATE TransportState { get; private set; }
- public bool IsPlaying
- {
- get
- {
- return TransportState == TRANSPORTSTATE.PLAYING;
- }
- }
+ public bool IsPlaying => TransportState == TRANSPORTSTATE.PLAYING;
- public bool IsPaused
- {
- get
- {
- return TransportState == TRANSPORTSTATE.PAUSED || TransportState == TRANSPORTSTATE.PAUSED_PLAYBACK;
- }
- }
+ public bool IsPaused => TransportState == TRANSPORTSTATE.PAUSED || TransportState == TRANSPORTSTATE.PAUSED_PLAYBACK;
- public bool IsStopped
- {
- get
- {
- return TransportState == TRANSPORTSTATE.STOPPED;
- }
- }
+ public bool IsStopped => TransportState == TRANSPORTSTATE.STOPPED;
#endregion
@@ -311,7 +280,7 @@ namespace Emby.Dlna.PlayTo
throw new InvalidOperationException("Unable to find service");
}
- await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, String.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
+ await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, string.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
.ConfigureAwait(false);
RestartTimer(true);
@@ -364,7 +333,7 @@ namespace Emby.Dlna.PlayTo
private string CreateDidlMeta(string value)
{
if (string.IsNullOrEmpty(value))
- return String.Empty;
+ return string.Empty;
return DescriptionXmlBuilder.Escape(value);
}
@@ -620,9 +589,7 @@ namespace Emby.Dlna.PlayTo
if (transportStateValue != null)
{
- TRANSPORTSTATE state;
-
- if (Enum.TryParse(transportStateValue, true, out state))
+ if (Enum.TryParse(transportStateValue, true, out TRANSPORTSTATE state))
{
return state;
}
@@ -739,7 +706,7 @@ namespace Emby.Dlna.PlayTo
if (track == null)
{
- //If track is null, some vendors do this, use GetMediaInfo instead
+ //If track is null, some vendors do this, use GetMediaInfo instead
return new Tuple<bool, uBaseObject>(true, null);
}
@@ -783,7 +750,7 @@ namespace Emby.Dlna.PlayTo
{
if (container == null)
{
- throw new ArgumentNullException("container");
+ throw new ArgumentNullException(nameof(container));
}
var url = container.GetValue(uPnpNamespaces.Res);
@@ -810,7 +777,7 @@ namespace Emby.Dlna.PlayTo
{
if (container == null)
{
- throw new ArgumentNullException("container");
+ throw new ArgumentNullException(nameof(container));
}
var resElement = container.Element(uPnpNamespaces.Res);
@@ -979,7 +946,7 @@ namespace Emby.Dlna.PlayTo
if (modelDescription != null)
deviceProperties.ModelDescription = modelDescription.Value;
- deviceProperties.BaseUrl = String.Format("http://{0}:{1}", url.Host, url.Port);
+ deviceProperties.BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port);
var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();
@@ -1021,7 +988,7 @@ namespace Emby.Dlna.PlayTo
{
if (element == null)
{
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
}
var mimeType = element.GetDescendantValue(uPnpNamespaces.ud.GetName("mimetype"));
@@ -1173,7 +1140,7 @@ namespace Emby.Dlna.PlayTo
public override string ToString()
{
- return String.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
+ return string.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
}
}
}