int dvbSatSearchLnb = LibDvbV5.DvbSatSearchLnb("EXTENDED");
LibDvbV5SatLnb lnb = new LibDvbV5SatLnb(dvbSatSearchLnb);
            
LibDvbV5Device device = new LibDvbV5Device();
device.SetLog(8, null);
device.Find();
LibDvbV5DeviceList demuxerName = device.SeekBySystemName(0, 0, DvbDeviceType.Demux);
LibDvbV5DeviceList dvrName = device.SeekBySystemName(0, 0, DvbDeviceType.Dvr);
LibDvbV5DeviceList frontendName = device.SeekBySystemName(0, 0, DvbDeviceType.Frontend);

LibDvb5FrontendParameters frontend = new LibDvb5FrontendParameters(0, 0);
frontend.SetLnb(lnb);
frontend.StoreParameter(3, 11362000);       //freq
frontend.StoreParameter(8, 22000000);       //symbol rate
frontend.StoreParameter(17, (uint)LibDvbV5FrontendDeliverySystem.SYS_DVBS2);
frontend.StoreParameter(256, (uint)LibDvbV5SatPolarization.Horizontal);
frontend.SetParameters();
Thread.Sleep(400);
frontend.GetStatistics();
Thread.Sleep(400);
uint retrieveStats = frontend.RetrieveStats(512);
if ((retrieveStats & 0x10) != 0)
{
    Console.WriteLine("got lock!");
    LibDvbV5OpenDescriptor dvrFd = device.DeviceOpen(dvrName);
    if (dvrFd == null)
        throw new IOException("open failed");
    dvrFd.SetBufferSize(1024 * 1024);
                
    LibDvbV5OpenDescriptor demuxFd = device.DeviceOpen(demuxerName);
    if (demuxFd == null)
        throw new IOException("open failed");

    demuxFd.DemuxSetPesFilter(0x2000, DemuxerPesType.DMX_PES_OTHER);

    FileStream fileStream = File.OpenWrite(String.Format("{0}.ts", DateTime.Now.Ticks));
    byte[] packBuffer = new byte[188];
    int readLen = 0;
    for (int i = 0; i < 9001; i++)
    {
        readLen = dvrFd.Read(packBuffer, 188);
        if (readLen > 0)
        {
            fileStream.Write(packBuffer, 0, 188);
        }
    }

    fileStream.Flush(true);
    fileStream.Close();
    demuxFd.Dispose();
    dvrFd.Dispose();
}
else
{
    Console.WriteLine("no lock :(");
}
frontend.Dispose();
device.Dispose();