skyscraper8/skyscraper8/DvbNip/NipActualCarrierInformation.cs
2025-06-21 20:57:07 +02:00

49 lines
1.4 KiB
C#

using skyscraper5.Skyscraper.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.DvbNip
{
public class NipActualCarrierInformation
{
public NipActualCarrierInformation(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer, false);
NipNetworkId = ms.ReadUInt16BE();
NipCarrierId = ms.ReadUInt16BE();
NipLinkId = ms.ReadUInt16BE();
NipServiceId = ms.ReadUInt16BE();
byte reserved = ms.ReadUInt8();
byte length = ms.ReadUInt8();
NipStreamProviderName = Encoding.UTF8.GetString(ms.ReadBytes(length));
}
public ushort NipNetworkId { get; }
public ushort NipCarrierId { get; }
public ushort NipLinkId { get; }
public ushort NipServiceId { get; }
public string NipStreamProviderName { get; }
protected bool Equals(NipActualCarrierInformation other)
{
return NipNetworkId == other.NipNetworkId && NipCarrierId == other.NipCarrierId && NipLinkId == other.NipLinkId && NipServiceId == other.NipServiceId;
}
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((NipActualCarrierInformation)obj);
}
public override int GetHashCode()
{
return HashCode.Combine(NipNetworkId, NipCarrierId, NipLinkId, NipServiceId);
}
}
}