using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.Scraper;
using skyscraper8.Mpeg2.PacketFilter;

namespace skyscraper8.Skyscraper.Security.AccessControl
{
	internal class SoftcamTestProgram
	{
		public void Run()
		{
			SoftcamKeyset softcamKeyset = SoftcamKeyset.GetInstance();
			softcamKeyset.AutoInitalize();
			byte[] bissKey = softcamKeyset.FindBissKey(2, 85);

			BissDescrambleFilter descrambler = new BissDescrambleFilter(bissKey);

			FileInfo inputFile = new FileInfo("C:\\devel\\12380h_filtered.ts");
			FileStream fileStream = inputFile.OpenRead();
			byte[] buffer = new byte[188];
			for (long i = 0; i < fileStream.Length; i += 188)
			{
				fileStream.Read(buffer, 0, 188);
				TsPacket packet = new TsPacket(buffer);
				descrambler.PassPacket(packet);
			}
		}
	}
}
