Commit files I missed with the previous commit.

This commit is contained in:
karamanolev
2011-10-25 11:54:20 +00:00
parent c4cdfc58f2
commit a71f86b680
3 changed files with 2658 additions and 2631 deletions

View File

@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using CUETools.Processor; using CUETools.Processor;
@@ -27,7 +25,8 @@ namespace ArCueDotNet
config.autoCorrectFilenames = true; config.autoCorrectFilenames = true;
config.extractAlbumArt = false; config.extractAlbumArt = false;
config.embedAlbumArt = false; config.embedAlbumArt = false;
StringWriter sw = new StringWriter();
string accurateRipLog;
try try
{ {
CUESheet cueSheet = new CUESheet(config); CUESheet cueSheet = new CUESheet(config);
@@ -37,14 +36,16 @@ namespace ArCueDotNet
cueSheet.UseAccurateRip(); cueSheet.UseAccurateRip();
cueSheet.GenerateFilenames(AudioEncoderType.NoAudio, "dummy", pathIn); cueSheet.GenerateFilenames(AudioEncoderType.NoAudio, "dummy", pathIn);
cueSheet.Go(); cueSheet.Go();
cueSheet.GenerateAccurateRipLog(sw);
accurateRipLog = CUESheetLogWriter.GetAccurateRipLog(cueSheet);
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("Error: " + ex.Message); Console.WriteLine("Error: " + ex.Message);
return;
} }
sw.Close();
Console.Write(sw.ToString()); Console.Write(accurateRipLog);
} }
} }
} }

View File

@@ -165,10 +165,7 @@ namespace JDP
} }
else if (useAR) else if (useAR)
{ {
StringWriter sw = new StringWriter(); textBox1.Text += CUESheetLogWriter.GetAccurateRipLog(cueSheet);
cueSheet.GenerateAccurateRipLog(sw);
textBox1.Text += sw.ToString();
sw.Close();
textBox1.Show(); textBox1.Show();
} }
textBox1.Text += "----------------------------------------------------------\r\n"; textBox1.Text += "----------------------------------------------------------\r\n";

View File

@@ -43,8 +43,10 @@ using CUETools.Processor.Settings;
namespace JDP namespace JDP
{ {
public partial class frmCUETools : Form { public partial class frmCUETools : Form
public frmCUETools() { {
public frmCUETools()
{
_profile = _defaultProfile = new CUEToolsProfile("default"); _profile = _defaultProfile = new CUEToolsProfile("default");
InitializeComponent(); InitializeComponent();
//splitContainer1.AutoScaleMode = AutoScaleMode.Font; //splitContainer1.AutoScaleMode = AutoScaleMode.Font;
@@ -134,7 +136,8 @@ namespace JDP
DialogResult overwriteResult = DialogResult.None; 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;
@@ -261,16 +264,21 @@ namespace JDP
} }
} }
private void PathTextBox_DragEnter(object sender, DragEventArgs e) { private void PathTextBox_DragEnter(object sender, DragEventArgs e)
if (e.Data.GetDataPresent(DataFormats.FileDrop) && !((TextBox)sender).ReadOnly) { {
if (e.Data.GetDataPresent(DataFormats.FileDrop) && !((TextBox)sender).ReadOnly)
{
e.Effect = DragDropEffects.Copy; e.Effect = DragDropEffects.Copy;
} }
} }
private void PathTextBox_DragDrop(object sender, DragEventArgs e) { private void PathTextBox_DragDrop(object sender, DragEventArgs e)
if (e.Data.GetDataPresent(DataFormats.FileDrop)) { {
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files.Length == 1) { if (files.Length == 1)
{
((TextBox)sender).Text = files[0]; ((TextBox)sender).Text = files[0];
if (FileBrowserState == FileBrowserStateEnum.Tree) if (FileBrowserState == FileBrowserStateEnum.Tree)
fileSystemTreeView1.SelectedPath = files[0]; fileSystemTreeView1.SelectedPath = files[0];
@@ -278,11 +286,14 @@ namespace JDP
} }
} }
public string InputPath { public string InputPath
get { {
get
{
return txtInputPath.Text; return txtInputPath.Text;
} }
set { set
{
txtInputPath.Text = value; txtInputPath.Text = value;
} }
} }
@@ -303,7 +314,8 @@ namespace JDP
UpdateOutputPath(); UpdateOutputPath();
} }
private void frmCUETools_Load(object sender, EventArgs e) { private void frmCUETools_Load(object sender, EventArgs e)
{
_batchPaths = new List<string>(); _batchPaths = new List<string>();
try try
{ {
@@ -390,7 +402,8 @@ namespace JDP
updateOutputStyles(); updateOutputStyles();
} }
private void frmCUETools_FormClosed(object sender, FormClosedEventArgs e) { private void frmCUETools_FormClosed(object sender, FormClosedEventArgs e)
{
SaveDatabase(); SaveDatabase();
SaveSettings(); SaveSettings();
} }
@@ -404,7 +417,8 @@ namespace JDP
Hidden = 4 Hidden = 4
} }
private enum CorrectorModeEnum { private enum CorrectorModeEnum
{
Locate = 0, Locate = 0,
Extension = 1 Extension = 1
} }
@@ -435,7 +449,7 @@ namespace JDP
DateTime lastMOTD; DateTime lastMOTD;
Image motdImage = null; Image motdImage = null;
string profilePath; string profilePath;
string [] OutputPathUseTemplates = { string[] OutputPathUseTemplates = {
"%music%\\Converted\\%artist%\\[%year% - ]%album%[ '('disc %discnumberandname%')'][' ('%releasedateandlabel%')'][' ('%unique%')']\\%artist% - %album%.cue", "%music%\\Converted\\%artist%\\[%year% - ]%album%[ '('disc %discnumberandname%')'][' ('%releasedateandlabel%')'][' ('%unique%')']\\%artist% - %album%.cue",
"%music%\\Converted\\%artist%\\[%year% - ]%album%[' ('%releasedateandlabel%')'][' ('%unique%')']\\%artist% - %album%[ '('disc %discnumberandname%')'].cue", "%music%\\Converted\\%artist%\\[%year% - ]%album%[' ('%releasedateandlabel%')'][' ('%unique%')']\\%artist% - %album%[ '('disc %discnumberandname%')'].cue",
"[%directoryname%\\]%filename%-new[%unique%].cue", "[%directoryname%\\]%filename%-new[%unique%].cue",
@@ -448,7 +462,8 @@ namespace JDP
return pathIn.Length == 3 && pathIn.Substring(1) == ":\\" && new DriveInfo(pathIn).DriveType == DriveType.CDRom; return pathIn.Length == 3 && pathIn.Substring(1) == ":\\" && new DriveInfo(pathIn).DriveType == DriveType.CDRom;
} }
private void StartConvert() { private void StartConvert()
{
try try
{ {
_workThread = null; _workThread = null;
@@ -521,7 +536,8 @@ namespace JDP
{ {
e.Password = dlg.txtPassword.Text; e.Password = dlg.txtPassword.Text;
e.ContinueOperation = true; e.ContinueOperation = true;
} else }
else
e.ContinueOperation = false; e.ContinueOperation = false;
}); });
} }
@@ -587,7 +603,8 @@ namespace JDP
} }
} }
private void WriteAudioFilesThread(object o) { private void WriteAudioFilesThread(object o)
{
object[] p = (object[])o; object[] p = (object[])o;
CUESheet cueSheet = (CUESheet)p[0]; CUESheet cueSheet = (CUESheet)p[0];
@@ -1078,11 +1095,7 @@ namespace JDP
} }
else if (useAR && cueSheet.Processed) else if (useAR && cueSheet.Processed)
{ {
using (StringWriter sw = new StringWriter()) _batchReport.Append(CUESheetLogWriter.GetAccurateRipLog(cueSheet));
{
cueSheet.GenerateAccurateRipLog(sw);
_batchReport.Append(sw.ToString());
}
ReportState = true; ReportState = true;
//frmReport reportForm = new frmReport(); //frmReport reportForm = new frmReport();
@@ -1142,7 +1155,8 @@ namespace JDP
} }
cueSheet.Close(); cueSheet.Close();
if (_batchPaths.Count != 0) { if (_batchPaths.Count != 0)
{
_batchPaths.RemoveAt(0); _batchPaths.RemoveAt(0);
if (_batchPaths.Count == 0) if (_batchPaths.Count == 0)
{ {
@@ -1150,7 +1164,8 @@ namespace JDP
} }
this.BeginInvoke((MethodInvoker)delegate() this.BeginInvoke((MethodInvoker)delegate()
{ {
if (_batchPaths.Count == 0) { if (_batchPaths.Count == 0)
{
SetupControls(false); SetupControls(false);
ReportState = true; ReportState = true;
//frmReport reportForm = new frmReport(); //frmReport reportForm = new frmReport();
@@ -1158,7 +1173,8 @@ namespace JDP
//reportForm.ShowDialog(this); //reportForm.ShowDialog(this);
//ShowBatchDoneMessage(); //ShowBatchDoneMessage();
} }
else { else
{
StartConvert(); StartConvert();
} }
}); });
@@ -1201,7 +1217,8 @@ namespace JDP
}); });
} }
private void SetupControls(bool running) { private void SetupControls(bool running)
{
bool converting = (SelectedAction == CUEAction.Encode); bool converting = (SelectedAction == CUEAction.Encode);
bool verifying = (SelectedAction == CUEAction.Verify || (SelectedAction == CUEAction.Encode && SelectedOutputAudioType != AudioEncoderType.NoAudio && checkBoxUseAccurateRip.Checked)); bool verifying = (SelectedAction == CUEAction.Verify || (SelectedAction == CUEAction.Encode && SelectedOutputAudioType != AudioEncoderType.NoAudio && checkBoxUseAccurateRip.Checked));
//grpInput.Enabled = !running; //grpInput.Enabled = !running;
@@ -1261,7 +1278,8 @@ namespace JDP
// checkBoxAdvancedMode.Checked; // checkBoxAdvancedMode.Checked;
} }
private bool ShowErrorMessage(Exception ex) { private bool ShowErrorMessage(Exception ex)
{
string message = "Exception"; string message = "Exception";
for (Exception e = ex; e != null; e = e.InnerException) for (Exception e = ex; e != null; e = e.InnerException)
message += ": " + e.Message; message += ": " + e.Message;
@@ -1270,11 +1288,14 @@ namespace JDP
return (dlgRes == DialogResult.OK); return (dlgRes == DialogResult.OK);
} }
private void ShowFinishedMessage(bool warnAboutPadding, string status) { private void ShowFinishedMessage(bool warnAboutPadding, string status)
if (_batchPaths.Count != 0) { {
if (_batchPaths.Count != 0)
{
return; return;
} }
if (warnAboutPadding) { if (warnAboutPadding)
{
MessageBox.Show(this, "One or more input file doesn't end on a CD frame boundary. " + MessageBox.Show(this, "One or more input file doesn't end on a CD frame boundary. " +
"The output has been padded where necessary to fix this. If your input " + "The output has been padded where necessary to fix this. If your input " +
"files are from a CD source, this may indicate a problem with your files.", "files are from a CD source, this may indicate a problem with your files.",
@@ -1289,7 +1310,8 @@ namespace JDP
// MessageBoxIcon.Information); // MessageBoxIcon.Information);
//} //}
private bool CheckWriteOffset() { private bool CheckWriteOffset()
{
if (numericWriteOffset.Value == 0 || SelectedOutputAudioType == AudioEncoderType.NoAudio || rbActionVerify.Checked) if (numericWriteOffset.Value == 0 || SelectedOutputAudioType == AudioEncoderType.NoAudio || rbActionVerify.Checked)
{ {
return true; return true;
@@ -1355,7 +1377,7 @@ namespace JDP
_profile._outputAudioFormat = SelectedOutputAudioFormat; _profile._outputAudioFormat = SelectedOutputAudioFormat;
_profile._action = SelectedAction; _profile._action = SelectedAction;
_profile._CUEStyle = SelectedCUEStyle; _profile._CUEStyle = SelectedCUEStyle;
_profile._writeOffset = (int) numericWriteOffset.Value; _profile._writeOffset = (int)numericWriteOffset.Value;
_profile._outputTemplate = comboBoxOutputFormat.Text; _profile._outputTemplate = comboBoxOutputFormat.Text;
_profile._script = SelectedScript; _profile._script = SelectedScript;
_profile._useFreeDb = checkBoxUseFreeDb.Checked; _profile._useFreeDb = checkBoxUseFreeDb.Checked;
@@ -1373,7 +1395,8 @@ namespace JDP
} }
} }
private void LoadSettings() { private void LoadSettings()
{
SettingsReader sr = new SettingsReader("CUE Tools", "settings.txt", Application.ExecutablePath); SettingsReader sr = new SettingsReader("CUE Tools", "settings.txt", Application.ExecutablePath);
profilePath = sr.ProfilePath; profilePath = sr.ProfilePath;
_profile.Load(sr); _profile.Load(sr);
@@ -1388,7 +1411,7 @@ namespace JDP
int iFormat, nFormats = sr.LoadInt32("OutputPathUseTemplates", 0, 10) ?? 0; int iFormat, nFormats = sr.LoadInt32("OutputPathUseTemplates", 0, 10) ?? 0;
for (iFormat = 0; iFormat < OutputPathUseTemplates.Length; iFormat++) for (iFormat = 0; iFormat < OutputPathUseTemplates.Length; iFormat++)
comboBoxOutputFormat.Items.Add(OutputPathUseTemplates[iFormat]); comboBoxOutputFormat.Items.Add(OutputPathUseTemplates[iFormat]);
for (iFormat = nFormats - 1; iFormat >= 0; iFormat --) for (iFormat = nFormats - 1; iFormat >= 0; iFormat--)
comboBoxOutputFormat.Items.Add(sr.Load(string.Format("OutputPathUseTemplate{0}", iFormat)) ?? ""); comboBoxOutputFormat.Items.Add(sr.Load(string.Format("OutputPathUseTemplate{0}", iFormat)) ?? "");
OutputPathUseTemplate = !(sr.LoadBoolean("DontGenerate") ?? false); OutputPathUseTemplate = !(sr.LoadBoolean("DontGenerate") ?? false);
@@ -1396,7 +1419,7 @@ namespace JDP
_usePregapForFirstTrackInSingleFile = sr.LoadBoolean("UsePregapForFirstTrackInSingleFile") ?? false; _usePregapForFirstTrackInSingleFile = sr.LoadBoolean("UsePregapForFirstTrackInSingleFile") ?? false;
_reducePriority = sr.LoadBoolean("ReducePriority") ?? true; _reducePriority = sr.LoadBoolean("ReducePriority") ?? true;
CorrectorMode = (CorrectorModeEnum)(sr.LoadInt32("CorrectorLookup", null, null) ?? (int) CorrectorModeEnum.Locate); CorrectorMode = (CorrectorModeEnum)(sr.LoadInt32("CorrectorLookup", null, null) ?? (int)CorrectorModeEnum.Locate);
toolStripButtonCorrectorOverwrite.Checked = sr.LoadBoolean("CorrectorOverwrite") ?? true; toolStripButtonCorrectorOverwrite.Checked = sr.LoadBoolean("CorrectorOverwrite") ?? true;
string correctorFormat = sr.Load("CorrectorFormat") ?? "flac"; string correctorFormat = sr.Load("CorrectorFormat") ?? "flac";
foreach (KeyValuePair<string, CUEToolsFormat> format in _profile._config.formats) foreach (KeyValuePair<string, CUEToolsFormat> format in _profile._config.formats)
@@ -1453,7 +1476,7 @@ namespace JDP
sw.Save("ReducePriority", _reducePriority); sw.Save("ReducePriority", _reducePriority);
sw.Save("FileBrowserState", (int)FileBrowserState); sw.Save("FileBrowserState", (int)FileBrowserState);
sw.Save("ReportState", ReportState); sw.Save("ReportState", ReportState);
sw.Save("CorrectorLookup", (int) CorrectorMode); sw.Save("CorrectorLookup", (int)CorrectorMode);
sw.Save("CorrectorOverwrite", toolStripButtonCorrectorOverwrite.Checked); sw.Save("CorrectorOverwrite", toolStripButtonCorrectorOverwrite.Checked);
sw.Save("CorrectorFormat", toolStripDropDownButtonCorrectorFormat.Text); sw.Save("CorrectorFormat", toolStripDropDownButtonCorrectorFormat.Text);
sw.Save("WidthIncrement", FileBrowserState == FileBrowserStateEnum.Hidden ? SizeIncrement.Width : Width - OpenMinimumSize.Width); sw.Save("WidthIncrement", FileBrowserState == FileBrowserStateEnum.Hidden ? SizeIncrement.Width : Width - OpenMinimumSize.Width);
@@ -1462,7 +1485,7 @@ namespace JDP
sw.Save("Left", Left); sw.Save("Left", Left);
StringBuilder profiles = new StringBuilder(); StringBuilder profiles = new StringBuilder();
foreach(ToolStripItem item in toolStripDropDownButtonProfile.DropDownItems) foreach (ToolStripItem item in toolStripDropDownButtonProfile.DropDownItems)
if (item != toolStripTextBoxAddProfile if (item != toolStripTextBoxAddProfile
&& item != toolStripMenuItemDeleteProfile && item != toolStripMenuItemDeleteProfile
&& item != defaultToolStripMenuItem && item != defaultToolStripMenuItem
@@ -1479,14 +1502,18 @@ namespace JDP
sw.Close(); sw.Close();
} }
private CUEStyle SelectedCUEStyle { private CUEStyle SelectedCUEStyle
get { {
get
{
if (rbEmbedCUE.Checked) return CUEStyle.SingleFileWithCUE; if (rbEmbedCUE.Checked) return CUEStyle.SingleFileWithCUE;
if (rbSingleFile.Checked) return CUEStyle.SingleFile; if (rbSingleFile.Checked) return CUEStyle.SingleFile;
return _profile._config.gapsHandling; return _profile._config.gapsHandling;
} }
set { set
switch (value) { {
switch (value)
{
case CUEStyle.SingleFileWithCUE: rbEmbedCUE.Checked = true; break; case CUEStyle.SingleFileWithCUE: rbEmbedCUE.Checked = true; break;
case CUEStyle.SingleFile: rbSingleFile.Checked = true; break; case CUEStyle.SingleFile: rbSingleFile.Checked = true; break;
default: rbTracks.Checked = true; break; default: rbTracks.Checked = true; break;
@@ -1542,10 +1569,11 @@ namespace JDP
} }
} }
private string SelectedOutputAudioFormat { private string SelectedOutputAudioFormat
{
get get
{ {
return (string) (comboBoxAudioFormat.SelectedItem ?? "dummy"); return (string)(comboBoxAudioFormat.SelectedItem ?? "dummy");
} }
set set
{ {
@@ -2276,7 +2304,8 @@ namespace JDP
{ {
if (!encoder.lossless) if (!encoder.lossless)
continue; continue;
} else if (SelectedOutputAudioType == AudioEncoderType.Lossless && !encoder.lossless) }
else if (SelectedOutputAudioType == AudioEncoderType.Lossless && !encoder.lossless)
continue; continue;
else if (SelectedOutputAudioType == AudioEncoderType.Lossy && encoder.lossless) else if (SelectedOutputAudioType == AudioEncoderType.Lossy && encoder.lossless)
continue; continue;
@@ -2368,7 +2397,7 @@ namespace JDP
SelectedOutputAudioFmt.encoderLossless = encoder; SelectedOutputAudioFmt.encoderLossless = encoder;
else else
SelectedOutputAudioFmt.encoderLossy = encoder; SelectedOutputAudioFmt.encoderLossy = encoder;
string [] modes = encoder.SupportedModes; string[] modes = encoder.SupportedModes;
if (modes == null || modes.Length < 2) if (modes == null || modes.Length < 2)
{ {
trackBarEncoderMode.Visible = false; trackBarEncoderMode.Visible = false;
@@ -2440,7 +2469,7 @@ namespace JDP
return; return;
if (e.ClickedItem == toolStripMenuItemDeleteProfile) if (e.ClickedItem == toolStripMenuItemDeleteProfile)
{ {
foreach(ToolStripItem item in toolStripDropDownButtonProfile.DropDownItems) foreach (ToolStripItem item in toolStripDropDownButtonProfile.DropDownItems)
if (item.Text == toolStripDropDownButtonProfile.Text if (item.Text == toolStripDropDownButtonProfile.Text
&& item != toolStripTextBoxAddProfile && item != toolStripTextBoxAddProfile
&& item != toolStripMenuItemDeleteProfile && item != toolStripMenuItemDeleteProfile