コード例 #1
0
        private async Task<int> StartBurnProcess(IDiscRecorder2 discRecorder, bool ejectMedia,
            IList<MediaFile> mediaItems, IMAPI_BURN_VERIFICATION_LEVEL verificationLevel,
            CancellationToken cancellationToken, IProgress<BurnData> progress)
        {
            IsBurning = true;
            this.ejectMedia = ejectMedia;
            this.burnProgress = progress;
            this.mediaItems = mediaItems;
            this.cancellationToken = cancellationToken;

            burnData = new BurnData();
            burnData.uniqueRecorderId = discRecorder.ActiveDiscRecorder;

            var burnResult = await Task.Run(() => DoBurn(burnData.uniqueRecorderId));

            progress.Report(burnData);

            IsBurning = false;

            return burnResult;
        }
コード例 #2
0
 public HRESULT put_BurnVerificationLevel(IMAPI_BURN_VERIFICATION_LEVEL value)
 {
     return(((delegate * unmanaged <IBurnVerification *, IMAPI_BURN_VERIFICATION_LEVEL, int>)(lpVtbl[3]))((IBurnVerification *)Unsafe.AsPointer(ref this), value));
 }
コード例 #3
0
        private int DoBurn(string activeDiscRecorder, IMAPI_BURN_VERIFICATION_LEVEL verificationLevel)
        {
            MsftDiscRecorder2 discRecorder = null;
            MsftDiscFormat2Data discFormatData = null;
            int result = 0;

            try
            {
                discRecorder = new MsftDiscRecorder2();
                discRecorder.InitializeDiscRecorder(burnData.uniqueRecorderId);

                discFormatData = new MsftDiscFormat2Data
                {
                    Recorder = discRecorder,
                    ClientName = "ClientName",
                    ForceMediaToBeClosed = closeMedia
                };

                var burnVerification = (IBurnVerification)discFormatData;
                burnVerification.BurnVerificationLevel = verificationLevel;

                object[] multisessionInterfaces = null;
                if (!discFormatData.MediaHeuristicallyBlank)
                    multisessionInterfaces = discFormatData.MultisessionInterfaces;

                IStream fileSystem;
                if (!CreateMediaFileSystem(discRecorder, multisessionInterfaces, out fileSystem))
                    return -1;

                discFormatData.Update += discFormatData_Update;

                try
                {
                    discFormatData.Write(fileSystem);
                    result = 0;
                }
                catch (COMException ex)
                {
                    result = ex.ErrorCode;
                    MessageBox.Show(ex.Message, "IDiscFormat2Data.Write failed",
                        MessageBoxButton.OK, MessageBoxImage.Stop);
                }
                finally
                {
                    if (fileSystem != null)
                        Marshal.FinalReleaseComObject(fileSystem);
                }

                discFormatData.Update -= discFormatData_Update;

                if (ejectMedia)
                    discRecorder.EjectMedia();
            }
            catch (COMException exception)
            {
                MessageBox.Show(exception.Message);
                result = exception.ErrorCode;
            }
            finally
            {
                if (discRecorder != null)
                    Marshal.ReleaseComObject(discRecorder);

                if (discFormatData != null)
                    Marshal.ReleaseComObject(discFormatData);
            }

            return result;
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: hotwhitewind/BurnMedia
 /// <summary>
 /// Get the burn verification level when the user changes the selection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxVerification_SelectedIndexChanged(object sender, EventArgs e)
 {
     _verificationLevel = (IMAPI_BURN_VERIFICATION_LEVEL)comboBoxVerification.SelectedIndex;
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: developer88/umk
 /// <summary>
 /// Get the burn verification level when the user changes the selection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxVerification_SelectedIndexChanged(object sender, EventArgs e)
 {
     m_verificationLevel = (IMAPI_BURN_VERIFICATION_LEVEL)comboBoxVerification.SelectedIndex;
 }