jellyfin/MediaBrowser.Dlna/Server/UpnpDevice.cs

38 lines
932 B
C#
Raw Normal View History

2014-03-24 12:47:39 +00:00
using System;
2014-04-10 15:06:54 +00:00
using System.Net;
2014-03-24 12:47:39 +00:00
namespace MediaBrowser.Dlna.Server
{
public sealed class UpnpDevice
{
public readonly Uri Descriptor;
public readonly string Type;
public readonly string USN;
public readonly string Uuid;
2014-04-10 15:06:54 +00:00
public readonly IPAddress Address;
2014-03-24 12:47:39 +00:00
public UpnpDevice(string aUuid, string aType, Uri aDescriptor, IPAddress address)
2014-03-24 12:47:39 +00:00
{
Uuid = aUuid;
Type = aType;
Descriptor = aDescriptor;
2014-04-10 15:06:54 +00:00
Address = address;
2016-03-26 17:51:27 +00:00
USN = CreateUSN(aUuid, aType);
}
private static string CreateUSN(string aUuid, string aType)
{
if (aType.StartsWith("uuid:", StringComparison.OrdinalIgnoreCase))
2014-03-24 12:47:39 +00:00
{
2016-03-26 17:51:27 +00:00
return aType;
2014-03-24 12:47:39 +00:00
}
else
{
2016-03-26 17:51:27 +00:00
return String.Format("uuid:{0}::{1}", aUuid, aType);
2014-03-24 12:47:39 +00:00
}
}
}
}