Exemplo n.º 1
0
        public static DriveInfo[] GetAllAudioCDDrives()
        {
            List <DriveInfo> drives = new List <DriveInfo>();

            foreach (DriveInfo di in DriveInfo.GetDrives())
            {
                if (di.DriveType != DriveType.CDRom)
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(di.RootDirectory.FullName))
                {
                    char letter = di.RootDirectory.FullName.ToUpperInvariant()[0];
                    using (CDDrive cd = new CDDrive())
                    {
                        if (cd.Open(letter) && cd.Refresh() && cd.HasAudioTracks())
                        {
                            drives.Add(di);
                        }
                    }
                }
            }

            return(drives.ToArray());
        }
Exemplo n.º 2
0
      public static DriveInfo[] GetAllAudioCDDrives()
      {
          List<DriveInfo> drives = new List<DriveInfo>();

          foreach (DriveInfo di in DriveInfo.GetDrives())
          {
              if (di.DriveType != DriveType.CDRom)
                  continue;

              if (!string.IsNullOrEmpty(di.RootDirectory.FullName))
              {
                  char letter = di.RootDirectory.FullName.ToUpperInvariant()[0];
                  using (CDDrive cd = new CDDrive())
                  {
                      if (cd.Open(letter) && cd.Refresh() && cd.HasAudioTracks())
                      {
                        drives.Add(di);
                      }
                  }
              }
          }

          return drives.ToArray();
      }
Exemplo n.º 3
0
        private StepDetail ProcessTrack(Track track)
        {
            string newFileName = string.Format("{0}.{1}",
                CdRipper.GetFileName(WordCasing.KeepCase, track, OutputFilePattern),
                this.EncoderSettings.AudioMediaFormatType.ToString().ToLowerInvariant());

            StepDetail detail = new StepDetail();
            detail.Description = Translator.Translate("TXT_PROCESSING_TRACK", track, newFileName);
            RaiseTaskStepInitEvent(detail);

            detail.Results = Translator.Translate("TXT_UNHANDLED");
            detail.IsSuccess = false;

            try
            {
                _grabber = CdRipper.CreateGrabber(this.EncoderSettings.AudioMediaFormatType);
                char letter = Drive.RootDirectory.FullName.ToUpperInvariant()[0];
                using (CDDrive cd = new CDDrive())
                {
                    if (cd.Open(letter) && cd.Refresh() && cd.HasAudioTracks())
                    {
                        string destFile = Path.Combine(OutputFolder, newFileName);

                        bool generateTagsFromMetadata = false;

                        switch (this.EncoderSettings.AudioMediaFormatType)
                        {
                            case AudioMediaFormatType.WAV:
                                break;

                            case AudioMediaFormatType.MP3:
                                (_grabber as GrabberToMP3).Mp3ConversionOptions = this.EncoderSettings.Mp3EncoderSettings.Mp3ConversionOptions;
                                generateTagsFromMetadata = this.EncoderSettings.Mp3EncoderSettings.GenerateTagsFromTrackMetadata;
                                break;
                        }

                        _grabber.Grab(cd, track, destFile, generateTagsFromMetadata);
                    }
                }

                detail.IsSuccess = true;
            }
            catch (Exception ex)
            {
                detail.Results = ex.Message;
            }

            return detail;
        }