jellyfin-server/Emby.Dlna/Server/UpnpDevice.cs

39 lines
962 B
C#
Raw Normal View History

2016-10-29 22:22:20 +00:00
using System;
using System.Net;
2016-11-04 08:31:05 +00:00
using MediaBrowser.Model.Net;
2016-10-29 22:22:20 +00:00
2016-10-29 22:34:54 +00:00
namespace Emby.Dlna.Server
2016-10-29 22:22:20 +00:00
{
public sealed class UpnpDevice
{
public readonly Uri Descriptor;
public readonly string Type;
public readonly string USN;
public readonly string Uuid;
2016-11-04 08:31:05 +00:00
public readonly IpAddressInfo Address;
2016-10-29 22:22:20 +00:00
2016-11-04 08:31:05 +00:00
public UpnpDevice(string aUuid, string aType, Uri aDescriptor, IpAddressInfo address)
2016-10-29 22:22:20 +00:00
{
Uuid = aUuid;
Type = aType;
Descriptor = aDescriptor;
Address = address;
USN = CreateUSN(aUuid, aType);
}
private static string CreateUSN(string aUuid, string aType)
{
if (aType.StartsWith("uuid:", StringComparison.OrdinalIgnoreCase))
{
return aType;
}
else
{
return String.Format("uuid:{0}::{1}", aUuid, aType);
}
}
}
}