diff --git a/skyscraper8/DvbNip/DvbNipReceiver.cs b/skyscraper8/DvbNip/DvbNipReceiver.cs index dde6ca5..7947aad 100644 --- a/skyscraper8/DvbNip/DvbNipReceiver.cs +++ b/skyscraper8/DvbNip/DvbNipReceiver.cs @@ -379,5 +379,13 @@ namespace skyscraper8.DvbNip { this.sourceHash = sourceHash; } + + public void Reset() + { + bootstrapped = false; + fluteHits = 0; + fluteMisses = 0; + flutes = null; + } } } diff --git a/skyscraper8/DvbNip/DvbNipUtilities.cs b/skyscraper8/DvbNip/DvbNipUtilities.cs index 55a6223..2b5a085 100644 --- a/skyscraper8/DvbNip/DvbNipUtilities.cs +++ b/skyscraper8/DvbNip/DvbNipUtilities.cs @@ -250,5 +250,6 @@ namespace skyscraper8.DvbNip listener.TrimmedLength = stream.Position; return listener; } + } } diff --git a/skyscraper8/Ietf/FLUTE/FLUTE-FDT.cs b/skyscraper8/Ietf/FLUTE/FLUTE-FDT.cs index 61a2fc2..7309031 100644 --- a/skyscraper8/Ietf/FLUTE/FLUTE-FDT.cs +++ b/skyscraper8/Ietf/FLUTE/FLUTE-FDT.cs @@ -12,7 +12,8 @@ // This source code was auto-generated by xsd, Version=4.8.9037.0. // namespace skyscraper8.Ietf.FLUTE { - using System.Xml.Serialization; + using System.ComponentModel; + using System.Xml.Serialization; /// @@ -23,8 +24,9 @@ namespace skyscraper8.Ietf.FLUTE { [System.Xml.Serialization.XmlTypeAttribute(TypeName="FDT-InstanceType", Namespace="urn:IETF:metadata:2005:FLUTE:FDT")] [System.Xml.Serialization.XmlRootAttribute("FDT-Instance", Namespace="urn:IETF:metadata:2005:FLUTE:FDT", IsNullable=false)] public partial class FDTInstanceType { - - private FileType[] fileField; + [TypeConverter(typeof(ExpandableObjectConverter))] + + private FileType[] fileField; private uint schemaVersionField; diff --git a/skyscraper8/Skyscraper/Ini.cs b/skyscraper8/Skyscraper/Ini.cs index 89d2eae..35ae392 100644 --- a/skyscraper8/Skyscraper/Ini.cs +++ b/skyscraper8/Skyscraper/Ini.cs @@ -169,6 +169,18 @@ namespace skyscraper5.Skyscraper IniSection section = this[category]; section[key] = value.ToString(CultureInfo.InvariantCulture); } + + public static void WriteIniValue(FileInfo outputIni, string category, string key, string value) + { + Ini ini; + if (outputIni.Exists) + ini = new Ini(outputIni.FullName); + else + ini = new Ini(); + + ini.WriteValue(category, key, value); + ini.Export(outputIni); + } } public class IniSection : Dictionary diff --git a/skyscraper8/Skyscraper/Net/Pcap/PcapIpTrafficHandler.cs b/skyscraper8/Skyscraper/Net/Pcap/PcapIpTrafficHandler.cs index b2faa0b..8edc4b9 100644 --- a/skyscraper8/Skyscraper/Net/Pcap/PcapIpTrafficHandler.cs +++ b/skyscraper8/Skyscraper/Net/Pcap/PcapIpTrafficHandler.cs @@ -1,4 +1,5 @@ using log4net; +using skyscraper5.Skyscraper.IO; using skyscraper5.Skyscraper.Net.Pcap; using skyscraper5.Skyscraper.Plugins; using skyscraper8.Skyscraper.Scraper.Storage; @@ -17,13 +18,31 @@ namespace skyscraper8.Skyscraper.Net.Pcap { private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name); private PcapWriter[] pcapWriters; + private DirectoryInfo outputDirectory; + + public void HandlePacket(int pid, byte[] payload) { if (pcapWriters == null) + { pcapWriters = new PcapWriter[0x1fff]; + + PluginManager pluginManager = PluginManager.GetInstance(); + string outDirPath = pluginManager.Ini.ReadValue("pcapwriter", "outdir", null); + if (!string.IsNullOrEmpty(outDirPath)) + { + outputDirectory = new DirectoryInfo(outDirPath); + if (!outputDirectory.Exists) + outputDirectory.EnsureExists(); + } + } if (pcapWriters[pid] == null) { string fname = String.Format("{0:X4},{1}.pcap", pid, DateTime.Now.Ticks); + if (outputDirectory != null) + { + fname = Path.Combine(outputDirectory.FullName, fname); + } logger.InfoFormat("Opening file for writing: {0}", fname); FileStream fs = File.OpenWrite(fname); pcapWriters[pid] = new PcapWriter(fs, TcpdumpNetworkType.RawIp); diff --git a/skyscraper8/Skyscraper/Plugins/ConfigureFromForeignApplication.cs b/skyscraper8/Skyscraper/Plugins/ConfigureFromForeignApplication.cs new file mode 100644 index 0000000..0d5cd68 --- /dev/null +++ b/skyscraper8/Skyscraper/Plugins/ConfigureFromForeignApplication.cs @@ -0,0 +1,43 @@ +using skyscraper5.Skyscraper; +using skyscraper5.Skyscraper.Plugins; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.Plugins +{ + public class ConfigureFromForeignApplication + { + private ConfigureFromForeignApplication() + { + pluginManager = PluginManager.GetInstance(); + } + + private PluginManager pluginManager; + + private static ConfigureFromForeignApplication instance; + public static ConfigureFromForeignApplication GetInstance() + { + if (instance == null) + { + instance = new ConfigureFromForeignApplication(); + } + return instance; + } + + public void SaveConfig() + { + pluginManager.SaveConfiguration(); + } + + public Ini Ini + { + get + { + return pluginManager.Ini; + } + } + } +} diff --git a/skyscraper8/Skyscraper/Plugins/ISkyscraperMpePlugin.cs b/skyscraper8/Skyscraper/Plugins/ISkyscraperMpePlugin.cs index 84f1b58..c70da79 100644 --- a/skyscraper8/Skyscraper/Plugins/ISkyscraperMpePlugin.cs +++ b/skyscraper8/Skyscraper/Plugins/ISkyscraperMpePlugin.cs @@ -10,5 +10,6 @@ namespace skyscraper5.Skyscraper.Plugins bool CanHandlePacket(InternetHeader internetHeader, byte[] ipv4Packet); void HandlePacket(InternetHeader internetHeader, byte[] ipv4Packet); bool StopProcessingAfterThis(); + } } diff --git a/skyscraper8/Skyscraper/Plugins/PluginManager.cs b/skyscraper8/Skyscraper/Plugins/PluginManager.cs index 05e920a..0c34ffa 100644 --- a/skyscraper8/Skyscraper/Plugins/PluginManager.cs +++ b/skyscraper8/Skyscraper/Plugins/PluginManager.cs @@ -22,6 +22,7 @@ using skyscraper8.Skyscraper.Net.Pcap; using skyscraper8.Skyscraper.Plugins; using skyscraper8.Skyscraper.Scraper.Storage; using skyscraper8.Skyscraper.Text; +using skyscraper5.src.InteractionChannel.Model.Descriptors; namespace skyscraper5.Skyscraper.Plugins { @@ -31,7 +32,7 @@ namespace skyscraper5.Skyscraper.Plugins private PluginManager() { - _mpePlugins = new List(); + _mpePluginTypes = new List(); _gpsReceiverFactories = new Dictionary(); descriptorBannedTables = new Dictionary(); descriptorMap = new Dictionary(); @@ -48,7 +49,32 @@ namespace skyscraper5.Skyscraper.Plugins FileInfo skyscraperMainAssembly = GetSkyscraperMainAssembly(); DirectoryInfo skyscraperHome = skyscraperMainAssembly.Directory; + LoadIni(skyscraperHome); + if (skyscraperMainAssembly != null) + { + DirectoryInfo directory = skyscraperMainAssembly.Directory; + logger.DebugFormat("Found skyscraper main assembly at: {0}", directory.FullName); + FileInfo[] fileInfos = directory.GetFiles("skyscraper5.*.dll"); + foreach (FileInfo fileInfo in fileInfos) + { + try + { + logger.Info(String.Format("Trying to load: {0}", fileInfo.Name)); + Assembly loadFile = Assembly.LoadFile(fileInfo.FullName); + ScanAssembly(loadFile); + logger.Debug(String.Format("Loaded {0}", fileInfo.Name)); + } + catch (Exception e) + { + logger.ErrorFormat("Failed to scan assembly {0}", fileInfo.Name); + } + } + } + } + + private void LoadIni(DirectoryInfo skyscraperHome) + { iniFileInfo = new FileInfo(Path.Combine(skyscraperHome.FullName, iniFilename)); if (iniFileInfo.Exists) { @@ -61,7 +87,7 @@ namespace skyscraper5.Skyscraper.Plugins FileInfo pluginFileInfo = new FileInfo(valuePair.Value); if (!pluginFileInfo.Exists) continue; - + if (resolveDirectoryInfos == null) resolveDirectoryInfos = new HashSet(); if (IsOnWindows()) @@ -84,28 +110,6 @@ namespace skyscraper5.Skyscraper.Plugins Debug.WriteLine(String.Format("{0} was not found. Create it using the UI!", iniFileInfo.FullName)); Ini = new Ini(); } - - - if (skyscraperMainAssembly != null) - { - DirectoryInfo directory = skyscraperMainAssembly.Directory; - logger.DebugFormat("Found skyscraper main assembly at: {0}", directory.FullName); - FileInfo[] fileInfos = directory.GetFiles("skyscraper5.*.dll"); - foreach (FileInfo fileInfo in fileInfos) - { - try - { - logger.Info(String.Format("Trying to load: {0}", fileInfo.Name)); - Assembly loadFile = Assembly.LoadFile(fileInfo.FullName); - ScanAssembly(loadFile); - logger.Debug(String.Format("Loaded {0}", fileInfo.Name)); - } - catch (Exception e) - { - logger.ErrorFormat("Failed to scan assembly {0}", fileInfo.Name); - } - } - } } private FileInfo GetSkyscraperMainAssembly() @@ -193,6 +197,14 @@ namespace skyscraper5.Skyscraper.Plugins return _instance; } + public static void NotifyIniUpdate(Ini newIni) + { + if (_instance == null) + return; + + _instance.Ini = newIni; + } + private Type storageIdAttributeTyoe = typeof(StorageIdAttribute); private Type objectStorageFactoryType = typeof(ObjectStorageFactory); private Type dataStorageFactoryType = typeof(DataStorageFactory); @@ -210,7 +222,7 @@ namespace skyscraper5.Skyscraper.Plugins private Type ipTrafficHandler = typeof(IpTrafficHandler); private List _dnsParsers; - private List _mpePlugins; + private List _mpePluginTypes; private Dictionary _gpsReceiverFactories; private Dictionary descriptorMap; private Dictionary descriptorBannedTables; @@ -252,8 +264,7 @@ namespace skyscraper5.Skyscraper.Plugins if (type.IsAssignableTo(mpePluginType)) { - ISkyscraperMpePlugin mpePlugin = (ISkyscraperMpePlugin)Activator.CreateInstance(type); - _mpePlugins.Add(mpePlugin); + _mpePluginTypes.Add(type); continue; } else if (type.IsAssignableTo(gpsReceiverFactoryType)) @@ -338,7 +349,7 @@ namespace skyscraper5.Skyscraper.Plugins throw new NotImplementedException(); } - _mpePlugins.Sort(sorter); + _mpePluginTypes.Sort(sorter); } private void HandleIpTrafficHandler(Type type) @@ -682,7 +693,15 @@ namespace skyscraper5.Skyscraper.Plugins public ReadOnlyCollection GetMpePlugins() { - return _mpePlugins.AsReadOnly(); + List result = new List(); + foreach(Type t in _mpePluginTypes) + { + object? v = Activator.CreateInstance(t); + ISkyscraperMpePlugin mpePlugin = v as ISkyscraperMpePlugin; + if (mpePlugin != null) + result.Add(mpePlugin); + } + return result.AsReadOnly(); } public ReadOnlyDictionary GetGpsReceiverFactories() diff --git a/skyscraper8/Skyscraper/Scraper/ISkyscraperUiJunction.cs b/skyscraper8/Skyscraper/Scraper/ISkyscraperUiJunction.cs index 32de9b4..3a8a306 100644 --- a/skyscraper8/Skyscraper/Scraper/ISkyscraperUiJunction.cs +++ b/skyscraper8/Skyscraper/Scraper/ISkyscraperUiJunction.cs @@ -210,13 +210,14 @@ namespace skyscraper5.Skyscraper.Scraper void OnDvbNipCarrierDetected(NipActualCarrierInformation currentCarrierInformation); void OnDvbNipPrivateDataSignallingManifest(PrivateDataSignallingManifestType privateDataSignallingManifest); void OnDvbNipServiceListEntryPoints(NipActualCarrierInformation currentCarrierInformation, ServiceListEntryPoints serviceListEntryPoints, DateTime dvbNipTime); - void OnDvbNipServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId1, string serviceListId2); + void OnDvbNipServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId1, ServiceListType serviceListId2); void OnDvbNipTimeOffsetFile(NipActualCarrierInformation currentCarrierInformation, TimeOffsetFileType timeOffsetFile); void OnDvbNipNetworkInformationFile(NipActualCarrierInformation currentCarrierInformation, NetworkInformationFileType networkInformationFile); void DvbNipServiceInformation(NipActualCarrierInformation currentCarrierInformation, ServiceInformationFileType serviceInformationFile); void OnDvbNipFileAnnouncement(FDTInstanceType flute); void OnAstraSgtList(SgtList list); void OnAstraSgtService(SgtService child); + void NotifyTransportStreamId(int tsid, int nid); TaskQueue Tasks { get; set; } diff --git a/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs b/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs index 0646128..eb20a2c 100644 --- a/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs +++ b/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs @@ -1395,14 +1395,15 @@ namespace skyscraper5.Skyscraper.Scraper public void NotifyFileArrival(VfsFile vfsFile) { - UiJunction?.DsmCcVfs(vfsFile); - if (!CurrentTransportStreamId.HasValue) return; if (!CurrentNetworkId.HasValue) return; - if (ObjectStorage.ObjectCarouselFileArrival(vfsFile, CurrentTransportStreamId.Value, CurrentNetworkId.Value)) + UiJunction?.NotifyTransportStreamId(CurrentTransportStreamId.Value, CurrentNetworkId.Value); + UiJunction?.DsmCcVfs(vfsFile); + + if (ObjectStorage.ObjectCarouselFileArrival(vfsFile, CurrentTransportStreamId.Value, CurrentNetworkId.Value)) { LogEvent(SkyscraperContextEvent.FileArrival, String.Format("PID {0:X4}, Path {1}", vfsFile.SourcePid, vfsFile.ToString())); } @@ -2980,7 +2981,7 @@ namespace skyscraper5.Skyscraper.Scraper public void OnServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId, ServiceListType serviceList) { - UiJunction?.OnDvbNipServiceList(currentCarrierInformation, serviceListId, serviceListId); + UiJunction?.OnDvbNipServiceList(currentCarrierInformation, serviceListId, serviceList); List services = DvbIUtils.FlattenServiceList(serviceList).ToList(); DvbIDataStorage dataStorage = DataStorage; diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs index 744ad69..4d2179f 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs @@ -1623,6 +1623,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem public bool DvbNipTestForFile(string announcedFileContentLocation) { string saneFilename = DvbNipUtilities.MakeFilename(announcedFileContentLocation); + saneFilename = Path.Combine(rootDirectory.FullName, "DVB-NIP-Content", saneFilename); FileInfo fi = new FileInfo(saneFilename); return fi.Exists; } @@ -1630,6 +1631,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener) { string filename = DvbNipUtilities.MakeFilename(listener.FileAssociation.ContentLocation); + filename = Path.Combine(rootDirectory.FullName, "DVB-NIP-Content", filename); FileInfo fi = new FileInfo(filename); fi.Directory.EnsureExists(); FileStream outStream = fi.OpenWrite(); @@ -2000,5 +2002,31 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem fileStream.Flush(); fileStream.Close(); } - } + + public bool TestForObjectCarouselFileArrival(string file, int transportStreamId, int pid, int networkId) + { + if (file.StartsWith("\\")) + file = file.Substring(1); + string combine = Path.Combine(rootDirectory.FullName, "DSM-CC_Objects", networkId.ToString(), transportStreamId.ToString(), pid.ToString(), file); + FileInfo fi = new FileInfo(combine); + return fi.Exists; + } + + public byte[] GetObjectCarouselFileArrival(string file, int transportStreamId, int pid, int networkId) + { + if (file.StartsWith("\\")) + file = file.Substring(1); + string combine = Path.Combine(rootDirectory.FullName, "DSM-CC_Objects", networkId.ToString(), transportStreamId.ToString(), pid.ToString(), file); + FileInfo fi = new FileInfo(combine); + return File.ReadAllBytes(fi.FullName); + } + + public byte[] DvbNipGetFile(string path) + { + string saneFilename = DvbNipUtilities.MakeFilename(path); + saneFilename = Path.Combine(rootDirectory.FullName, "DVB-NIP-Content", saneFilename); + FileInfo fi = new FileInfo(saneFilename); + return File.ReadAllBytes(fi.FullName); + } + } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs index f88acd9..5c9e9f5 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs @@ -1,142 +1,142 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; -using skyscraper5.Dvb.Descriptors; -using skyscraper8.DvbNip; -using skyscraper8.Experimentals.NdsSsu; -using skyscraper8.Ietf.FLUTE; -using skyscraper8.SimpleServiceDiscoveryProtocol; -using skyscraper8.Skyscraper.Drawing; - -namespace skyscraper8.Skyscraper.Scraper.Storage -{ - public class NullObjectStorage : ObjectStorage - { - public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId) - { - throw new NotImplementedException(); - } - - public void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid, - ushort moduleModuleId, byte moduleModuleVersion, Stream result) - { - throw new NotImplementedException(); - } - - public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, - byte moduleVersion) - { - return false; - } - - public bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, - int mappingStreamElementaryPid) - { - throw new NotImplementedException(); - } - - public void StoreFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, ushort pid, - byte[] imageData) - { - throw new NotImplementedException(); - } - - public void WaitForCompletion() - { - throw new NotImplementedException(); - } - - public void UiSetVersion(int version) - { - throw new NotImplementedException(); - } - - public class NullToken - { - - } - - public object[] GetPluginConnector() - { - return new object[1] - { - new NullToken() - }; - } - - public void Ping() - { - throw new NotImplementedException(); - } - - public bool DvbNipTestForFile(string announcedFileContentLocation) - { - return true; - } - - public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener) - { - } - - public void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot) - { - throw new NotImplementedException(); - } - - public void StoreRfSpectrum(Guid jobGuid, RfSpectrumData rfSpectrum) - { - throw new NotImplementedException(); - } - - public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2) - { - throw new NotImplementedException(); - } - - public void DeleteRfSpectrum(Guid selectedGuid) - { - throw new NotImplementedException(); - } - - public bool OtvSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, ushort tableIdExtension, - uint fileId, uint unknown1, uint length) - { - throw new NotImplementedException(); - } - - public void OnOtvSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, Stream getStream, - ushort tableIdExtension, uint fileId, uint unknown1, uint length) - { - throw new NotImplementedException(); - } - - public void OnNdsSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension, - NdsSsuDataMap dataMap) - { - dataMap.Dispose(); - } - - public bool NdsSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension) - { - return true; - } - - public bool SsdpDeviceKnown(SsdpDevice ssdpDevice) - { - return false; - } - - public void SsdpStoreMetadata(SsdpDevice ssdpDevice, byte[] ssdpMetadataByteArray) - { - - } - - public byte[] SsdpGetMetadata(SsdpDevice ssdpDevice) - { - throw new NotImplementedException(); +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; +using skyscraper5.Dvb.Descriptors; +using skyscraper8.DvbNip; +using skyscraper8.Experimentals.NdsSsu; +using skyscraper8.Ietf.FLUTE; +using skyscraper8.SimpleServiceDiscoveryProtocol; +using skyscraper8.Skyscraper.Drawing; + +namespace skyscraper8.Skyscraper.Scraper.Storage +{ + public class NullObjectStorage : ObjectStorage + { + public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId) + { + throw new NotImplementedException(); + } + + public void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid, + ushort moduleModuleId, byte moduleModuleVersion, Stream result) + { + throw new NotImplementedException(); + } + + public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, + byte moduleVersion) + { + return false; + } + + public bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, + int mappingStreamElementaryPid) + { + throw new NotImplementedException(); + } + + public void StoreFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, ushort pid, + byte[] imageData) + { + throw new NotImplementedException(); + } + + public void WaitForCompletion() + { + throw new NotImplementedException(); + } + + public void UiSetVersion(int version) + { + throw new NotImplementedException(); + } + + public class NullToken + { + + } + + public object[] GetPluginConnector() + { + return new object[1] + { + new NullToken() + }; + } + + public void Ping() + { + throw new NotImplementedException(); + } + + public bool DvbNipTestForFile(string announcedFileContentLocation) + { + return true; + } + + public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener) + { + } + + public void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot) + { + throw new NotImplementedException(); + } + + public void StoreRfSpectrum(Guid jobGuid, RfSpectrumData rfSpectrum) + { + throw new NotImplementedException(); + } + + public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2) + { + throw new NotImplementedException(); + } + + public void DeleteRfSpectrum(Guid selectedGuid) + { + throw new NotImplementedException(); + } + + public bool OtvSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, ushort tableIdExtension, + uint fileId, uint unknown1, uint length) + { + throw new NotImplementedException(); + } + + public void OnOtvSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, Stream getStream, + ushort tableIdExtension, uint fileId, uint unknown1, uint length) + { + throw new NotImplementedException(); + } + + public void OnNdsSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension, + NdsSsuDataMap dataMap) + { + dataMap.Dispose(); + } + + public bool NdsSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension) + { + return true; + } + + public bool SsdpDeviceKnown(SsdpDevice ssdpDevice) + { + return false; + } + + public void SsdpStoreMetadata(SsdpDevice ssdpDevice, byte[] ssdpMetadataByteArray) + { + + } + + public byte[] SsdpGetMetadata(SsdpDevice ssdpDevice) + { + throw new NotImplementedException(); } public bool TestForSisDsaci(int value1, int value2, ushort groupId, int versionNumber) @@ -148,5 +148,20 @@ namespace skyscraper8.Skyscraper.Scraper.Storage { throw new NotImplementedException(); } - } -} + + public bool TestForObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId) + { + throw new NotImplementedException(); + } + + public byte[] GetObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId) + { + throw new NotImplementedException(); + } + + public byte[] DvbNipGetFile(string path) + { + return new byte[0] { }; + } + } +} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs index a813921..8ffbfd1 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs @@ -18,6 +18,9 @@ namespace skyscraper8.Skyscraper.Scraper.Storage public interface ObjectStorage : ISsdpCache { bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId); + bool TestForObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId); + byte[] GetObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId); + void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleModuleId, byte moduleModuleVersion, Stream result); bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, byte moduleVersion); bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, int mappingStreamElementaryPid); @@ -39,5 +42,6 @@ namespace skyscraper8.Skyscraper.Scraper.Storage bool NdsSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension); bool TestForSisDsaci(int value1, int value2, ushort groupId, int versionNumber); void StoreSisDsaci(int value1, int value2, ushort currentDsaGroupId, int versionNumber, Stream dsaci); - } + byte[] DvbNipGetFile(string path); + } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Tar/TarObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Tar/TarObjectStorage.cs index 4ac4933..4799f6f 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Tar/TarObjectStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/Tar/TarObjectStorage.cs @@ -210,5 +210,23 @@ namespace skyscraper8.Skyscraper.Scraper.Storage.Tar string filename = String.Format("dvb-sis/{0}/{1}/Group{2}_Version{3}.xml", nid, tsid, currentDsaGroupId, versionNumber); tarArchive.WriteEntry(filename, dsaci); } + + public bool TestForObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId) + { + string filename = string.Format("dsm-cc/objects/{0}/{1}/{2}/{3}", networkId, transportStreamId, pid, vfsFile.ToString()); + return tarArchive.HasEntry(filename); + } + + public byte[] GetObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId) + { + string filename = string.Format("dsm-cc/objects/{0}/{1}/{2}/{3}", networkId, transportStreamId, pid, vfsFile.ToString()); + return tarArchive.ReadEntry(filename); + } + + public byte[] DvbNipGetFile(string path) + { + string filename = "/nip/" + DvbNipUtilities.MakeFilename(path); + return tarArchive.ReadEntry(filename); + } } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Utilities/DatabaseKeyNipMulticastGatewayConfigurationTransportSession.cs b/skyscraper8/Skyscraper/Scraper/Storage/Utilities/DatabaseKeyNipMulticastGatewayConfigurationTransportSession.cs index 6e65579..21ac79c 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Utilities/DatabaseKeyNipMulticastGatewayConfigurationTransportSession.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/Utilities/DatabaseKeyNipMulticastGatewayConfigurationTransportSession.cs @@ -43,22 +43,25 @@ namespace skyscraper8.Skyscraper.Scraper.Storage.Utilities public ushort CarrierId { get; set; } - protected bool Equals(DatabaseKeyNipMulticastGatewayConfigurationTransportSession other) - { - return TSI == other.TSI && DestinationPort == other.DestinationPort && DestinationAddress.Equals(other.DestinationAddress) && SourceAddress.Equals(other.SourceAddress) && ServiceId == other.ServiceId && NetworkId == other.NetworkId && LinkId == other.LinkId && CarrierId == other.CarrierId; - } - 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((DatabaseKeyNipMulticastGatewayConfigurationTransportSession)obj); + return obj is DatabaseKeyNipMulticastGatewayConfigurationTransportSession session && + TSI == session.TSI && + DestinationPort == session.DestinationPort && + EqualityComparer.Default.Equals(DestinationAddress, session.DestinationAddress) && + EqualityComparer.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); } + + + } }