public void RawBurn( Form frm, string strPath ) { try { _burn = new XPBurnCD(); _burn.BurnerDrive = (string)_burn.RecorderDrives[0]; } catch ( Exception ex ) { Global.showMsgBox( frm, ex.Message ); return; } long lSize = 0; foreach ( string strFN in Directory.GetFiles(strPath) ) if ( !strFN.EndsWith(".emf") ) { FileInfo fi = new FileInfo(strFN); lSize += 1+fi.Length/1024; _burn.AddFile( strFN, "\\" + Path.GetFileName(strFN) ); } string strMediaType = (lSize/1024)>600 ? "DVD" : "CD"; if ( MessageBox.Show( frm, "Sätt i en " + strMediaType + " i brännaren och tryck OK för att starta.", Global.AppName, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation ) != DialogResult.OK ) return; try { _burn.VolumeName = Path.GetFileName( strPath ); using ( frmBränning dlg = new frmBränning(_burn) ) dlg.ShowDialog(); } catch ( Exception ex ) { Global.showMsgBox( frm, ex.Message ); } }
public void BurnToCD(ImageCollection images) { if (_burnCD != null) { throw new InvalidOperationException("An existing burning session is in progress."); } try { _burnCD = new XPBurnCD(); _burnCD.ActiveFormat = RecordType.afData; _burnCD.AddProgress += new NotifyCDProgress(OnAddProgress); _burnCD.BurnComplete += new NotifyCompletionStatus(OnBurnComplete); _burnCD.ClosingDisc += new NotifyEstimatedTime(OnClosingDisc); _burnCD.EraseComplete += new NotifyCompletionStatus(OnEraseComplete); _burnCD.PreparingBurn += new NotifyEstimatedTime(OnPreparingBurn); _burnCD.RecorderChange += new NotifyPnPActivity(OnRecorderChange); _burnCD.TrackProgress += new NotifyCDProgress(OnTrackProgress); _burnCD.BlockProgress +=new NotifyCDProgress(OnBlockProgress); // _burnCD.ErrorHappened +=new NotifyErrorStatus(ErrorHappened); foreach (ImageInfo ii in images) { _burnCD.AddFile(ii.ImagePath, ii.ImagePath); } if (_burnCD.MediaInfo.isWritable) { _burnCD.RecordDisc(false, false); } } catch (Exception ex) { AddMessage(ex.ToString()); } }