private bool CheckInsertedMediaBlankStatus(Burner aSelectedBurner, bool aBlankRewriteable)
        {
            if (aSelectedBurner.CurrentMediaInfo.DiskStatus == BlankStatus.complete)
            {
                if (aBlankRewriteable)
                {
                    if (aSelectedBurner.CurrentMediaInfo.IsErasable)
                    {
                        // DVD+RW are overwritten directly
                        if (aSelectedBurner.CurrentMediaInfo.CurrentMediaType == MediaType.DVDplusRW)
                        {
                            return(true);
                        }

                        // Blank disk now!
                        return(BlankDisk(true));
                    }
                }
                // did not blank so do not use the medium
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private bool CheckInsertedMediaCapacity(Burner aSelectedBurner, int aIsoSize)
        {
            int currentSpace      = (int)(aSelectedBurner.CurrentMediaInfo.Size / 1024);
            int currentSpaceGuess = MediaTypeSupport.GetMediaSizeMbByType(aSelectedBurner.CurrentMediaInfo.CurrentMediaType);

            // first try the "true" disk size
            if (currentSpace < aIsoSize)
            {
                return(currentSpaceGuess > aIsoSize);
            }

            return(true);
        }
        /// <summary>
        ///   Checks whether the needed media can be handled
        /// </summary>
        /// <param name = "aSelectedBurner">the burner which is going to be checked for support of the current media</param>
        /// <returns>whether the burner can handle the inserted media type</returns>
        private bool CheckInsertedMediaSupported(Burner aSelectedBurner)
        {
            if (aSelectedBurner == null)
            {
                return(false);
            }

            // this will trigger a refresh of the current media as well
            if (!aSelectedBurner.HasMedia)
            {
                return(false);
            }
            else
            {
                return(aSelectedBurner.MediaFeatures.IsMediaTypeSupported(aSelectedBurner.CurrentMediaInfo.CurrentMediaType));
            }
        }
Exemple #4
0
        /// <summary>
        ///   Build all medium independent arguments to apply for each burning action
        /// </summary>
        /// <param name = "aDevice">The device to use (may need some specific params)</param>
        /// <returns>All trimmed arguments concatenated and ready to pass them to cdrecord</returns>
        public static string GetCommonParamsForDevice(Burner aDevice)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(" dev=");
            sb.Append(aDevice.BusId);  // how to address the device
            sb.Append(" gracetime=2"); // wait this many seconds until finally the process is started
            sb.Append(" fs=8m");       // set fifo buffer to 8 MB (should be at least the size of the drive's cache)
            if (aDevice.DriveFeatures.SupportsBurnFree)
            {
                sb.Append(" driveropts=burnfree"); // enable Buffer-Underrun-Technology
            }
            sb.Append(" -v");                      // be a little verbose
            sb.Append(" -overburn");               // allow overburning just in case we calculate wrong by a few KiB
            sb.Append(" -dao");
            // overburning usually requires disc-at-once mode
            sb.Append(" -eject"); // Open Tray when finished
            // sb.Append(" -clone");                // Write disk in clone mode
            // sb.Append(" -dummy");                // only simulate for debugging purposes

            return(sb.ToString());
        }
        private void SetPreferredDrive(List <Burner> AvailableDrives)
        {
            foreach (Burner MyDrive in AvailableDrives)
            {
                if (CurrentDrive == null)
                {
                    if (MyDrive.DriveFeatures.WriteCDR || MyDrive.DriveFeatures.WriteDVDR)
                    {
                        CurrentDrive = MyDrive;
                    }
                }
                else
                // Prefer new/faster drives over older drives
                if (MyDrive.DriveFeatures.MaxWriteSpeedInt > CurrentDrive.DriveFeatures.MaxWriteSpeedInt)
                {
                    // Prefer more flexible drives supporting DVD-RAM over faster drives
                    if (!MyDrive.DriveFeatures.WriteDVDRam && CurrentDrive.DriveFeatures.WriteDVDRam)
                    {
                        continue;
                    }

                    CurrentDrive = MyDrive;
                }
            }
            if (CurrentDrive != null)
            {
                log.Info("BurnManager: Drive {0}-{1} will be used as preferred burner.", CurrentDrive.DeviceVendor,
                         CurrentDrive.DeviceName);
                if (CurrentDrive.HasMedia)
                {
                    log.Info("BurnManager: The drive is equipped with a {0} medium ({1}).",
                             CurrentDrive.CurrentMediaInfo.HumanMediaString,
                             CurrentDrive.CurrentMediaInfo.DiskStatus.ToString());
                }
            }
        }
        /// <summary>
        ///   Build all medium independent arguments to apply for each burning action
        /// </summary>
        /// <param name = "aDevice">The device to use (may need some specific params)</param>
        /// <returns>All trimmed arguments concatenated and ready to pass them to cdrecord</returns>
        public static string GetCommonParamsForDevice(Burner aDevice)
        {
            StringBuilder sb = new StringBuilder();
              sb.Append(" dev=");
              sb.Append(aDevice.BusId); // how to address the device
              sb.Append(" gracetime=2"); // wait this many seconds until finally the process is started
              sb.Append(" fs=8m"); // set fifo buffer to 8 MB (should be at least the size of the drive's cache)
              if (aDevice.DriveFeatures.SupportsBurnFree)
            sb.Append(" driveropts=burnfree"); // enable Buffer-Underrun-Technology
              sb.Append(" -v"); // be a little verbose
              sb.Append(" -overburn"); // allow overburning just in case we calculate wrong by a few KiB
              sb.Append(" -dao");
            // overburning usually requires disc-at-once mode
              sb.Append(" -eject"); // Open Tray when finished
              // sb.Append(" -clone");                // Write disk in clone mode
              // sb.Append(" -dummy");                // only simulate for debugging purposes

              return sb.ToString();
        }
 /// <summary>
 /// Set the active Burner
 /// </summary>
 /// <param name="burner"></param>
 public void SetActiveBurner(Burner burner)
 {
     burnManager.SetActiveBurner(burner);
       SetMediaInfo();
 }
        private void SetPreferredDrive(List<Burner> AvailableDrives)
        {
            foreach (Burner MyDrive in AvailableDrives)
              {
            if (CurrentDrive == null)
            {
              if (MyDrive.DriveFeatures.WriteCDR || MyDrive.DriveFeatures.WriteDVDR)
            CurrentDrive = MyDrive;
            }
            else
              // Prefer new/faster drives over older drives
              if (MyDrive.DriveFeatures.MaxWriteSpeedInt > CurrentDrive.DriveFeatures.MaxWriteSpeedInt)
              {
            // Prefer more flexible drives supporting DVD-RAM over faster drives
            if (!MyDrive.DriveFeatures.WriteDVDRam && CurrentDrive.DriveFeatures.WriteDVDRam)
              continue;

            CurrentDrive = MyDrive;
              }
              }
              if (CurrentDrive != null)
              {
            log.Info("BurnManager: Drive {0}-{1} will be used as preferred burner.", CurrentDrive.DeviceVendor,
                    CurrentDrive.DeviceName);
            if (CurrentDrive.HasMedia)
              log.Info("BurnManager: The drive is equipped with a {0} medium ({1}).",
                      CurrentDrive.CurrentMediaInfo.HumanMediaString,
                      CurrentDrive.CurrentMediaInfo.DiskStatus.ToString());
              }
        }
        /// <summary>
        ///   Checks whether the needed media can be handled
        /// </summary>
        /// <param name = "aSelectedBurner">the burner which is going to be checked for support of the current media</param>
        /// <returns>whether the burner can handle the inserted media type</returns>
        private bool CheckInsertedMediaSupported(Burner aSelectedBurner)
        {
            if (aSelectedBurner == null)
            return false;

              // this will trigger a refresh of the current media as well
              if (!aSelectedBurner.HasMedia)
            return false;
              else
              {
            return aSelectedBurner.MediaFeatures.IsMediaTypeSupported(aSelectedBurner.CurrentMediaInfo.CurrentMediaType);
              }
        }
        private bool CheckInsertedMediaCapacity(Burner aSelectedBurner, int aIsoSize)
        {
            int currentSpace = (int)(aSelectedBurner.CurrentMediaInfo.Size / 1024);
              int currentSpaceGuess = MediaTypeSupport.GetMediaSizeMbByType(aSelectedBurner.CurrentMediaInfo.CurrentMediaType);
              // first try the "true" disk size
              if (currentSpace < aIsoSize)
              {
            return (currentSpaceGuess > aIsoSize);
              }

              return true;
        }
        private bool CheckInsertedMediaBlankStatus(Burner aSelectedBurner, bool aBlankRewriteable)
        {
            if (aSelectedBurner.CurrentMediaInfo.DiskStatus == BlankStatus.complete)
              {
            if (aBlankRewriteable)
            {
              if (aSelectedBurner.CurrentMediaInfo.IsErasable)
              {
            // DVD+RW are overwritten directly
            if (aSelectedBurner.CurrentMediaInfo.CurrentMediaType == MediaType.DVDplusRW)
              return true;

            // Blank disk now!
            return BlankDisk(true);
              }
            }
            // did not blank so do not use the medium
            return false;
              }
              else
            return true;
        }
 /// <summary>
 ///   Sets the ACtive Burner
 /// </summary>
 /// <param name = "burner"></param>
 public void SetActiveBurner(Burner burner)
 {
     CurrentDrive = burner;
 }
 /// <summary>
 ///   Sets the ACtive Burner
 /// </summary>
 /// <param name = "burner"></param>
 public void SetActiveBurner(Burner burner)
 {
     CurrentDrive = burner;
 }