// internally used for all kind of prepared files. private BurnResult BurnIsoToDisk(string aIsoToBurn, bool aDeleteIsoOnSuccess) { List <string> MyCommandOutput = new List <string>(50); if (!aIsoToBurn.ToLowerInvariant().EndsWith(@".iso")) { return(BurnResult.UnsupportedInput); } int isoSize = 0; try { FileInfo fileInfo = new FileInfo(aIsoToBurn); isoSize = (int)(fileInfo.Length / 1048576); // GetMB } catch (Exception) { return(BurnResult.ErrorConverting); } if (!CheckInsertedMediaCapacity(CurrentDrive, isoSize)) { log.Warn("BurnManager: Could not burn ISO file {0} because it doesn't fit on the medium", aIsoToBurn); return(BurnResult.NotEnoughSpace); } string unixFilename = aIsoToBurn.Replace('\\', '/'); string IsoArgs = DeviceHelper.GetCommonParamsForDevice(CurrentDrive) + " \"" + unixFilename + "\""; MyCommandOutput = DeviceHelper.ExecuteProcReturnStdOut("cdrecord.exe", IsoArgs, 3600000); if (CurrentStatus == BurnStatus.Finished && !MyCommandOutput.Contains(@"A write error occured.")) { // if unsuccessful keep the ISO for retrying / debugging if (aDeleteIsoOnSuccess) { CleanUpCachedFiles(unixFilename); } return(BurnResult.Successful); } else { return(BurnResult.ErrorBurning); } }
public BurnResult BurnAudioCd(List <string> aFilesToBurn) { List <string> MyCommandOutput = new List <string>(50); ReportProgress(BurnStatus.Checking, 0); BurnResult result = BurnResult.Unknown; if (!IsBurningPossible(ProjectType.AudioCD, true, out result)) { ReportError(result, ProjectType.AudioCD); return(result); } string audioFiles = ""; foreach (string audiofile in aFilesToBurn) { audioFiles += "\"" + audiofile + "\" "; } string burnCdArgs = DeviceHelper.GetCommonParamsForDevice(CurrentDrive); burnCdArgs += string.Format(" -speed={0}", CurrentDrive.SelectedWriteSpeed); burnCdArgs += " -pad -audio " + audioFiles; log.Info("BurnManager: Start Burning of Audio CD"); ReportProgress(BurnStatus.Burning, 0); MyCommandOutput = DeviceHelper.ExecuteProcReturnStdOut("cdrecord.exe", burnCdArgs, 3600000); if (CurrentStatus == BurnStatus.Finished && !MyCommandOutput.Contains(@"A write error occured.")) { return(BurnResult.Successful); } else { ReportError(result, ProjectType.AudioCD); return(BurnResult.ErrorBurning); } }