mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
37 lines
924 B
C#
37 lines
924 B
C#
using System;
|
|
using System.Net;
|
|
|
|
namespace Emby.Dlna.Server
|
|
{
|
|
public sealed class UpnpDevice
|
|
{
|
|
public readonly Uri Descriptor;
|
|
public readonly string Type;
|
|
public readonly string USN;
|
|
public readonly string Uuid;
|
|
public readonly IPAddress Address;
|
|
|
|
public UpnpDevice(string aUuid, string aType, Uri aDescriptor, IPAddress address)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|