public FilterToFile(ushort pid, string filePath) : base(pid) { // Create the MFC wrapper m_Class = new ClassHolder(TTBudget.LegacySize.CDVBFilterToFile); // Construct C++ instance _Construct(m_Class.ClassPointer); // Attach destructor m_Class.Destructor = new ClassHolder.DestructHandler(_Destruct); // Create MFC string using (MFCString path = new MFCString(filePath)) { // Configure file - flags are Create and Write _SetFileParams(m_Class.ClassPointer, path.ClassPointer, 0x1001); } }
/// <summary> /// Load the board ARM firmware from the indicated path. /// </summary> /// <param name="firmwarePath">If the path does not end with a backslash /// a backslash is automatically added.</param> /// <exception cref="DVBException"> /// Thrown when the C++ method invocation reports some <see cref="DVBError"/>. /// </exception> public void BootARM(string firmwarePath) { // Expand if (!firmwarePath.EndsWith(@"\")) { firmwarePath += @"\"; } // Create string using (MFCString pathString = new MFCString(firmwarePath)) for (int retry = 2; ;) { // Try reset first DVBException.ThrowOnError(CDVBBoardControl_ResetInit(m_Class.ClassPointer), "Initialisation failed"); try { // Process DVBException.ThrowOnError(CDVBBoardControl_BootARM(m_Class.ClassPointer, pathString.ClassPointer), "Unable to Boot " + firmwarePath); // Done break; } catch (DVBException e) { // Not a hardware error if (DVBError.Hardware != e.ErrorCode) { throw e; } // Retry through if (--retry < 1) { throw e; } // Delay before retry System.Threading.Thread.Sleep(1000); } } }
/// <summary> /// Load the board ARM firmware from the indicated path. /// </summary> /// <param name="firmwarePath">If the path does not end with a backslash /// a backslash is automatically added.</param> /// <exception cref="DVBException"> /// Thrown when the C++ method invocation reports some <see cref="DVBError"/>. /// </exception> public void BootARM( string firmwarePath ) { // Expand if (!firmwarePath.EndsWith( @"\" )) firmwarePath += @"\"; // Create string using (MFCString pathString = new MFCString( firmwarePath )) for (int retry = 2; ; ) { // Try reset first DVBException.ThrowOnError( CDVBBoardControl_ResetInit( m_Class.ClassPointer ), "Initialisation failed" ); try { // Process DVBException.ThrowOnError( CDVBBoardControl_BootARM( m_Class.ClassPointer, pathString.ClassPointer ), "Unable to Boot " + firmwarePath ); // Done break; } catch (DVBException e) { // Not a hardware error if (DVBError.Hardware != e.ErrorCode) throw e; // Retry through if (--retry < 1) throw e; // Delay before retry System.Threading.Thread.Sleep( 1000 ); } } }