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
} }
@@ -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;
@@ -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);
@@ -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,7 +1569,8 @@ namespace JDP
} }
} }
private string SelectedOutputAudioFormat { private string SelectedOutputAudioFormat
{
get get
{ {
return (string)(comboBoxAudioFormat.SelectedItem ?? "dummy"); return (string)(comboBoxAudioFormat.SelectedItem ?? "dummy");
@@ -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;