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.Collections.Generic;
using System.Text;
using System.IO;
using CUETools.Processor;
@@ -27,7 +25,8 @@ namespace ArCueDotNet
config.autoCorrectFilenames = true;
config.extractAlbumArt = false;
config.embedAlbumArt = false;
StringWriter sw = new StringWriter();
string accurateRipLog;
try
{
CUESheet cueSheet = new CUESheet(config);
@@ -37,14 +36,16 @@ namespace ArCueDotNet
cueSheet.UseAccurateRip();
cueSheet.GenerateFilenames(AudioEncoderType.NoAudio, "dummy", pathIn);
cueSheet.Go();
cueSheet.GenerateAccurateRipLog(sw);
accurateRipLog = CUESheetLogWriter.GetAccurateRipLog(cueSheet);
}
catch (Exception ex)
{
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)
{
StringWriter sw = new StringWriter();
cueSheet.GenerateAccurateRipLog(sw);
textBox1.Text += sw.ToString();
sw.Close();
textBox1.Text += CUESheetLogWriter.GetAccurateRipLog(cueSheet);
textBox1.Show();
}
textBox1.Text += "----------------------------------------------------------\r\n";

View File

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