* CUERipper: was still sometimes locking drives it didn't need to

* ArCueDotNet: don't search for cover art
* 'Silent track' diagnostics in AR log
* LAME.dll: settings were not used
* libwavpack: settings were not used (MD5Sum & extra mode)
* workarounds for various Mono bugs
* Path formatting: %discnumber% produces two-digit numbers if %totaldiscs% > 9
* Overwrite dialog: list files, 'remember the choice' option
* Doesn't abort on broken Artwork files
* Better locates files in some complicated cases, e.g. when only some tracks have tracknumber tags
* Folder browser now sorts contents, because OS didn't do it when browsing external drives etc
This commit is contained in:
chudov
2010-06-11 17:54:37 +00:00
parent 769a85f827
commit 64ddb2cf31
23 changed files with 2483 additions and 999 deletions

View File

@@ -565,7 +565,7 @@ namespace CUERipper
rectRadius6.TopLeft = 2; rectRadius6.TopLeft = 2;
rectRadius6.TopRight = 6; rectRadius6.TopRight = 6;
this.bnComboBoxDrives.Radius = rectRadius6; this.bnComboBoxDrives.Radius = rectRadius6;
this.bnComboBoxDrives.SelectedValueChanged += new System.EventHandler(this.bnComboBoxDrives_SelectedValueChanged); this.bnComboBoxDrives.SelectedIndexChanged += new System.EventHandler(this.bnComboBoxDrives_SelectedIndexChanged);
// //
// bnComboBoxOutputFormat // bnComboBoxOutputFormat
// //

View File

@@ -214,36 +214,26 @@ namespace CUERipper
data.Drives.RaiseListChangedEvents = false; data.Drives.RaiseListChangedEvents = false;
foreach (char drive in CDDrivesList.DrivesAvailable()) foreach (char drive in CDDrivesList.DrivesAvailable())
{ {
ICDRipper reader = null; this.BeginInvoke((MethodInvoker)(() =>
string arName = null; toolStripStatusLabel1.Text = Properties.Resources.DetectingDrives + ": " + drive + ":\\..."));
int driveOffset; ICDRipper reader = Activator.CreateInstance(CUEProcessorPlugins.ripper) as ICDRipper;
try try
{ {
this.BeginInvoke((MethodInvoker)delegate()
{
toolStripStatusLabel1.Text = Properties.Resources.DetectingDrives + ": " + drive + ":\\...";
});
reader = Activator.CreateInstance(CUEProcessorPlugins.ripper) as ICDRipper;
reader.Open(drive); reader.Open(drive);
arName = reader.ARName;
reader.Close();
} }
catch (Exception ex) catch (Exception ex)
{ {
try System.Diagnostics.Trace.WriteLine(ex.Message);
{ }
arName = reader.ARName;
reader.Close(); reader.Close();
} if (reader.ARName != null)
catch
{ {
data.Drives.Add(new DriveInfo(m_icon_mgr, drive + ":\\", ex.Message)); int driveOffset;
continue; if (AccurateRipVerify.FindDriveReadOffset(reader.ARName, out driveOffset))
}
}
if (!AccurateRipVerify.FindDriveReadOffset(arName, out driveOffset))
; //throw new Exception("Failed to find drive read offset for drive" + _ripper.ARName);
reader.DriveOffset = driveOffset; reader.DriveOffset = driveOffset;
else
reader.DriveOffset = 0;
}
data.Drives.Add(new DriveInfo(m_icon_mgr, drive + ":\\", reader)); data.Drives.Add(new DriveInfo(m_icon_mgr, drive + ":\\", reader));
} }
this.BeginInvoke((MethodInvoker)delegate() this.BeginInvoke((MethodInvoker)delegate()
@@ -333,10 +323,7 @@ namespace CUERipper
} }
if (_startStop._pause) if (_startStop._pause)
{ {
this.BeginInvoke((MethodInvoker)delegate() this.BeginInvoke((MethodInvoker)(()=> toolStripStatusLabel1.Text = Properties.Resources.PausedMessage + "..."));
{
toolStripStatusLabel1.Text = Properties.Resources.PausedMessage + "...";
});
Monitor.Wait(_startStop); Monitor.Wait(_startStop);
} }
} }
@@ -773,6 +760,9 @@ namespace CUERipper
if (bnComboBoxDrives.SelectedItem as DriveInfo == null) if (bnComboBoxDrives.SelectedItem as DriveInfo == null)
return; return;
if (selectedDriveInfo != null)
selectedDriveInfo.drive.Close();
selectedDriveInfo = bnComboBoxDrives.SelectedItem as DriveInfo; selectedDriveInfo = bnComboBoxDrives.SelectedItem as DriveInfo;
defaultDrive = selectedDriveInfo.Path; defaultDrive = selectedDriveInfo.Path;
@@ -790,9 +780,8 @@ namespace CUERipper
data.selectedRelease = null; data.selectedRelease = null;
bnComboBoxRelease.Enabled = false; bnComboBoxRelease.Enabled = false;
bnComboBoxRelease.Text = ""; bnComboBoxRelease.Text = "";
if (selectedDriveInfo == null || selectedDriveInfo.drive == null) if (selectedDriveInfo == null)
{ {
selectedDriveInfo = null;
SetupControls(); SetupControls();
return; return;
} }
@@ -801,27 +790,19 @@ namespace CUERipper
cueSheet.Close(); cueSheet.Close();
cueSheet = null; cueSheet = null;
} }
numericWriteOffset.Value = selectedDriveInfo.drive.DriveOffset;
try try
{ {
selectedDriveInfo.drive.Close();
selectedDriveInfo.drive.Open(selectedDriveInfo.drive.Path[0]); selectedDriveInfo.drive.Open(selectedDriveInfo.drive.Path[0]);
numericWriteOffset.Value = selectedDriveInfo.drive.DriveOffset;
} }
catch (Exception ex) catch (Exception ex)
{ {
numericWriteOffset.Value = selectedDriveInfo.drive.DriveOffset; selectedDriveInfo.drive.Close();
//selectedDriveInfo.drive.Close();
bnComboBoxRelease.Text = ex.Message; bnComboBoxRelease.Text = ex.Message;
//bnComboBoxRelease.Enabled = false;
SetupControls();
return;
}
if (selectedDriveInfo.drive.TOC.AudioTracks == 0)
{
bnComboBoxRelease.Text = "No audio tracks";
SetupControls(); SetupControls();
return; return;
} }
// cannot use data.Drives.ResetItem(bnComboBoxDrives.SelectedIndex); - causes recursion
UpdateRelease(); UpdateRelease();
_workThread = new Thread(Lookup); _workThread = new Thread(Lookup);
_workThread.Priority = ThreadPriority.BelowNormal; _workThread.Priority = ThreadPriority.BelowNormal;
@@ -1029,7 +1010,7 @@ namespace CUERipper
UpdateRelease(); UpdateRelease();
} }
private void bnComboBoxDrives_SelectedValueChanged(object sender, EventArgs e) private void bnComboBoxDrives_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (_workThread == null) if (_workThread == null)
UpdateDrive(); UpdateDrive();
@@ -1444,7 +1425,6 @@ namespace CUERipper
public class DriveInfo public class DriveInfo
{ {
public ICDRipper drive; public ICDRipper drive;
public string error;
DirectoryInfo di; DirectoryInfo di;
CUEControls.IIconManager iconMgr; CUEControls.IIconManager iconMgr;
@@ -1471,16 +1451,9 @@ namespace CUERipper
this.drive = drive; this.drive = drive;
} }
public DriveInfo(CUEControls.IIconManager iconMgr, string path, string error)
{
this.iconMgr = iconMgr;
this.di = new DirectoryInfo(path);
this.error = error;
}
public override string ToString() public override string ToString()
{ {
return drive != null ? drive.Path : this.di.FullName + ": " + error; return drive.Path;
} }
} }

View File

@@ -25,6 +25,8 @@ namespace ArCueDotNet
config.writeArLogOnVerify = false; config.writeArLogOnVerify = false;
config.writeArTagsOnVerify = false; config.writeArTagsOnVerify = false;
config.autoCorrectFilenames = true; config.autoCorrectFilenames = true;
config.extractAlbumArt = false;
config.embedAlbumArt = false;
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
try try
{ {

View File

@@ -18,6 +18,7 @@ namespace CUETools.AccurateRip
_accDisks = new List<AccDisk>(); _accDisks = new List<AccDisk>();
_hasLogCRC = false; _hasLogCRC = false;
_CRCLOG = new uint[toc.AudioTracks + 1]; _CRCLOG = new uint[toc.AudioTracks + 1];
ExceptionStatus = WebExceptionStatus.Pending;
Init(toc); Init(toc);
} }
@@ -846,25 +847,31 @@ namespace CUETools.AccurateRip
uint count = 0; uint count = 0;
uint partials = 0; uint partials = 0;
uint conf = 0; uint conf = 0;
uint crcOI = CRC(iTrack, oi);
uint crc450OI = CRC450(iTrack, oi);
for (int di = 0; di < (int)AccDisks.Count; di++) for (int di = 0; di < (int)AccDisks.Count; di++)
{ {
int trno = iTrack + _toc.FirstAudio - 1; int trno = iTrack + _toc.FirstAudio - 1;
if (trno >= AccDisks[di].tracks.Count) if (trno >= AccDisks[di].tracks.Count)
continue; continue;
count += AccDisks[di].tracks[trno].count; count += AccDisks[di].tracks[trno].count;
if (CRC(iTrack, oi) == AccDisks[di].tracks[trno].CRC if (crcOI == AccDisks[di].tracks[trno].CRC
&& 0 != AccDisks[di].tracks[trno].CRC) && 0 != AccDisks[di].tracks[trno].CRC)
conf += AccDisks[di].tracks[trno].count; conf += AccDisks[di].tracks[trno].count;
if (CRC450(iTrack, oi) == AccDisks[di].tracks[trno].Frame450CRC if (crc450OI == AccDisks[di].tracks[trno].Frame450CRC
&& 0 != AccDisks[di].tracks[trno].Frame450CRC) && 0 != AccDisks[di].tracks[trno].Frame450CRC)
partials += AccDisks[di].tracks[trno].count; partials ++;
} }
if (conf > 0 || (count == 0 && CRC(iTrack, oi) == 0)) string status;
sw.WriteLine(String.Format(" {0:00} [{1:x8}] ({3" + ifmt + "}/{2" + ifmt + "}) Accurately ripped", iTrack + 1, CRC(iTrack, oi), count, conf)); if (conf > 0)
status = "Accurately ripped";
else if (count == 0 && CRC(iTrack, oi) == 0)
status = "Silent track";
else if (partials > 0) else if (partials > 0)
sw.WriteLine(String.Format(" {0:00} [{1:x8}] ({3" + ifmt + "}/{2" + ifmt + "}) No match but offset", iTrack + 1, CRC(iTrack, oi), count, partials)); status = "No match but offset";
else else
sw.WriteLine(String.Format(" {0:00} [{1:x8}] ({3" + ifmt + "}/{2" + ifmt + "}) No match", iTrack + 1, CRC(iTrack, oi), count, 0)); status = "No match";
sw.WriteLine(String.Format(" {0:00} [{1:x8}] ({3" + ifmt + "}/{2" + ifmt + "}) {4}", iTrack + 1, CRC(iTrack, oi), count, conf, status));
} }
} }
@@ -909,21 +916,25 @@ namespace CUETools.AccurateRip
{ {
uint matches = 0, partials = 0; uint matches = 0, partials = 0;
for (int iTrack = 0; iTrack < _toc.AudioTracks; iTrack++) for (int iTrack = 0; iTrack < _toc.AudioTracks; iTrack++)
{
uint crcOI = CRC(iTrack, oi);
uint crc450OI = CRC450(iTrack, oi);
for (int di = 0; di < (int)AccDisks.Count; di++) for (int di = 0; di < (int)AccDisks.Count; di++)
{ {
int trno = iTrack + _toc.FirstAudio - 1; int trno = iTrack + _toc.FirstAudio - 1;
if (trno < AccDisks[di].tracks.Count if (trno >= AccDisks[di].tracks.Count)
&& (CRC(iTrack, oi) == AccDisks[di].tracks[trno].CRC continue;
&& AccDisks[di].tracks[trno].CRC != 0)) if (crcOI == AccDisks[di].tracks[trno].CRC
&& AccDisks[di].tracks[trno].CRC != 0)
{ {
matches++; matches++;
break; break;
} }
if (trno < AccDisks[di].tracks.Count if (crc450OI == AccDisks[di].tracks[trno].Frame450CRC
&& (CRC450(iTrack, oi) == AccDisks[di].tracks[trno].Frame450CRC && AccDisks[di].tracks[trno].Frame450CRC != 0)
&& AccDisks[di].tracks[trno].Frame450CRC != 0))
partials++; partials++;
} }
}
if (matches != _toc.AudioTracks && oi != 0 && matches + partials != 0) if (matches != _toc.AudioTracks && oi != 0 && matches + partials != 0)
{ {
if (offsets_match++ > 16) if (offsets_match++ > 16)

View File

@@ -7,6 +7,7 @@ using System.Management;
using System.Net; using System.Net;
using System.Xml; using System.Xml;
using System.Text; using System.Text;
using System.Security.Cryptography;
using CUETools.CDImage; using CUETools.CDImage;
using CUETools.AccurateRip; using CUETools.AccurateRip;
using Krystalware.UploadHelper; using Krystalware.UploadHelper;
@@ -172,19 +173,22 @@ namespace CUETools.CTDB
{ {
if (uuidInfo == null) if (uuidInfo == null)
{ {
ManagementClass mc = new ManagementClass("Win32_ComputerSystemProduct"); string id = "CTDB userid";
using (ManagementClass mc = new ManagementClass("Win32_ComputerSystemProduct"))
foreach (ManagementObject mo in mc.GetInstances()) foreach (ManagementObject mo in mc.GetInstances())
{ {
uuidInfo = mo.Properties["UUID"].Value.ToString(); id = id + mo.Properties["UUID"].Value.ToString();
break; break;
} }
byte[] hashBytes = (new SHA1CryptoServiceProvider()).ComputeHash(Encoding.ASCII.GetBytes(id));
uuidInfo = Convert.ToBase64String(hashBytes).Replace('+', '.').Replace('/', '_').Replace('=', '-');
} }
return uuidInfo ?? "unknown"; return uuidInfo;
} }
public string Confirm(DBEntry entry) public string Confirm(DBEntry entry)
{ {
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urlbase + "/confirm.php?tocid=" + toc.TOCID + "&id=" + entry.id); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urlbase + "/confirm.php?tocid=" + toc.TOCID + "&id=" + entry.id + "&userid=" + GetUUID());
req.Method = "GET"; req.Method = "GET";
req.Proxy = proxy; req.Proxy = proxy;
req.UserAgent = userAgent; req.UserAgent = userAgent;

View File

@@ -211,7 +211,7 @@ namespace CUETools.Codecs.LAME
} }
} }
public object Settings public virtual object Settings
{ {
get get
{ {
@@ -312,7 +312,7 @@ namespace CUETools.Codecs.LAME
LAMEEncoderVBRSettings _settings = new LAMEEncoderVBRSettings(); LAMEEncoderVBRSettings _settings = new LAMEEncoderVBRSettings();
public object Settings public override object Settings
{ {
get get
{ {
@@ -375,7 +375,7 @@ namespace CUETools.Codecs.LAME
LAMEEncoderCBRSettings _settings = new LAMEEncoderCBRSettings(); LAMEEncoderCBRSettings _settings = new LAMEEncoderCBRSettings();
public object Settings public override object Settings
{ {
get get
{ {

View File

@@ -296,7 +296,7 @@ namespace CUETools { namespace Codecs { namespace WavPack {
public: public:
WavPackWriterSettings() WavPackWriterSettings()
{ {
_md5Sum = false; _md5Sum = true;
_extraMode = 0; _extraMode = 0;
} }
@@ -314,7 +314,7 @@ namespace CUETools { namespace Codecs { namespace WavPack {
} }
} }
[DefaultValue(false)] [DefaultValue(true)]
[DisplayName("MD5")] [DisplayName("MD5")]
[Description("Calculate MD5 hash for audio stream")] [Description("Calculate MD5 hash for audio stream")]
property bool MD5Sum { property bool MD5Sum {
@@ -337,6 +337,8 @@ namespace CUETools { namespace Codecs { namespace WavPack {
public: public:
WavPackWriter(String^ path, AudioPCMConfig^ pcm) WavPackWriter(String^ path, AudioPCMConfig^ pcm)
{ {
_settings = gcnew WavPackWriterSettings();
_pcm = pcm; _pcm = pcm;
if (_pcm->ChannelCount != 1 && _pcm->ChannelCount != 2) if (_pcm->ChannelCount != 1 && _pcm->ChannelCount != 2)
@@ -504,8 +506,6 @@ namespace CUETools { namespace Codecs { namespace WavPack {
WavPackWriterSettings^ _settings; WavPackWriterSettings^ _settings;
void Initialize() { void Initialize() {
_settings = gcnew WavPackWriterSettings();
WavpackConfig config; WavpackConfig config;
_wpc = WavpackOpenFileOutput(write_block, _hFile, NULL); _wpc = WavpackOpenFileOutput(write_block, _hFile, NULL);

58
CUETools.Codecs/Local.cs Normal file
View File

@@ -0,0 +1,58 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
namespace CUETools.Codecs
{
/// <summary>
/// Localized description attribute
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
public class SRDescriptionAttribute : DescriptionAttribute
{
/// <summary>
/// Construct the description attribute
/// </summary>
/// <param name="text"></param>
public SRDescriptionAttribute(Type SR, string text)
: base(text)
{
this.localized = false;
this.SR = SR;
}
/// <summary>
/// Override the return of the description text to localize the text
/// </summary>
public override string Description
{
get
{
if (!localized)
{
localized = true;
this.DescriptionValue = SR.InvokeMember(
this.DescriptionValue,
System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic,
null,
null,
new object[] { }) as string;
}
return base.Description;
}
}
/// <summary>
/// Store a flag indicating whether this has been localized
/// </summary>
private bool localized;
/// <summary>
/// Resource manager to use;
/// </summary>
private Type SR;
}
}

View File

@@ -836,7 +836,7 @@ namespace CUETools.Processor
//string arch = asi.ApplicationId.ProcessorArchitecture; //string arch = asi.ApplicationId.ProcessorArchitecture;
//ActivationContext is null most of the time :( //ActivationContext is null most of the time :(
string arch = Marshal.SizeOf(typeof(IntPtr)) == 8 ? "x64" : "Win32"; string arch = Type.GetType("Mono.Runtime", false) != null ? "mono" : Marshal.SizeOf(typeof(IntPtr)) == 8 ? "x64" : "Win32";
string plugins_path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins (" + arch + ")"); string plugins_path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins (" + arch + ")");
if (Directory.Exists(plugins_path)) if (Directory.Exists(plugins_path))
AddPluginDirectory(plugins_path); AddPluginDirectory(plugins_path);
@@ -1665,6 +1665,7 @@ string status = processor.Go();
public int offset = 0; public int offset = 0;
public string input = string.Empty; public string input = string.Empty;
public string output = string.Empty; public string output = string.Empty;
public CUESheet cueSheet;
} }
public class CUEToolsSelectionEventArgs : EventArgs public class CUEToolsSelectionEventArgs : EventArgs
@@ -1747,6 +1748,7 @@ string status = processor.Go();
{ {
_config = config; _config = config;
_progress = new CUEToolsProgressEventArgs(); _progress = new CUEToolsProgressEventArgs();
_progress.cueSheet = this;
_attributes = new List<CUELine>(); _attributes = new List<CUELine>();
_tracks = new List<TrackInfo>(); _tracks = new List<TrackInfo>();
_trackFilenames = new List<string>(); _trackFilenames = new List<string>();
@@ -1793,6 +1795,11 @@ string status = processor.Go();
public void Close() public void Close()
{ {
if (_progress != null)
{
_progress.cueSheet = null;
_progress = null;
}
if (_archive != null) if (_archive != null)
_archive.Close(); _archive.Close();
_archive = null; _archive = null;
@@ -3142,7 +3149,7 @@ string status = processor.Go();
{ {
vars.Add("year", General.EmptyStringToNull(cueSheet.Year)); vars.Add("year", General.EmptyStringToNull(cueSheet.Year));
vars.Add("catalog", General.EmptyStringToNull(cueSheet.Catalog)); vars.Add("catalog", General.EmptyStringToNull(cueSheet.Catalog));
vars.Add("discnumber", General.EmptyStringToNull(cueSheet.DiscNumber)); vars.Add("discnumber", General.EmptyStringToNull(cueSheet.DiscNumber01));
vars.Add("totaldiscs", General.EmptyStringToNull(cueSheet.TotalDiscs)); vars.Add("totaldiscs", General.EmptyStringToNull(cueSheet.TotalDiscs));
NameValueCollection tags = cueSheet.Tags; NameValueCollection tags = cueSheet.Tags;
if (tags != null) if (tags != null)
@@ -3194,7 +3201,7 @@ string status = processor.Go();
vars.Add("album", General.EmptyStringToNull(_config.CleanseString(Title))); vars.Add("album", General.EmptyStringToNull(_config.CleanseString(Title)));
vars.Add("year", General.EmptyStringToNull(_config.CleanseString(Year))); vars.Add("year", General.EmptyStringToNull(_config.CleanseString(Year)));
vars.Add("catalog", General.EmptyStringToNull(_config.CleanseString(Catalog))); vars.Add("catalog", General.EmptyStringToNull(_config.CleanseString(Catalog)));
vars.Add("discnumber", General.EmptyStringToNull(_config.CleanseString(DiscNumber))); vars.Add("discnumber", General.EmptyStringToNull(_config.CleanseString(DiscNumber01)));
vars.Add("totaldiscs", General.EmptyStringToNull(_config.CleanseString(TotalDiscs))); vars.Add("totaldiscs", General.EmptyStringToNull(_config.CleanseString(TotalDiscs)));
vars.Add("filename", Path.GetFileNameWithoutExtension(outputPath)); vars.Add("filename", Path.GetFileNameWithoutExtension(outputPath));
vars.Add("tracknumber", null); vars.Add("tracknumber", null);
@@ -3243,7 +3250,20 @@ string status = processor.Go();
vars["artist"] = General.EmptyStringToNull(_config.CleanseString(artist)) ?? vars["album artist"]; vars["artist"] = General.EmptyStringToNull(_config.CleanseString(artist)) ?? vars["album artist"];
vars["title"] = General.EmptyStringToNull(_config.CleanseString(title)); vars["title"] = General.EmptyStringToNull(_config.CleanseString(title));
filename = (General.ReplaceMultiple(_config.trackFilenameFormat, vars, -1) ?? vars["tracknumber"]) + extension; filename = "";
for (int maxLen = 260; maxLen >= 16; maxLen--)
{
filename = General.ReplaceMultiple(_config.trackFilenameFormat, vars, maxLen);
if (filename == "" || filename == null)
{
filename = vars["tracknumber"];
break;
}
if (OutputDir.Length + filename.Length < 255)
break;
}
filename = filename + extension;
if (htoa) if (htoa)
HTOAFilename = filename; HTOAFilename = filename;
@@ -3269,31 +3289,32 @@ string status = processor.Go();
} }
} }
public bool OutputExists() public List<string> OutputExists()
{ {
bool outputExists = false; List<string> outputExists = new List<string>();
bool outputCUE = Action == CUEAction.Encode && (OutputStyle != CUEStyle.SingleFileWithCUE || _config.createCUEFileWhenEmbedded); bool outputCUE = Action == CUEAction.Encode && (OutputStyle != CUEStyle.SingleFileWithCUE || _config.createCUEFileWhenEmbedded);
bool outputAudio = Action == CUEAction.Encode && _audioEncoderType != AudioEncoderType.NoAudio; bool outputAudio = Action == CUEAction.Encode && _audioEncoderType != AudioEncoderType.NoAudio;
if (outputCUE) if (outputCUE)
outputExists = File.Exists(_outputPath); outputExists.Add(_outputPath);
if (_useAccurateRip && ( if (_useAccurateRip && (
(Action == CUEAction.Encode && _config.writeArLogOnConvert) || (Action == CUEAction.Encode && _config.writeArLogOnConvert) ||
(Action == CUEAction.Verify && _config.writeArLogOnVerify))) (Action == CUEAction.Verify && _config.writeArLogOnVerify)))
outputExists |= File.Exists(Path.Combine(OutputDir, ArLogFileName)); outputExists.Add(Path.Combine(OutputDir, ArLogFileName));
if (outputAudio) if (outputAudio)
{ {
if (_config.extractAlbumArt && AlbumArt != null && AlbumArt.Count != 0) if (_config.extractAlbumArt && AlbumArt != null && AlbumArt.Count != 0)
outputExists |= File.Exists(Path.Combine(OutputDir, AlArtFileName)); outputExists.Add(Path.Combine(OutputDir, AlArtFileName));
if (OutputStyle == CUEStyle.SingleFile || OutputStyle == CUEStyle.SingleFileWithCUE) if (OutputStyle == CUEStyle.SingleFile || OutputStyle == CUEStyle.SingleFileWithCUE)
outputExists |= File.Exists(Path.Combine(OutputDir, SingleFilename)); outputExists.Add(Path.Combine(OutputDir, SingleFilename));
else else
{ {
if (OutputStyle == CUEStyle.GapsAppended && _config.preserveHTOA) if (OutputStyle == CUEStyle.GapsAppended && _config.preserveHTOA)
outputExists |= File.Exists(Path.Combine(OutputDir, HTOAFilename)); outputExists.Add(Path.Combine(OutputDir, HTOAFilename));
for (int i = 0; i < TrackCount; i++) for (int i = 0; i < TrackCount; i++)
outputExists |= File.Exists(Path.Combine(OutputDir, TrackFilenames[i])); outputExists.Add(Path.Combine(OutputDir, TrackFilenames[i]));
} }
} }
outputExists.RemoveAll(path => !File.Exists(path));
return outputExists; return outputExists;
} }
@@ -4154,11 +4175,8 @@ string status = processor.Go();
return; return;
string imgPath = Path.Combine(OutputDir, AlArtFileName); string imgPath = Path.Combine(OutputDir, AlArtFileName);
if (File.Exists(imgPath))
return;
foreach (TagLib.IPicture picture in _albumArt) foreach (TagLib.IPicture picture in _albumArt)
using (FileStream file = new FileStream(imgPath, FileMode.CreateNew, FileAccess.Write, FileShare.Read)) using (FileStream file = new FileStream(imgPath, FileMode.Create, FileAccess.Write, FileShare.Read))
{ {
file.Write(picture.Data.Data, 0, picture.Data.Count); file.Write(picture.Data.Data, 0, picture.Data.Count);
return; return;
@@ -4249,6 +4267,8 @@ string status = processor.Go();
return; return;
foreach (TagLib.IPicture picture in _albumArt) foreach (TagLib.IPicture picture in _albumArt)
using (MemoryStream imageStream = new MemoryStream(picture.Data.Data, 0, picture.Data.Count)) using (MemoryStream imageStream = new MemoryStream(picture.Data.Data, 0, picture.Data.Count))
try
{
using (Image img = Image.FromStream(imageStream)) using (Image img = Image.FromStream(imageStream))
if (img.Width > _config.maxAlbumArtSize || img.Height > _config.maxAlbumArtSize) if (img.Width > _config.maxAlbumArtSize || img.Height > _config.maxAlbumArtSize)
{ {
@@ -4263,6 +4283,10 @@ string status = processor.Go();
} }
} }
} }
catch
{
}
}
public List<TagLib.IPicture> AlbumArt public List<TagLib.IPicture> AlbumArt
{ {
@@ -4971,27 +4995,6 @@ string status = processor.Go();
} }
} }
// Use old-fashioned way if dealing with archive (files != null)
// or with single file (filePos.Count == 1).
// In other cases we use CUESheet.ScanFolder, which
// is better at sorting and separating albums,
// but doesn't support archives and single files yet.
if (!foundAll && (files != null || filePos.Count == 1))
foreach (KeyValuePair<string, CUEToolsFormat> format in _config.formats)
{
if (files == null)
audioFiles = Directory.GetFiles(dir == "" ? "." : dir, "*." + format.Key);
else
audioFiles = files.FindAll(s => Path.GetDirectoryName(s) == dir && Path.GetExtension(s).ToLower() == "." + format.Key).ToArray();
if (audioFiles.Length == filePos.Count)
{
Array.Sort(audioFiles);
extension = format.Key;
foundAll = true;
break;
}
}
if (!foundAll && files == null) if (!foundAll && files == null)
{ {
List<FileGroupInfo> fileGroups = CUESheet.ScanFolder(_config, dir == "" ? "." : dir); List<FileGroupInfo> fileGroups = CUESheet.ScanFolder(_config, dir == "" ? "." : dir);
@@ -5050,6 +5053,27 @@ string status = processor.Go();
} }
} }
// Use old-fashioned way if dealing with archive (files != null)
// or with single file (filePos.Count == 1).
// In other cases we use CUESheet.ScanFolder, which
// is better at sorting and separating albums,
// but doesn't support archives and single files yet.
if (!foundAll)// && (files != null || filePos.Count == 1))
foreach (KeyValuePair<string, CUEToolsFormat> format in _config.formats)
{
if (files == null)
audioFiles = Directory.GetFiles(dir == "" ? "." : dir, "*." + format.Key);
else
audioFiles = files.FindAll(s => Path.GetDirectoryName(s) == dir && Path.GetExtension(s).ToLower() == "." + format.Key).ToArray();
if (audioFiles.Length == filePos.Count)
{
Array.Sort(audioFiles);
extension = format.Key;
foundAll = true;
break;
}
}
if (!foundAll) if (!foundAll)
throw new Exception("unable to locate the audio files"); throw new Exception("unable to locate the audio files");
@@ -5352,6 +5376,17 @@ string status = processor.Go();
} }
} }
public string DiscNumber01
{
get
{
uint td = 0, dn = 0;
if (uint.TryParse(TotalDiscs, out td) && uint.TryParse(DiscNumber, out dn) && td > 9 && dn > 0)
return string.Format("{0:00}", dn);
return DiscNumber;
}
}
public string DiscNumber public string DiscNumber
{ {
get get
@@ -5668,6 +5703,8 @@ string status = processor.Go();
List<FileGroupInfo> fileGroups = new List<FileGroupInfo>(); List<FileGroupInfo> fileGroups = new List<FileGroupInfo>();
foreach (FileSystemInfo file in files) foreach (FileSystemInfo file in files)
{ {
// file.Refresh();
// file.Attributes returns -1 for long paths!!!
if ((file.Attributes & FileAttributes.Hidden) != 0) if ((file.Attributes & FileAttributes.Hidden) != 0)
continue; continue;
if ((file.Attributes & FileAttributes.Directory) != 0) if ((file.Attributes & FileAttributes.Directory) != 0)
@@ -5704,7 +5741,11 @@ string status = processor.Go();
line = Path.Combine(Path.GetDirectoryName(file.FullName), line); line = Path.Combine(Path.GetDirectoryName(file.FullName), line);
if (File.Exists(line)) if (File.Exists(line))
{ {
m3uGroup.files.Add(new FileInfo(line)); FileInfo f = new FileInfo(line);
CUEToolsFormat fmt1;
if (!f.Extension.StartsWith(".") || !_config.formats.TryGetValue(f.Extension.ToLower().Substring(1), out fmt1) || !fmt1.allowLossless)
throw new Exception("not lossless");
m3uGroup.files.Add(f);
continue; continue;
} }
} }
@@ -5805,7 +5846,7 @@ string status = processor.Go();
foreach (FileGroupInfo group in fileGroups) foreach (FileGroupInfo group in fileGroups)
if (group.type == FileGroupInfoType.TrackFiles) if (group.type == FileGroupInfoType.TrackFiles)
{ {
group.files.Sort(group.CompareNumbers); group.files.Sort(group.Compare());
group.numbers = null; group.numbers = null;
group.TOC = new CDImageLayout(); group.TOC = new CDImageLayout();
foreach(FileSystemInfo f in group.files) foreach(FileSystemInfo f in group.files)
@@ -5819,6 +5860,7 @@ string status = processor.Go();
group.TOC.AddTrack(new CDTrack((uint)group.TOC.TrackCount + 1, group.TOC.Length, len, true, false)); group.TOC.AddTrack(new CDTrack((uint)group.TOC.TrackCount + 1, group.TOC.Length, len, true, false));
} }
} }
fileGroups.Sort(FileGroupInfo.Compare);
return fileGroups; return fileGroups;
} }
@@ -6034,6 +6076,25 @@ string status = processor.Go();
return na; return na;
} }
public static int Compare(FileGroupInfo a, FileGroupInfo b)
{
if (a.type == b.type)
return CompareTrackNames(a.main.FullName, b.main.FullName);
return Comparer<FileGroupInfoType>.Default.Compare(a.type, b.type);
}
public Comparison<FileSystemInfo> Compare()
{
if (files.Find(f => !numbers.ContainsKey(f)) == null)
return (a, b) => Comparer<uint>.Default.Compare(numbers[a], numbers[b]);
return CompareTrackNames;
}
public static int CompareTrackNames(FileSystemInfo a, FileSystemInfo b)
{
return CompareTrackNames(a.FullName, b.FullName);
}
public static int CompareTrackNames(string a, string b) public static int CompareTrackNames(string a, string b)
{ {
while (a.Length > 0 && b.Length > 0 && a[0] == b[0]) while (a.Length > 0 && b.Length > 0 && a[0] == b[0])
@@ -6050,15 +6111,6 @@ string status = processor.Go();
return CompareTrackNames(a, b); return CompareTrackNames(a, b);
} }
public int CompareNumbers(FileSystemInfo a, FileSystemInfo b)
{
if (numbers.ContainsKey(a) && numbers.ContainsKey(b))
return Comparer<uint>.Default.Compare(numbers[a], numbers[b]);
if (!numbers.ContainsKey(a) && !numbers.ContainsKey(b))
return CompareTrackNames(a.FullName, b.FullName);
return Comparer<bool>.Default.Compare(numbers.ContainsKey(a), numbers.ContainsKey(b));
}
public bool Contains(string pathIn) public bool Contains(string pathIn)
{ {
if (type != FileGroupInfoType.TrackFiles) if (type != FileGroupInfoType.TrackFiles)

View File

@@ -79,7 +79,7 @@ namespace CUETools.Ripper.SCSI {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to not an MMC device. /// Looks up a localized string similar to Not an MMC device.
/// </summary> /// </summary>
internal static string DeviceNotMMC { internal static string DeviceNotMMC {
get { get {
@@ -97,7 +97,7 @@ namespace CUETools.Ripper.SCSI {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to no audio. /// Looks up a localized string similar to No audio tracks.
/// </summary> /// </summary>
internal static string NoAudio { internal static string NoAudio {
get { get {

View File

@@ -124,13 +124,13 @@
<value>Error querying drive</value> <value>Error querying drive</value>
</data> </data>
<data name="DeviceNotMMC" xml:space="preserve"> <data name="DeviceNotMMC" xml:space="preserve">
<value>not an MMC device</value> <value>Not an MMC device</value>
</data> </data>
<data name="DeviceOpenError" xml:space="preserve"> <data name="DeviceOpenError" xml:space="preserve">
<value>Open failed</value> <value>Open failed</value>
</data> </data>
<data name="NoAudio" xml:space="preserve"> <data name="NoAudio" xml:space="preserve">
<value>no audio</value> <value>No audio tracks</value>
</data> </data>
<data name="ReadCDError" xml:space="preserve"> <data name="ReadCDError" xml:space="preserve">
<value>Error reading CD</value> <value>Error reading CD</value>

View File

@@ -124,13 +124,13 @@
<value>Ошибка при опросе устройства</value> <value>Ошибка при опросе устройства</value>
</data> </data>
<data name="DeviceNotMMC" xml:space="preserve"> <data name="DeviceNotMMC" xml:space="preserve">
<value>устройство не поддерживает стандарт MMC</value> <value>Устройство не поддерживает стандарт MMC</value>
</data> </data>
<data name="DeviceOpenError" xml:space="preserve"> <data name="DeviceOpenError" xml:space="preserve">
<value>Ошибка при открытии устройства</value> <value>Ошибка при открытии устройства</value>
</data> </data>
<data name="NoAudio" xml:space="preserve"> <data name="NoAudio" xml:space="preserve">
<value>отсутствует аудио</value> <value>Отсутствуют аудио-треки</value>
</data> </data>
<data name="ReadCDError" xml:space="preserve"> <data name="ReadCDError" xml:space="preserve">
<value>Ошибка при чтении диска</value> <value>Ошибка при чтении диска</value>

View File

@@ -193,6 +193,8 @@ namespace CUETools.Ripper.SCSI
{ {
Device.CommandStatus st; Device.CommandStatus st;
m_inqury_result = null;
// Open the base device // Open the base device
m_device_letter = Drive; m_device_letter = Drive;
if (m_device != null) if (m_device != null)
@@ -200,14 +202,15 @@ namespace CUETools.Ripper.SCSI
m_device = new Device(m_logger); m_device = new Device(m_logger);
if (!m_device.Open(m_device_letter)) if (!m_device.Open(m_device_letter))
throw new Exception(Resource1.DeviceOpenError + ": " + WinDev.Win32ErrorToString(m_device.LastError)); throw new ReadCDException(Resource1.DeviceOpenError, Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()));
//throw new ReadCDException(Resource1.DeviceOpenError + ": " + WinDev.Win32ErrorToString(m_device.LastError));
// Get device info // Get device info
st = m_device.Inquiry(out m_inqury_result); st = m_device.Inquiry(out m_inqury_result);
if (st != Device.CommandStatus.Success || !m_inqury_result.Valid) if (st != Device.CommandStatus.Success)
throw new SCSIException(Resource1.DeviceInquiryError, m_device, st); throw new SCSIException(Resource1.DeviceInquiryError, m_device, st);
if (m_inqury_result.PeripheralQualifier != 0 || m_inqury_result.PeripheralDeviceType != Device.MMCDeviceType) if (!m_inqury_result.Valid || m_inqury_result.PeripheralQualifier != 0 || m_inqury_result.PeripheralDeviceType != Device.MMCDeviceType)
throw new Exception(Path + ": " + Resource1.DeviceNotMMC); throw new ReadCDException(Resource1.DeviceNotMMC);
m_max_sectors = Math.Min(NSECTORS, m_device.MaximumTransferLength / CB_AUDIO - 1); m_max_sectors = Math.Min(NSECTORS, m_device.MaximumTransferLength / CB_AUDIO - 1);
//// Open/Initialize the driver //// Open/Initialize the driver
@@ -276,7 +279,8 @@ namespace CUETools.Ripper.SCSI
if (_toc[1].IsAudio) if (_toc[1].IsAudio)
_toc[1][0].Start = 0; _toc[1][0].Start = 0;
Position = 0; Position = 0;
} } else
throw new ReadCDException(Resource1.NoAudio);
UserData = new long[MSECTORS, 2, 4 * 588]; UserData = new long[MSECTORS, 2, 4 * 588];
C2Count = new byte[MSECTORS, 294]; C2Count = new byte[MSECTORS, 294];
@@ -565,7 +569,7 @@ namespace CUETools.Ripper.SCSI
public unsafe bool DetectGaps() public unsafe bool DetectGaps()
{ {
if (!TestReadCommand()) if (!TestReadCommand())
throw new Exception(Resource1.AutodetectReadCommandFailed+ ":\n" + _autodetectResult); throw new ReadCDException(Resource1.AutodetectReadCommandFailed + ":\n" + _autodetectResult);
if (_gapDetection == GapDetectionMethod.None) if (_gapDetection == GapDetectionMethod.None)
{ {
@@ -964,7 +968,7 @@ namespace CUETools.Ripper.SCSI
return; return;
if (!TestReadCommand()) if (!TestReadCommand())
throw new Exception(Resource1.AutodetectReadCommandFailed + "\n" + _autodetectResult); throw new ReadCDException(Resource1.AutodetectReadCommandFailed + "\n" + _autodetectResult);
_currentStart = iSector; _currentStart = iSector;
_currentEnd = _currentStart + MSECTORS; _currentEnd = _currentStart + MSECTORS;
@@ -1041,7 +1045,7 @@ namespace CUETools.Ripper.SCSI
public unsafe int Read(AudioBuffer buff, int maxLength) public unsafe int Read(AudioBuffer buff, int maxLength)
{ {
if (_toc == null) if (_toc == null)
throw new Exception("Read: invalid TOC"); throw new ReadCDException("Read: invalid TOC");
buff.Prepare(this, maxLength); buff.Prepare(this, maxLength);
if (Position >= Length) if (Position >= Length)
return 0; return 0;
@@ -1081,7 +1085,7 @@ namespace CUETools.Ripper.SCSI
get get
{ {
if (_toc == null) if (_toc == null)
throw new Exception("invalid TOC"); throw new ReadCDException("invalid TOC");
return 588 * (int)_toc.AudioLength; return 588 * (int)_toc.AudioLength;
} }
} }
@@ -1099,6 +1103,7 @@ namespace CUETools.Ripper.SCSI
get get
{ {
string result = m_device_letter + ": "; string result = m_device_letter + ": ";
if (m_inqury_result != null && m_inqury_result.Valid)
result += "[" + m_inqury_result.VendorIdentification + " " + result += "[" + m_inqury_result.VendorIdentification + " " +
m_inqury_result.ProductIdentification + " " + m_inqury_result.ProductIdentification + " " +
m_inqury_result.FirmwareVersion + "]"; m_inqury_result.FirmwareVersion + "]";
@@ -1110,7 +1115,9 @@ namespace CUETools.Ripper.SCSI
{ {
get get
{ {
return m_inqury_result.VendorIdentification.TrimEnd(' ', '\0').PadRight(8, ' ') + " - " + m_inqury_result.ProductIdentification.TrimEnd(' ', '\0'); return m_inqury_result == null || !m_inqury_result.Valid ? null :
m_inqury_result.VendorIdentification.TrimEnd(' ', '\0').PadRight(8, ' ') + " - " +
m_inqury_result.ProductIdentification.TrimEnd(' ', '\0');
} }
} }
@@ -1131,7 +1138,7 @@ namespace CUETools.Ripper.SCSI
set set
{ {
if (_toc == null || _toc.AudioLength <= 0) if (_toc == null || _toc.AudioLength <= 0)
throw new Exception(Resource1.NoAudio); throw new ReadCDException(Resource1.NoAudio);
_crcErrorsCount = 0; _crcErrorsCount = 0;
_errorsCount = 0; _errorsCount = 0;
_currentStart = -1; _currentStart = -1;
@@ -1217,4 +1224,12 @@ namespace CUETools.Ripper.SCSI
{ {
} }
} }
public sealed class ReadCDException : Exception
{
public ReadCDException(string args, Exception inner)
: base(args + ": " + inner.Message, inner) { }
public ReadCDException(string args)
: base(args) { }
}
} }

View File

@@ -0,0 +1,80 @@
using CUETools.Processor;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CUETools.TestCodecs
{
/// <summary>
///This is a test class for FileGroupInfoTest and is intended
///to contain all FileGroupInfoTest Unit Tests
///</summary>
[TestClass()]
public class FileGroupInfoTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for CompareTrackNames
///</summary>
[TestMethod()]
public void CompareTrackNamesTest()
{
string a = string.Empty; // TODO: Initialize to an appropriate value
string b = string.Empty; // TODO: Initialize to an appropriate value
int expected = 0; // TODO: Initialize to an appropriate value
int actual;
actual = FileGroupInfo.CompareTrackNames(a, b);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
}
}

View File

@@ -96,6 +96,12 @@
<Compile Include="frmChoice.Designer.cs"> <Compile Include="frmChoice.Designer.cs">
<DependentUpon>frmChoice.cs</DependentUpon> <DependentUpon>frmChoice.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="frmOverwrite.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmOverwrite.Designer.cs">
<DependentUpon>frmOverwrite.cs</DependentUpon>
</Compile>
<Compile Include="frmPassword.cs"> <Compile Include="frmPassword.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -158,6 +164,9 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<DependentUpon>frmCUETools.cs</DependentUpon> <DependentUpon>frmCUETools.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="frmOverwrite.resx">
<DependentUpon>frmOverwrite.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPassword.de-DE.resx"> <EmbeddedResource Include="frmPassword.de-DE.resx">
<DependentUpon>frmPassword.cs</DependentUpon> <DependentUpon>frmPassword.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@@ -35,6 +35,7 @@ namespace JDP {
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.textBatchReport = new System.Windows.Forms.TextBox(); this.textBatchReport = new System.Windows.Forms.TextBox();
this.grpInput = new System.Windows.Forms.GroupBox(); this.grpInput = new System.Windows.Forms.GroupBox();
this.fileSystemTreeView1 = new CUEControls.FileSystemTreeView();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.groupBoxMode = new System.Windows.Forms.GroupBox(); this.groupBoxMode = new System.Windows.Forms.GroupBox();
this.tableLayoutPanelCUEStyle = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanelCUEStyle = new System.Windows.Forms.TableLayoutPanel();
@@ -120,7 +121,6 @@ namespace JDP {
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.setAsMyMusicFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setAsMyMusicFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.resetToOriginalLocationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resetToOriginalLocationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileSystemTreeView1 = new CUEControls.FileSystemTreeView();
this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
@@ -254,6 +254,33 @@ namespace JDP {
this.grpInput.Name = "grpInput"; this.grpInput.Name = "grpInput";
this.grpInput.TabStop = false; this.grpInput.TabStop = false;
// //
// fileSystemTreeView1
//
this.fileSystemTreeView1.AllowDrop = true;
resources.ApplyResources(this.fileSystemTreeView1, "fileSystemTreeView1");
this.fileSystemTreeView1.BackColor = System.Drawing.SystemColors.Control;
this.fileSystemTreeView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.fileSystemTreeView1.CheckBoxes = true;
this.fileSystemTreeView1.FullRowSelect = true;
this.fileSystemTreeView1.HideSelection = false;
this.fileSystemTreeView1.ItemHeight = 16;
this.fileSystemTreeView1.Name = "fileSystemTreeView1";
this.fileSystemTreeView1.ShowLines = false;
this.fileSystemTreeView1.ShowRootLines = false;
this.fileSystemTreeView1.SpecialFolders = new CUEControls.ExtraSpecialFolder[] {
CUEControls.ExtraSpecialFolder.MyComputer,
CUEControls.ExtraSpecialFolder.Profile,
CUEControls.ExtraSpecialFolder.MyMusic,
CUEControls.ExtraSpecialFolder.CommonMusic};
this.fileSystemTreeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.fileSystemTreeView1_AfterCheck);
this.fileSystemTreeView1.NodeExpand += new CUEControls.FileSystemTreeViewNodeExpandHandler(this.fileSystemTreeView1_NodeExpand);
this.fileSystemTreeView1.DragDrop += new System.Windows.Forms.DragEventHandler(this.fileSystemTreeView1_DragDrop);
this.fileSystemTreeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.fileSystemTreeView1_AfterSelect);
this.fileSystemTreeView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.fileSystemTreeView1_MouseDown);
this.fileSystemTreeView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.fileSystemTreeView1_KeyDown);
this.fileSystemTreeView1.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.fileSystemTreeView1_AfterExpand);
this.fileSystemTreeView1.DragOver += new System.Windows.Forms.DragEventHandler(this.fileSystemTreeView1_DragOver);
//
// tableLayoutPanel2 // tableLayoutPanel2
// //
resources.ApplyResources(this.tableLayoutPanel2, "tableLayoutPanel2"); resources.ApplyResources(this.tableLayoutPanel2, "tableLayoutPanel2");
@@ -969,33 +996,6 @@ namespace JDP {
resources.ApplyResources(this.resetToOriginalLocationToolStripMenuItem, "resetToOriginalLocationToolStripMenuItem"); resources.ApplyResources(this.resetToOriginalLocationToolStripMenuItem, "resetToOriginalLocationToolStripMenuItem");
this.resetToOriginalLocationToolStripMenuItem.Click += new System.EventHandler(this.resetToOriginalLocationToolStripMenuItem_Click); this.resetToOriginalLocationToolStripMenuItem.Click += new System.EventHandler(this.resetToOriginalLocationToolStripMenuItem_Click);
// //
// fileSystemTreeView1
//
this.fileSystemTreeView1.AllowDrop = true;
resources.ApplyResources(this.fileSystemTreeView1, "fileSystemTreeView1");
this.fileSystemTreeView1.BackColor = System.Drawing.SystemColors.Control;
this.fileSystemTreeView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.fileSystemTreeView1.CheckBoxes = true;
this.fileSystemTreeView1.FullRowSelect = true;
this.fileSystemTreeView1.HideSelection = false;
this.fileSystemTreeView1.ItemHeight = 16;
this.fileSystemTreeView1.Name = "fileSystemTreeView1";
this.fileSystemTreeView1.ShowLines = false;
this.fileSystemTreeView1.ShowRootLines = false;
this.fileSystemTreeView1.SpecialFolders = new CUEControls.ExtraSpecialFolder[] {
CUEControls.ExtraSpecialFolder.MyComputer,
CUEControls.ExtraSpecialFolder.Profile,
CUEControls.ExtraSpecialFolder.MyMusic,
CUEControls.ExtraSpecialFolder.CommonMusic};
this.fileSystemTreeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.fileSystemTreeView1_AfterCheck);
this.fileSystemTreeView1.NodeExpand += new CUEControls.FileSystemTreeViewNodeExpandHandler(this.fileSystemTreeView1_NodeExpand);
this.fileSystemTreeView1.DragDrop += new System.Windows.Forms.DragEventHandler(this.fileSystemTreeView1_DragDrop);
this.fileSystemTreeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.fileSystemTreeView1_AfterSelect);
this.fileSystemTreeView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.fileSystemTreeView1_MouseDown);
this.fileSystemTreeView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.fileSystemTreeView1_KeyDown);
this.fileSystemTreeView1.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.fileSystemTreeView1_AfterExpand);
this.fileSystemTreeView1.DragOver += new System.Windows.Forms.DragEventHandler(this.fileSystemTreeView1_DragOver);
//
// frmCUETools // frmCUETools
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");

View File

@@ -83,6 +83,8 @@ namespace JDP {
} }
} }
DialogResult overwriteResult = DialogResult.None;
private void btnConvert_Click(object sender, EventArgs e) { private void btnConvert_Click(object sender, EventArgs e) {
if ((_workThread != null) && (_workThread.IsAlive)) if ((_workThread != null) && (_workThread.IsAlive))
return; return;
@@ -98,6 +100,7 @@ namespace JDP {
_batchReport = new StringBuilder(); _batchReport = new StringBuilder();
_batchRoot = null; _batchRoot = null;
_batchProcessed = 0; _batchProcessed = 0;
overwriteResult = DialogResult.None;
// TODO!!! // TODO!!!
//if (SelectedOutputAudioFmt != null) //if (SelectedOutputAudioFmt != null)
@@ -778,20 +781,8 @@ namespace JDP {
this.Invoke((MethodInvoker)delegate() this.Invoke((MethodInvoker)delegate()
{ {
toolStripStatusLabelAR.Enabled = cueSheet.ArVerify.ARStatus == null;
toolStripStatusLabelAR.Visible = useAR; toolStripStatusLabelAR.Visible = useAR;
toolStripStatusLabelAR.Text = cueSheet.ArVerify.ARStatus == null ? cueSheet.ArVerify.WorstTotal().ToString() : ""; toolStripStatusLabelCTDB.Visible = useCUEToolsDB;
toolStripStatusLabelAR.ToolTipText = "AccurateRip: " + (cueSheet.ArVerify.ARStatus ?? "found") + ".";
if (!useCUEToolsDB)
toolStripStatusLabelCTDB.Visible = false;
else
{
toolStripStatusLabelCTDB.Visible = true;
toolStripStatusLabelCTDB.Enabled = cueSheet.CTDB.DBStatus == null;
toolStripStatusLabelCTDB.Text = cueSheet.CTDB.DBStatus == null ? cueSheet.CTDB.Total.ToString() : "";
toolStripStatusLabelCTDB.ToolTipText = "CUETools DB: " + (cueSheet.CTDB.DBStatus ?? "found") + ".";
}
if (releases != null) if (releases != null)
{ {
@@ -818,28 +809,37 @@ namespace JDP {
cueSheet.GenerateFilenames(audioEncoderType, outputFormat, pathOut); cueSheet.GenerateFilenames(audioEncoderType, outputFormat, pathOut);
bool outputExists = cueSheet.OutputExists(); List<string> outputExists = cueSheet.OutputExists();
dlgRes = DialogResult.Cancel; dlgRes = DialogResult.Cancel;
if (outputExists) if (outputExists.Count > 0)
{ {
this.Invoke((MethodInvoker)delegate() this.Invoke((MethodInvoker)delegate()
{ {
dlgRes = MessageBox.Show(this, "One or more output file already exists, " + if (overwriteResult == DialogResult.None)
"do you want to overwrite?", "Overwrite?", (_batchPaths.Count == 0) ? {
MessageBoxButtons.YesNo : MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); using (frmOverwrite frm = new frmOverwrite())
{
outputExists.ForEach(path => frm.textFiles.AppendText(path + "\n"));
dlgRes = frm.ShowDialog(this);
if (frm.checkBoxRemember.Checked)
overwriteResult = dlgRes;
}
}
else
dlgRes = overwriteResult;
if (dlgRes == DialogResult.Yes) if (dlgRes == DialogResult.Yes)
outputExists = false; outputExists.Clear();
else if (_batchPaths.Count == 0) else if (_batchPaths.Count == 0)
SetupControls(false); SetupControls(false);
}); });
if (outputExists && _batchPaths.Count == 0) if (outputExists.Count > 0 && _batchPaths.Count == 0)
{ {
cueSheet.Close(); cueSheet.Close();
return; return;
} }
} }
if (!outputExists) if (outputExists.Count == 0)
{ {
cueSheet.UsePregapForFirstTrackInSingleFile = _usePregapForFirstTrackInSingleFile && !outputAudio; cueSheet.UsePregapForFirstTrackInSingleFile = _usePregapForFirstTrackInSingleFile && !outputAudio;
if (script == null) if (script == null)
@@ -988,7 +988,8 @@ namespace JDP {
public void SetStatus(object sender, CUEToolsProgressEventArgs e) public void SetStatus(object sender, CUEToolsProgressEventArgs e)
{ {
this.BeginInvoke((MethodInvoker)delegate() { this.BeginInvoke((MethodInvoker)delegate()
{
if (e.percent == 0) if (e.percent == 0)
{ {
_startedAt = DateTime.Now; _startedAt = DateTime.Now;
@@ -1011,6 +1012,13 @@ namespace JDP {
} }
toolStripStatusLabel1.Text = e.status; toolStripStatusLabel1.Text = e.status;
toolStripProgressBar2.Value = Math.Max(0, Math.Min(100, (int)(e.percent * 100))); toolStripProgressBar2.Value = Math.Max(0, Math.Min(100, (int)(e.percent * 100)));
toolStripStatusLabelAR.Enabled = e.cueSheet != null && e.cueSheet.ArVerify != null && e.cueSheet.ArVerify.ARStatus == null;
toolStripStatusLabelAR.Text = e.cueSheet != null && e.cueSheet.ArVerify != null && e.cueSheet.ArVerify.ExceptionStatus == WebExceptionStatus.Success ? e.cueSheet.ArVerify.WorstTotal().ToString() : "";
toolStripStatusLabelAR.ToolTipText = e.cueSheet != null && e.cueSheet.ArVerify != null ? "AccurateRip: " + (e.cueSheet.ArVerify.ARStatus ?? "found") + "." : "";
toolStripStatusLabelCTDB.Enabled = e.cueSheet != null && e.cueSheet.CTDB != null && e.cueSheet.CTDB.DBStatus == null;
toolStripStatusLabelCTDB.Text = e.cueSheet != null && e.cueSheet.CTDB != null && e.cueSheet.CTDB.DBStatus == null ? e.cueSheet.CTDB.Total.ToString() : "";
toolStripStatusLabelCTDB.ToolTipText = e.cueSheet != null && e.cueSheet.CTDB != null ? "CUETools DB: " + (e.cueSheet.CTDB.DBStatus ?? "found") + "." : "";
}); });
} }
@@ -1664,7 +1672,8 @@ namespace JDP {
&& ((File.Exists(pathIn) && Path.GetExtension(pathIn).ToLower() == ".cue") && ((File.Exists(pathIn) && Path.GetExtension(pathIn).ToLower() == ".cue")
|| Directory.Exists(pathIn)); || Directory.Exists(pathIn));
rbActionCreateCUESheet.Enabled = pathIn.Length != 0 rbActionCreateCUESheet.Enabled = pathIn.Length != 0
&& ((File.Exists(pathIn) && CUESheet.CreateDummyCUESheet(_profile._config, pathIn) != null) && ((File.Exists(pathIn) && Path.GetExtension(pathIn).ToLower() != ".cue")
//&& ((File.Exists(pathIn) && CUESheet.CreateDummyCUESheet(_profile._config, pathIn) != null) -- too slow
|| Directory.Exists(pathIn)); || Directory.Exists(pathIn));
rbActionVerify.Enabled = rbActionVerify.Enabled =
rbActionEncode.Enabled = pathIn.Length != 0 rbActionEncode.Enabled = pathIn.Length != 0

120
CUETools/frmOverwrite.Designer.cs generated Normal file
View File

@@ -0,0 +1,120 @@
namespace JDP
{
partial class frmOverwrite
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonNo = new System.Windows.Forms.Button();
this.buttonYes = new System.Windows.Forms.Button();
this.checkBoxRemember = new System.Windows.Forms.CheckBox();
this.labelAlreadyExist = new System.Windows.Forms.Label();
this.textFiles = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// buttonNo
//
this.buttonNo.DialogResult = System.Windows.Forms.DialogResult.No;
this.buttonNo.Location = new System.Drawing.Point(587, 278);
this.buttonNo.Name = "buttonNo";
this.buttonNo.Size = new System.Drawing.Size(75, 23);
this.buttonNo.TabIndex = 0;
this.buttonNo.Text = "No";
this.buttonNo.UseVisualStyleBackColor = true;
//
// buttonYes
//
this.buttonYes.DialogResult = System.Windows.Forms.DialogResult.Yes;
this.buttonYes.Location = new System.Drawing.Point(506, 278);
this.buttonYes.Name = "buttonYes";
this.buttonYes.Size = new System.Drawing.Size(75, 23);
this.buttonYes.TabIndex = 1;
this.buttonYes.Text = "Yes";
this.buttonYes.UseVisualStyleBackColor = true;
//
// checkBoxRemember
//
this.checkBoxRemember.AutoSize = true;
this.checkBoxRemember.Location = new System.Drawing.Point(12, 282);
this.checkBoxRemember.Name = "checkBoxRemember";
this.checkBoxRemember.Size = new System.Drawing.Size(128, 17);
this.checkBoxRemember.TabIndex = 3;
this.checkBoxRemember.Text = "Remember my choice";
this.checkBoxRemember.UseVisualStyleBackColor = true;
//
// labelAlreadyExist
//
this.labelAlreadyExist.AutoSize = true;
this.labelAlreadyExist.Location = new System.Drawing.Point(201, 283);
this.labelAlreadyExist.Name = "labelAlreadyExist";
this.labelAlreadyExist.Size = new System.Drawing.Size(203, 13);
this.labelAlreadyExist.TabIndex = 2;
this.labelAlreadyExist.Text = "Some of the files already exist. Overwrite?";
//
// textFiles
//
this.textFiles.Font = new System.Drawing.Font("Courier New", 8.25F);
this.textFiles.Location = new System.Drawing.Point(9, 9);
this.textFiles.Margin = new System.Windows.Forms.Padding(0);
this.textFiles.Multiline = true;
this.textFiles.Name = "textFiles";
this.textFiles.ReadOnly = true;
this.textFiles.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textFiles.Size = new System.Drawing.Size(656, 254);
this.textFiles.TabIndex = 4;
this.textFiles.TabStop = false;
this.textFiles.WordWrap = false;
//
// frmOverwrite
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(674, 313);
this.Controls.Add(this.textFiles);
this.Controls.Add(this.labelAlreadyExist);
this.Controls.Add(this.checkBoxRemember);
this.Controls.Add(this.buttonYes);
this.Controls.Add(this.buttonNo);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmOverwrite";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Overwrite?";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonNo;
private System.Windows.Forms.Button buttonYes;
private System.Windows.Forms.Label labelAlreadyExist;
internal System.Windows.Forms.TextBox textFiles;
internal System.Windows.Forms.CheckBox checkBoxRemember;
}
}

18
CUETools/frmOverwrite.cs Normal file
View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace JDP
{
public partial class frmOverwrite : Form
{
public frmOverwrite()
{
InitializeComponent();
}
}
}

120
CUETools/frmOverwrite.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -527,7 +527,7 @@ namespace JDP {
// checkBoxEncoderLossless // checkBoxEncoderLossless
// //
resources.ApplyResources(this.checkBoxEncoderLossless, "checkBoxEncoderLossless"); resources.ApplyResources(this.checkBoxEncoderLossless, "checkBoxEncoderLossless");
this.checkBoxEncoderLossless.DataBindings.Add(new System.Windows.Forms.Binding("CheckState", this.encodersBindingSource, "Lossless", true)); this.checkBoxEncoderLossless.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.encodersBindingSource, "Lossless", true));
this.checkBoxEncoderLossless.Name = "checkBoxEncoderLossless"; this.checkBoxEncoderLossless.Name = "checkBoxEncoderLossless";
this.toolTip1.SetToolTip(this.checkBoxEncoderLossless, resources.GetString("checkBoxEncoderLossless.ToolTip")); this.toolTip1.SetToolTip(this.checkBoxEncoderLossless, resources.GetString("checkBoxEncoderLossless.ToolTip"));
this.checkBoxEncoderLossless.UseVisualStyleBackColor = true; this.checkBoxEncoderLossless.UseVisualStyleBackColor = true;
@@ -697,7 +697,7 @@ namespace JDP {
// checkBoxCopyAlbumArt // checkBoxCopyAlbumArt
// //
resources.ApplyResources(this.checkBoxCopyAlbumArt, "checkBoxCopyAlbumArt"); resources.ApplyResources(this.checkBoxCopyAlbumArt, "checkBoxCopyAlbumArt");
this.checkBoxCopyAlbumArt.DataBindings.Add(new System.Windows.Forms.Binding("CheckState", this.cUEConfigBindingSource, "CopyAlbumArt", true)); this.checkBoxCopyAlbumArt.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.cUEConfigBindingSource, "CopyAlbumArt", true));
this.checkBoxCopyAlbumArt.Name = "checkBoxCopyAlbumArt"; this.checkBoxCopyAlbumArt.Name = "checkBoxCopyAlbumArt";
this.checkBoxCopyAlbumArt.UseVisualStyleBackColor = true; this.checkBoxCopyAlbumArt.UseVisualStyleBackColor = true;
// //
@@ -1127,7 +1127,6 @@ namespace JDP {
this.listBoxEncoders.BorderStyle = System.Windows.Forms.BorderStyle.None; this.listBoxEncoders.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listBoxEncoders.DataSource = this.encodersBindingSource; this.listBoxEncoders.DataSource = this.encodersBindingSource;
this.listBoxEncoders.DisplayMember = "Name"; this.listBoxEncoders.DisplayMember = "Name";
this.listBoxEncoders.FormattingEnabled = true;
resources.ApplyResources(this.listBoxEncoders, "listBoxEncoders"); resources.ApplyResources(this.listBoxEncoders, "listBoxEncoders");
this.listBoxEncoders.Name = "listBoxEncoders"; this.listBoxEncoders.Name = "listBoxEncoders";
this.listBoxEncoders.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBoxEncoders_KeyDown); this.listBoxEncoders.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBoxEncoders_KeyDown);

View File

@@ -35,6 +35,7 @@ namespace JDP {
private void frmSettings_Load(object sender, EventArgs e) private void frmSettings_Load(object sender, EventArgs e)
{ {
cUEConfigBindingSource.DataSource = _config; cUEConfigBindingSource.DataSource = _config;
encodersBindingSource.DataMember = "Encoders"; // for MONO bug (setting BindingSource.DataSource clears DataMember:(
propertyGrid1.SelectedObject = _config.advanced; propertyGrid1.SelectedObject = _config.advanced;
chkReducePriority.Checked = _reducePriority; chkReducePriority.Checked = _reducePriority;
@@ -476,26 +477,36 @@ namespace JDP {
private void encodersBindingSource_CurrentItemChanged(object sender, EventArgs e) private void encodersBindingSource_CurrentItemChanged(object sender, EventArgs e)
{ {
CUEToolsUDC encoder = encodersBindingSource.Current as CUEToolsUDC; CUEToolsUDC encoder = encodersBindingSource.Current as CUEToolsUDC;
if (encoder == null)
{
labelEncoderExtension.Visible =
comboBoxEncoderExtension.Visible =
comboBoxEncoderExtension.Enabled =
groupBoxExternalEncoder.Visible =
checkBoxEncoderLossless.Enabled =
propertyGridEncoderSettings.Visible = false;
propertyGridEncoderSettings.SelectedObject = null;
}
else
{
CUEToolsFormat format = _config.formats[encoder.extension]; // _config.formats.TryGetValue(encoder.extension, out format) CUEToolsFormat format = _config.formats[encoder.extension]; // _config.formats.TryGetValue(encoder.extension, out format)
labelEncoderExtension.Visible = true;
labelEncoderExtension.Visible = encoder != null; comboBoxEncoderExtension.Visible = true;
comboBoxEncoderExtension.Visible = encoder != null; comboBoxEncoderExtension.Enabled = encoder.path != null;
comboBoxEncoderExtension.Enabled = encoder != null && encoder.path != null; groupBoxExternalEncoder.Visible = encoder.path != null;
groupBoxExternalEncoder.Visible = encoder != null && encoder.path != null; checkBoxEncoderLossless.Enabled = format != null && format.allowLossless && format.allowLossy;
checkBoxEncoderLossless.Enabled = encoder != null && format != null && format.allowLossless && format.allowLossy; if (!checkBoxEncoderLossless.Enabled && format != null && encoder.Lossless != format.allowLossless)
if (!checkBoxEncoderLossless.Enabled && encoder != null && format != null && encoder.Lossless != format.allowLossless)
encoder.Lossless = format.allowLossless; encoder.Lossless = format.allowLossless;
if (encoder.settingsSerializer != null)
if (encoder != null && encoder.settingsSerializer != null)
{ {
propertyGridEncoderSettings.Visible = encoder != null && encoder.settingsSerializer != null; propertyGridEncoderSettings.Visible = encoder != null && encoder.settingsSerializer != null;
propertyGridEncoderSettings.SelectedObject = encoder.settings; propertyGridEncoderSettings.SelectedObject = encoder.settings;
} else }
else
{ {
propertyGridEncoderSettings.Visible = false; propertyGridEncoderSettings.Visible = false;
propertyGridEncoderSettings.SelectedObject = null; propertyGridEncoderSettings.SelectedObject = null;
} }
foreach (KeyValuePair<string, CUEToolsFormat> fmtEntry in _config.formats) foreach (KeyValuePair<string, CUEToolsFormat> fmtEntry in _config.formats)
{ {
CUEToolsFormat fmt = fmtEntry.Value; CUEToolsFormat fmt = fmtEntry.Value;
@@ -505,6 +516,7 @@ namespace JDP {
fmt.encoderLossy = null; fmt.encoderLossy = null;
} }
} }
}
private void listBoxEncoders_KeyDown(object sender, KeyEventArgs e) private void listBoxEncoders_KeyDown(object sender, KeyEventArgs e)
{ {

File diff suppressed because it is too large Load Diff