skyscraper8/skyscraper8/Skyscraper/Scraper/Storage/Utilities/DatabaseKeyNipMulticastGatewayConfigurationTransportSession.cs
feyris-tan 0e3c138a1e
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 8s
Patches for Voile to display contents from DVB-NIP file deliveries.
2026-03-13 22:27:13 +01:00

68 lines
2.0 KiB
C#

using skyscraper8.DvbNip;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.Skyscraper.Scraper.Storage.Utilities
{
public class DatabaseKeyNipMulticastGatewayConfigurationTransportSession
{
public DatabaseKeyNipMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType address)
{
this.CarrierId = carrier.NipCarrierId;
this.LinkId = carrier.NipLinkId;
this.NetworkId = carrier.NipNetworkId;
this.ServiceId = carrier.NipServiceId;
if (!string.IsNullOrEmpty(address.NetworkSourceAddress))
{
this.SourceAddress = IPAddress.Parse(address.NetworkSourceAddress);
}
this.DestinationAddress = IPAddress.Parse(address.NetworkDestinationGroupAddress);
this.DestinationPort = ushort.Parse(address.TransportDestinationPort);
this.TSI = long.Parse(address.MediaTransportSessionIdentifier);
}
public long TSI { get; set; }
public ushort DestinationPort { get; set; }
public IPAddress DestinationAddress { get; set; }
public IPAddress SourceAddress { get; set; }
public ushort ServiceId { get; set; }
public ushort NetworkId { get; set; }
public ushort LinkId { get; set; }
public ushort CarrierId { get; set; }
public override bool Equals(object? obj)
{
return obj is DatabaseKeyNipMulticastGatewayConfigurationTransportSession session &&
TSI == session.TSI &&
DestinationPort == session.DestinationPort &&
EqualityComparer<IPAddress>.Default.Equals(DestinationAddress, session.DestinationAddress) &&
EqualityComparer<IPAddress>.Default.Equals(SourceAddress, session.SourceAddress) &&
ServiceId == session.ServiceId &&
NetworkId == session.NetworkId &&
LinkId == session.LinkId &&
CarrierId == session.CarrierId;
}
public override int GetHashCode()
{
return HashCode.Combine(TSI, DestinationPort, DestinationAddress, SourceAddress, ServiceId, NetworkId, LinkId, CarrierId);
}
}
}