CUETools.Processor: split classes into separate files.

This commit is contained in:
karamanolev
2011-10-24 11:38:10 +00:00
parent d7f588e19c
commit f365e6359f
46 changed files with 7323 additions and 7054 deletions

View File

@@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Deployment.Application; using System.Deployment.Application;
using System.Globalization; using System.Globalization;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using CUETools.Processor; using CUETools.Processor;
using CUETools.Processor.Settings;
namespace CUERipper namespace CUERipper
{ {

View File

@@ -1,24 +1,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using System.Configuration; using CUEControls;
using System.Drawing.Drawing2D;
using CUETools.AccurateRip; using CUETools.AccurateRip;
using CUETools.CTDB; using CUETools.CTDB;
using CUETools.CDImage;
using CUETools.Codecs;
using CUETools.Processor; using CUETools.Processor;
using CUETools.Processor.Settings;
using CUETools.Ripper; using CUETools.Ripper;
using CUEControls;
using Freedb; using Freedb;
namespace CUERipper namespace CUERipper

View File

@@ -1,10 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.IO; using System.IO;
using CUETools.Codecs; using CUETools.Codecs;
using CUETools.Processor; using CUETools.Processor;
using CUETools.Processor.Settings;
namespace CUETools.Converter namespace CUETools.Converter
{ {

View File

@@ -0,0 +1,36 @@
using System.IO;
namespace CUETools.Processor
{
public class ArchiveFileAbstraction : TagLib.File.IFileAbstraction
{
private string name;
private CUESheet _cueSheet;
public string Name
{
get { return name; }
}
public Stream ReadStream
{
get { return _cueSheet.OpenArchive(Name, true); }
}
public Stream WriteStream
{
get { return null; }
}
public ArchiveFileAbstraction(CUESheet cueSheet, string file)
{
name = file;
_cueSheet = cueSheet;
}
public void CloseStream(Stream stream)
{
stream.Close();
}
}
}

View File

@@ -0,0 +1,13 @@
namespace CUETools.Processor
{
public enum AudioEncoderType
{
Lossless,
Hybrid,
Lossy,
/// <summary>
/// No Audio
/// </summary>
NoAudio,
}
}

View File

@@ -3,7 +3,6 @@ using System.IO;
using CUETools.CDImage; using CUETools.CDImage;
using CUETools.Codecs; using CUETools.Codecs;
using CUETools.Codecs.LossyWAV; using CUETools.Codecs.LossyWAV;
using System.Xml.Serialization;
namespace CUETools.Processor namespace CUETools.Processor
{ {

View File

@@ -0,0 +1,10 @@
namespace CUETools.Processor
{
public enum CUEAction
{
Encode = 0,
Verify = 1,
CreateDummyCUE = 2,
CorrectFilenames = 3
}
}

View File

@@ -0,0 +1,651 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Xml;
using System.Xml.Serialization;
using CUETools.Codecs;
using CUETools.Processor.Settings;
namespace CUETools.Processor
{
public class CUEConfig
{
public readonly static XmlSerializerNamespaces xmlEmptyNamespaces = new XmlSerializerNamespaces(new XmlQualifiedName[] { XmlQualifiedName.Empty });
public readonly static XmlWriterSettings xmlEmptySettings = new XmlWriterSettings { Indent = true, OmitXmlDeclaration = true };
public uint fixOffsetMinimumConfidence;
public uint fixOffsetMinimumTracksPercent;
public uint encodeWhenConfidence;
public uint encodeWhenPercent;
public bool encodeWhenZeroOffset;
public bool writeArTagsOnVerify;
public bool writeArLogOnVerify;
public bool writeArTagsOnEncode;
public bool writeArLogOnConvert;
public bool fixOffset;
public bool noUnverifiedOutput;
public bool autoCorrectFilenames;
public bool preserveHTOA;
public bool keepOriginalFilenames;
public string trackFilenameFormat;
public string singleFilenameFormat;
public bool removeSpecial;
public string specialExceptions;
public bool replaceSpaces;
public bool embedLog;
public bool extractLog;
public bool fillUpCUE;
public bool overwriteCUEData;
public bool filenamesANSISafe;
public bool bruteForceDTL;
public bool createEACLOG;
public bool detectHDCD;
public bool decodeHDCD;
public bool wait750FramesForHDCD;
public bool createM3U;
public bool createCUEFileWhenEmbedded;
public bool truncate4608ExtraSamples;
public int lossyWAVQuality;
public bool decodeHDCDtoLW16;
public bool decodeHDCDto24bit;
public bool oneInstance;
public bool checkForUpdates;
public string language;
public Dictionary<string, CUEToolsFormat> formats;
public CUEToolsUDCList encoders;
public Dictionary<string, CUEToolsUDC> decoders;
public Dictionary<string, CUEToolsScript> scripts;
public string defaultVerifyScript;
public string defaultEncodeScript;
public bool writeBasicTagsFromCUEData;
public bool copyBasicTags;
public bool copyUnknownTags;
public bool embedAlbumArt;
public bool extractAlbumArt;
public bool arLogToSourceFolder;
public bool arLogVerbose;
public bool fixOffsetToNearest;
public int maxAlbumArtSize;
public CUEStyle gapsHandling;
public bool separateDecodingThread;
public CUEConfigAdvanced advanced { get; private set; }
public bool CopyAlbumArt { get; set; }
public string ArLogFilenameFormat { get; set; }
public string AlArtFilenameFormat { get; set; }
public CUEToolsUDCList Encoders
{
get { return encoders; }
}
public CUEConfig()
{
fixOffsetMinimumConfidence = 2;
fixOffsetMinimumTracksPercent = 51;
encodeWhenConfidence = 2;
encodeWhenPercent = 100;
encodeWhenZeroOffset = false;
fixOffset = false;
noUnverifiedOutput = false;
writeArTagsOnEncode = true;
writeArLogOnConvert = true;
writeArTagsOnVerify = false;
writeArLogOnVerify = false;
autoCorrectFilenames = true;
preserveHTOA = true;
keepOriginalFilenames = false;
trackFilenameFormat = "%tracknumber%. %title%";
singleFilenameFormat = "%filename%";
removeSpecial = false;
specialExceptions = "-()";
replaceSpaces = false;
embedLog = true;
extractLog = true;
fillUpCUE = true;
overwriteCUEData = false;
filenamesANSISafe = true;
bruteForceDTL = false;
createEACLOG = true;
detectHDCD = true;
wait750FramesForHDCD = true;
decodeHDCD = false;
createM3U = false;
createCUEFileWhenEmbedded = true;
truncate4608ExtraSamples = true;
lossyWAVQuality = 5;
decodeHDCDtoLW16 = false;
decodeHDCDto24bit = true;
oneInstance = true;
checkForUpdates = true;
writeBasicTagsFromCUEData = true;
copyBasicTags = true;
copyUnknownTags = true;
CopyAlbumArt = true;
embedAlbumArt = true;
extractAlbumArt = true;
maxAlbumArtSize = 300;
arLogToSourceFolder = false;
arLogVerbose = true;
fixOffsetToNearest = true;
ArLogFilenameFormat = "%filename%.accurip";
AlArtFilenameFormat = "folder.jpg";
separateDecodingThread = true;
gapsHandling = CUEStyle.GapsAppended;
advanced = new CUEConfigAdvanced();
language = Thread.CurrentThread.CurrentUICulture.Name;
encoders = new CUEToolsUDCList();
foreach (Type type in CUEProcessorPlugins.encs)
foreach (AudioEncoderClass enc in Attribute.GetCustomAttributes(type, typeof(AudioEncoderClass)))
encoders.Add(new CUEToolsUDC(enc, type));
decoders = new Dictionary<string, CUEToolsUDC>();
foreach (Type type in CUEProcessorPlugins.decs)
{
AudioDecoderClass dec = Attribute.GetCustomAttribute(type, typeof(AudioDecoderClass)) as AudioDecoderClass;
decoders.Add(dec.DecoderName, new CUEToolsUDC(dec, type));
}
if (Type.GetType("Mono.Runtime", false) == null)
{
encoders.Add(new CUEToolsUDC("flake", "flac", true, "0 1 2 3 4 5 6 7 8 9 10 11 12", "8", "flake.exe", "-%M - -o %O -p %P"));
encoders.Add(new CUEToolsUDC("takc", "tak", true, "0 1 2 2e 2m 3 3e 3m 4 4e 4m", "2", "takc.exe", "-e -p%M -overwrite - %O"));
encoders.Add(new CUEToolsUDC("ffmpeg alac", "m4a", true, "", "", "ffmpeg.exe", "-i - -f ipod -acodec alac -y %O"));
encoders.Add(new CUEToolsUDC("lame vbr", "mp3", false, "V9 V8 V7 V6 V5 V4 V3 V2 V1 V0", "V2", "lame.exe", "--vbr-new -%M - %O"));
encoders.Add(new CUEToolsUDC("lame cbr", "mp3", false, "96 128 192 256 320", "256", "lame.exe", "-m s -q 0 -b %M --noreplaygain - %O"));
encoders.Add(new CUEToolsUDC("oggenc", "ogg", false, "-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8", "3", "oggenc.exe", "-q %M - -o %O"));
encoders.Add(new CUEToolsUDC("nero aac", "m4a", false, "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9", "0.4", "neroAacEnc.exe", "-q %M -if - -of %O"));
encoders.Add(new CUEToolsUDC("qaac tvbr", "m4a", false, "10 20 30 40 50 60 70 80 90 100 110 127", "80", "qaac.exe", "-s -V %M -q 2 - -o %O"));
decoders.Add("takc", new CUEToolsUDC("takc", "tak", true, "", "", "takc.exe", "-d %I -"));
decoders.Add("ffmpeg alac", new CUEToolsUDC("ffmpeg alac", "m4a", true, "", "", "ffmpeg.exe", "%I -f wav -"));
}
else
{
// !!!
}
formats = new Dictionary<string, CUEToolsFormat>();
formats.Add("flac", new CUEToolsFormat("flac", CUEToolsTagger.TagLibSharp, true, false, true, true, true, encoders.GetDefault("flac", true), null, GetDefaultDecoder("flac")));
formats.Add("wv", new CUEToolsFormat("wv", CUEToolsTagger.TagLibSharp, true, false, true, true, true, encoders.GetDefault("wv", true), null, GetDefaultDecoder("wv")));
formats.Add("ape", new CUEToolsFormat("ape", CUEToolsTagger.TagLibSharp, true, false, false, true, true, encoders.GetDefault("ape", true), null, GetDefaultDecoder("ape")));
formats.Add("tta", new CUEToolsFormat("tta", CUEToolsTagger.APEv2, true, false, false, false, true, encoders.GetDefault("tta", true), null, GetDefaultDecoder("tta")));
formats.Add("wav", new CUEToolsFormat("wav", CUEToolsTagger.TagLibSharp, true, false, true, false, true, encoders.GetDefault("wav", true), null, GetDefaultDecoder("wav")));
formats.Add("m4a", new CUEToolsFormat("m4a", CUEToolsTagger.TagLibSharp, true, true, false, false, true, encoders.GetDefault("m4a", true), encoders.GetDefault("m4a", false), GetDefaultDecoder("m4a")));
formats.Add("tak", new CUEToolsFormat("tak", CUEToolsTagger.APEv2, true, false, true, true, true, encoders.GetDefault("tak", true), null, "takc"));
formats.Add("mp3", new CUEToolsFormat("mp3", CUEToolsTagger.TagLibSharp, false, true, false, false, true, null, encoders.GetDefault("mp3", false), null));
formats.Add("ogg", new CUEToolsFormat("ogg", CUEToolsTagger.TagLibSharp, false, true, false, false, true, null, encoders.GetDefault("ogg", false), null));
scripts = new Dictionary<string, CUEToolsScript>();
scripts.Add("default", new CUEToolsScript("default", true,
new CUEAction[] { CUEAction.Verify, CUEAction.Encode },
"return processor.Go();"));
scripts.Add("only if found", new CUEToolsScript("only if found", true,
new CUEAction[] { CUEAction.Verify },
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
return processor.WriteReport();
return processor.Go();"));
scripts.Add("fix offset", new CUEToolsScript("fix offset", true,
new CUEAction[] { CUEAction.Encode },
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
return processor.WriteReport();
processor.WriteOffset = 0;
processor.Action = CUEAction.Verify;
string status = processor.Go();
uint tracksMatch;
int bestOffset;
processor.FindBestOffset(processor.Config.fixOffsetMinimumConfidence, !processor.Config.fixOffsetToNearest, out tracksMatch, out bestOffset);
if (tracksMatch * 100 < processor.Config.fixOffsetMinimumTracksPercent * processor.TrackCount)
return status;
processor.WriteOffset = bestOffset;
processor.Action = CUEAction.Encode;
//MessageBox.Show(null, processor.AccurateRipLog, " + "\"Done\"" + @"MessageBoxButtons.OK, MessageBoxIcon.Information);
return processor.Go();
"));
scripts.Add("encode if verified", new CUEToolsScript("encode if verified", true,
new CUEAction[] { CUEAction.Encode },
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
return processor.WriteReport();
processor.Action = CUEAction.Verify;
string status = processor.Go();
uint tracksMatch;
int bestOffset;
processor.FindBestOffset(processor.Config.encodeWhenConfidence, false, out tracksMatch, out bestOffset);
if (tracksMatch * 100 < processor.Config.encodeWhenPercent * processor.TrackCount || (processor.Config.encodeWhenZeroOffset && bestOffset != 0))
return status;
processor.Action = CUEAction.Encode;
return processor.Go();
"));
scripts.Add("repair", new CUEToolsScript("repair", true,
new CUEAction[] { CUEAction.Encode },
@"
processor.UseCUEToolsDB();
processor.Action = CUEAction.Verify;
if (processor.CTDB.DBStatus != null)
return CTDB.DBStatus;
processor.Go();
processor.CTDB.DoVerify();
if (!processor.CTDB.Verify.HasErrors)
return ""nothing to fix"";
if (!processor.CTDB.Verify.CanRecover)
return ""cannot fix"";
processor._useCUEToolsDBFix = true;
processor.Action = CUEAction.Encode;
return processor.Go();
"));
defaultVerifyScript = "default";
defaultEncodeScript = "default";
}
public void Save(SettingsWriter sw)
{
sw.Save("Version", 203);
sw.Save("ArFixWhenConfidence", fixOffsetMinimumConfidence);
sw.Save("ArFixWhenPercent", fixOffsetMinimumTracksPercent);
sw.Save("ArEncodeWhenConfidence", encodeWhenConfidence);
sw.Save("ArEncodeWhenPercent", encodeWhenPercent);
sw.Save("ArEncodeWhenZeroOffset", encodeWhenZeroOffset);
sw.Save("ArNoUnverifiedOutput", noUnverifiedOutput);
sw.Save("ArFixOffset", fixOffset);
sw.Save("ArWriteCRC", writeArTagsOnEncode);
sw.Save("ArWriteLog", writeArLogOnConvert);
sw.Save("ArWriteTagsOnVerify", writeArTagsOnVerify);
sw.Save("ArWriteLogOnVerify", writeArLogOnVerify);
sw.Save("PreserveHTOA", preserveHTOA);
sw.Save("AutoCorrectFilenames", autoCorrectFilenames);
sw.Save("KeepOriginalFilenames", keepOriginalFilenames);
sw.Save("SingleFilenameFormat", singleFilenameFormat);
sw.Save("TrackFilenameFormat", trackFilenameFormat);
sw.Save("RemoveSpecialCharacters", removeSpecial);
sw.Save("SpecialCharactersExceptions", specialExceptions);
sw.Save("ReplaceSpaces", replaceSpaces);
sw.Save("EmbedLog", embedLog);
sw.Save("ExtractLog", extractLog);
sw.Save("FillUpCUE", fillUpCUE);
sw.Save("OverwriteCUEData", overwriteCUEData);
sw.Save("FilenamesANSISafe", filenamesANSISafe);
if (bruteForceDTL) sw.Save("BruteForceDTL", bruteForceDTL);
sw.Save("CreateEACLOG", createEACLOG);
sw.Save("DetectHDCD", detectHDCD);
sw.Save("Wait750FramesForHDCD", wait750FramesForHDCD);
sw.Save("DecodeHDCD", decodeHDCD);
sw.Save("CreateM3U", createM3U);
sw.Save("CreateCUEFileWhenEmbedded", createCUEFileWhenEmbedded);
sw.Save("Truncate4608ExtraSamples", truncate4608ExtraSamples);
sw.Save("LossyWAVQuality", lossyWAVQuality);
sw.Save("DecodeHDCDToLossyWAV16", decodeHDCDtoLW16);
sw.Save("DecodeHDCDTo24bit", decodeHDCDto24bit);
sw.Save("OneInstance", oneInstance);
sw.Save("CheckForUpdates", checkForUpdates);
sw.Save("Language", language);
sw.Save("SeparateDecodingThread", separateDecodingThread);
sw.Save("WriteBasicTagsFromCUEData", writeBasicTagsFromCUEData);
sw.Save("CopyBasicTags", copyBasicTags);
sw.Save("CopyUnknownTags", copyUnknownTags);
sw.Save("CopyAlbumArt", CopyAlbumArt);
sw.Save("EmbedAlbumArt", embedAlbumArt);
sw.Save("ExtractAlbumArt", extractAlbumArt);
sw.Save("MaxAlbumArtSize", maxAlbumArtSize);
sw.Save("ArLogToSourceFolder", arLogToSourceFolder);
sw.Save("ArLogVerbose", arLogVerbose);
sw.Save("FixOffsetToNearest", fixOffsetToNearest);
sw.Save("ArLogFilenameFormat", ArLogFilenameFormat);
sw.Save("AlArtFilenameFormat", AlArtFilenameFormat);
using (TextWriter tw = new StringWriter())
using (XmlWriter xw = XmlTextWriter.Create(tw, xmlEmptySettings))
{
CUEConfigAdvanced.serializer.Serialize(xw, advanced, xmlEmptyNamespaces);
sw.SaveText("Advanced", tw.ToString());
}
int nEncoders = 0;
foreach (CUEToolsUDC encoder in encoders)
{
sw.Save(string.Format("ExternalEncoder{0}Name", nEncoders), encoder.name);
sw.Save(string.Format("ExternalEncoder{0}Modes", nEncoders), encoder.supported_modes);
sw.Save(string.Format("ExternalEncoder{0}Mode", nEncoders), encoder.default_mode);
if (encoder.path != null)
{
sw.Save(string.Format("ExternalEncoder{0}Extension", nEncoders), encoder.extension);
sw.Save(string.Format("ExternalEncoder{0}Path", nEncoders), encoder.path);
sw.Save(string.Format("ExternalEncoder{0}Lossless", nEncoders), encoder.lossless);
sw.Save(string.Format("ExternalEncoder{0}Parameters", nEncoders), encoder.parameters);
}
else
{
if (encoder.settingsSerializer != null)
{
using (TextWriter tw = new StringWriter())
using (XmlWriter xw = XmlTextWriter.Create(tw, xmlEmptySettings))
{
encoder.settingsSerializer.Serialize(xw, encoder.settings, xmlEmptyNamespaces);
sw.SaveText(string.Format("ExternalEncoder{0}Parameters", nEncoders), tw.ToString());
}
}
}
nEncoders++;
}
sw.Save("ExternalEncoders", nEncoders);
int nDecoders = 0;
foreach (KeyValuePair<string, CUEToolsUDC> decoder in decoders)
if (decoder.Value.path != null)
{
sw.Save(string.Format("ExternalDecoder{0}Name", nDecoders), decoder.Key);
sw.Save(string.Format("ExternalDecoder{0}Extension", nDecoders), decoder.Value.extension);
sw.Save(string.Format("ExternalDecoder{0}Path", nDecoders), decoder.Value.path);
sw.Save(string.Format("ExternalDecoder{0}Parameters", nDecoders), decoder.Value.parameters);
nDecoders++;
}
sw.Save("ExternalDecoders", nDecoders);
int nFormats = 0;
foreach (KeyValuePair<string, CUEToolsFormat> format in formats)
{
sw.Save(string.Format("CustomFormat{0}Name", nFormats), format.Key);
sw.Save(string.Format("CustomFormat{0}EncoderLossless", nFormats), format.Value.encoderLossless == null ? "" : format.Value.encoderLossless.Name);
sw.Save(string.Format("CustomFormat{0}EncoderLossy", nFormats), format.Value.encoderLossy == null ? "" : format.Value.encoderLossy.Name);
sw.Save(string.Format("CustomFormat{0}Decoder", nFormats), format.Value.decoder);
sw.Save(string.Format("CustomFormat{0}Tagger", nFormats), (int)format.Value.tagger);
sw.Save(string.Format("CustomFormat{0}AllowLossless", nFormats), format.Value.allowLossless);
sw.Save(string.Format("CustomFormat{0}AllowLossy", nFormats), format.Value.allowLossy);
sw.Save(string.Format("CustomFormat{0}AllowLossyWAV", nFormats), format.Value.allowLossyWAV);
sw.Save(string.Format("CustomFormat{0}AllowEmbed", nFormats), format.Value.allowEmbed);
nFormats++;
}
sw.Save("CustomFormats", nFormats);
int nScripts = 0;
foreach (KeyValuePair<string, CUEToolsScript> script in scripts)
{
sw.Save(string.Format("CustomScript{0}Name", nScripts), script.Key);
sw.SaveText(string.Format("CustomScript{0}Code", nScripts), script.Value.code);
int nCondition = 0;
foreach (CUEAction action in script.Value.conditions)
sw.Save(string.Format("CustomScript{0}Condition{1}", nScripts, nCondition++), (int)action);
sw.Save(string.Format("CustomScript{0}Conditions", nScripts), nCondition);
nScripts++;
}
sw.Save("CustomScripts", nScripts);
sw.Save("DefaultVerifyScript", defaultVerifyScript);
sw.Save("DefaultVerifyAndConvertScript", defaultEncodeScript);
sw.Save("GapsHandling", (int)gapsHandling);
}
public void Load(SettingsReader sr)
{
int version = sr.LoadInt32("Version", null, null) ?? 202;
fixOffsetMinimumConfidence = sr.LoadUInt32("ArFixWhenConfidence", 1, 1000) ?? 2;
fixOffsetMinimumTracksPercent = sr.LoadUInt32("ArFixWhenPercent", 1, 100) ?? 51;
encodeWhenConfidence = sr.LoadUInt32("ArEncodeWhenConfidence", 1, 1000) ?? 2;
encodeWhenPercent = sr.LoadUInt32("ArEncodeWhenPercent", 1, 100) ?? 100;
encodeWhenZeroOffset = sr.LoadBoolean("ArEncodeWhenZeroOffset") ?? false;
noUnverifiedOutput = sr.LoadBoolean("ArNoUnverifiedOutput") ?? false;
fixOffset = sr.LoadBoolean("ArFixOffset") ?? false;
writeArTagsOnEncode = sr.LoadBoolean("ArWriteCRC") ?? true;
writeArLogOnConvert = sr.LoadBoolean("ArWriteLog") ?? true;
writeArTagsOnVerify = sr.LoadBoolean("ArWriteTagsOnVerify") ?? false;
writeArLogOnVerify = sr.LoadBoolean("ArWriteLogOnVerify") ?? false;
preserveHTOA = sr.LoadBoolean("PreserveHTOA") ?? true;
autoCorrectFilenames = sr.LoadBoolean("AutoCorrectFilenames") ?? true;
keepOriginalFilenames = sr.LoadBoolean("KeepOriginalFilenames") ?? false;
singleFilenameFormat = sr.Load("SingleFilenameFormat") ?? singleFilenameFormat;
trackFilenameFormat = sr.Load("TrackFilenameFormat") ?? trackFilenameFormat;
removeSpecial = sr.LoadBoolean("RemoveSpecialCharacters") ?? false;
specialExceptions = sr.Load("SpecialCharactersExceptions") ?? "-()";
replaceSpaces = sr.LoadBoolean("ReplaceSpaces") ?? false;
embedLog = sr.LoadBoolean("EmbedLog") ?? true;
extractLog = sr.LoadBoolean("ExtractLog") ?? true;
fillUpCUE = sr.LoadBoolean("FillUpCUE") ?? true;
overwriteCUEData = sr.LoadBoolean("OverwriteCUEData") ?? false;
filenamesANSISafe = sr.LoadBoolean("FilenamesANSISafe") ?? true;
bruteForceDTL = sr.LoadBoolean("BruteForceDTL") ?? false;
createEACLOG = sr.LoadBoolean("CreateEACLOG") ?? createEACLOG;
detectHDCD = sr.LoadBoolean("DetectHDCD") ?? true;
wait750FramesForHDCD = sr.LoadBoolean("Wait750FramesForHDCD") ?? true;
decodeHDCD = sr.LoadBoolean("DecodeHDCD") ?? false;
createM3U = sr.LoadBoolean("CreateM3U") ?? false;
createCUEFileWhenEmbedded = sr.LoadBoolean("CreateCUEFileWhenEmbedded") ?? true;
truncate4608ExtraSamples = sr.LoadBoolean("Truncate4608ExtraSamples") ?? true;
lossyWAVQuality = sr.LoadInt32("LossyWAVQuality", 0, 10) ?? 5;
decodeHDCDtoLW16 = sr.LoadBoolean("DecodeHDCDToLossyWAV16") ?? false;
decodeHDCDto24bit = sr.LoadBoolean("DecodeHDCDTo24bit") ?? true;
oneInstance = sr.LoadBoolean("OneInstance") ?? true;
checkForUpdates = sr.LoadBoolean("CheckForUpdates") ?? true;
writeBasicTagsFromCUEData = sr.LoadBoolean("WriteBasicTagsFromCUEData") ?? true;
copyBasicTags = sr.LoadBoolean("CopyBasicTags") ?? true;
copyUnknownTags = sr.LoadBoolean("CopyUnknownTags") ?? true;
CopyAlbumArt = sr.LoadBoolean("CopyAlbumArt") ?? true;
embedAlbumArt = sr.LoadBoolean("EmbedAlbumArt") ?? true;
extractAlbumArt = sr.LoadBoolean("ExtractAlbumArt") ?? true;
maxAlbumArtSize = sr.LoadInt32("MaxAlbumArtSize", 100, 10000) ?? maxAlbumArtSize;
arLogToSourceFolder = sr.LoadBoolean("ArLogToSourceFolder") ?? arLogToSourceFolder;
arLogVerbose = sr.LoadBoolean("ArLogVerbose") ?? arLogVerbose;
fixOffsetToNearest = sr.LoadBoolean("FixOffsetToNearest") ?? fixOffsetToNearest;
ArLogFilenameFormat = sr.Load("ArLogFilenameFormat") ?? ArLogFilenameFormat;
AlArtFilenameFormat = sr.Load("AlArtFilenameFormat") ?? AlArtFilenameFormat;
separateDecodingThread = sr.LoadBoolean("SeparateDecodingThread") ?? separateDecodingThread;
try
{
using (TextReader reader = new StringReader(sr.Load("Advanced")))
advanced = CUEConfigAdvanced.serializer.Deserialize(reader) as CUEConfigAdvanced;
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
int totalEncoders = sr.LoadInt32("ExternalEncoders", 0, null) ?? 0;
for (int nEncoders = 0; nEncoders < totalEncoders; nEncoders++)
{
string name = sr.Load(string.Format("ExternalEncoder{0}Name", nEncoders));
string extension = sr.Load(string.Format("ExternalEncoder{0}Extension", nEncoders));
string path = sr.Load(string.Format("ExternalEncoder{0}Path", nEncoders));
string parameters = sr.Load(string.Format("ExternalEncoder{0}Parameters", nEncoders));
bool lossless = sr.LoadBoolean(string.Format("ExternalEncoder{0}Lossless", nEncoders)) ?? true;
string supported_modes = sr.Load(string.Format("ExternalEncoder{0}Modes", nEncoders)) ?? "";
string default_mode = sr.Load(string.Format("ExternalEncoder{0}Mode", nEncoders)) ?? "";
CUEToolsUDC encoder;
if (name == null) continue;
if (!encoders.TryGetValue(name, out encoder))
{
if (path == null || parameters == null || extension == null) continue;
encoders.Add(new CUEToolsUDC(name, extension, lossless, supported_modes, default_mode, path, parameters));
}
else if (version == 203)
{
if (encoder.path != null)
{
if (path == null || parameters == null || extension == null) continue;
encoder.extension = extension;
encoder.path = path;
encoder.lossless = lossless;
encoder.parameters = parameters;
}
else
{
if (encoder.settingsSerializer != null && parameters != "")
try
{
using (TextReader reader = new StringReader(parameters))
encoder.settings = encoder.settingsSerializer.Deserialize(reader);
}
catch
{
}
}
encoder.supported_modes = supported_modes;
encoder.default_mode = default_mode;
}
}
int totalDecoders = sr.LoadInt32("ExternalDecoders", 0, null) ?? 0;
for (int nDecoders = 0; nDecoders < totalDecoders; nDecoders++)
{
string name = sr.Load(string.Format("ExternalDecoder{0}Name", nDecoders));
string extension = sr.Load(string.Format("ExternalDecoder{0}Extension", nDecoders));
string path = sr.Load(string.Format("ExternalDecoder{0}Path", nDecoders));
string parameters = sr.Load(string.Format("ExternalDecoder{0}Parameters", nDecoders));
CUEToolsUDC decoder;
if (!decoders.TryGetValue(name, out decoder))
decoders.Add(name, new CUEToolsUDC(name, extension, true, "", "", path, parameters));
else
{
decoder.extension = extension;
decoder.path = path;
decoder.parameters = parameters;
}
}
int totalFormats = sr.LoadInt32("CustomFormats", 0, null) ?? 0;
for (int nFormats = 0; nFormats < totalFormats; nFormats++)
{
string extension = sr.Load(string.Format("CustomFormat{0}Name", nFormats));
string encoderLossless = sr.Load(string.Format("CustomFormat{0}EncoderLossless", nFormats)) ?? "";
string encoderLossy = sr.Load(string.Format("CustomFormat{0}EncoderLossy", nFormats)) ?? "";
string decoder = sr.Load(string.Format("CustomFormat{0}Decoder", nFormats));
CUEToolsTagger tagger = (CUEToolsTagger)(sr.LoadInt32(string.Format("CustomFormat{0}Tagger", nFormats), 0, 2) ?? 0);
bool allowLossless = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossless", nFormats)) ?? false;
bool allowLossy = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossy", nFormats)) ?? false;
bool allowLossyWav = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossyWAV", nFormats)) ?? false;
bool allowEmbed = sr.LoadBoolean(string.Format("CustomFormat{0}AllowEmbed", nFormats)) ?? false;
CUEToolsFormat format;
CUEToolsUDC udcLossless, udcLossy;
if (encoderLossless == "" || !encoders.TryGetValue(encoderLossless, out udcLossless))
udcLossless = null;
if (encoderLossy == "" || !encoders.TryGetValue(encoderLossy, out udcLossy))
udcLossy = null;
if (!formats.TryGetValue(extension, out format))
formats.Add(extension, new CUEToolsFormat(extension, tagger, allowLossless, allowLossy, allowLossyWav, allowEmbed, false, udcLossless, udcLossy, decoder));
else
{
format.encoderLossless = udcLossless;
format.encoderLossy = udcLossy;
format.decoder = decoder;
if (!format.builtin)
{
format.tagger = tagger;
format.allowLossless = allowLossless;
format.allowLossy = allowLossy;
format.allowLossyWAV = allowLossyWav;
format.allowEmbed = allowEmbed;
}
}
}
int totalScripts = sr.LoadInt32("CustomScripts", 0, null) ?? 0;
for (int nScripts = 0; nScripts < totalScripts; nScripts++)
{
string name = sr.Load(string.Format("CustomScript{0}Name", nScripts));
string code = sr.Load(string.Format("CustomScript{0}Code", nScripts));
List<CUEAction> conditions = new List<CUEAction>();
int totalConditions = sr.LoadInt32(string.Format("CustomScript{0}Conditions", nScripts), 0, null) ?? 0;
for (int nCondition = 0; nCondition < totalConditions; nCondition++)
conditions.Add((CUEAction)sr.LoadInt32(string.Format("CustomScript{0}Condition{1}", nScripts, nCondition), 0, null));
CUEToolsScript script;
if (!scripts.TryGetValue(name, out script))
{
if (name != "submit")
scripts.Add(name, new CUEToolsScript(name, false, conditions, code));
}
else
{
if (!script.builtin)
{
script.code = code;
script.conditions = conditions;
}
}
}
defaultVerifyScript = sr.Load("DefaultVerifyScript") ?? "default";
defaultEncodeScript = sr.Load("DefaultVerifyAndConvertScript") ?? "default";
gapsHandling = (CUEStyle?)sr.LoadInt32("GapsHandling", null, null) ?? gapsHandling;
language = sr.Load("Language") ?? Thread.CurrentThread.CurrentUICulture.Name;
if (ArLogFilenameFormat.Contains("%F"))
ArLogFilenameFormat = "%filename%.accurip";
if (singleFilenameFormat.Contains("%F"))
singleFilenameFormat = "%filename%";
if (trackFilenameFormat.Contains("%N"))
trackFilenameFormat = "%tracknumber%. %title%";
}
public string GetDefaultDecoder(string extension)
{
CUEToolsUDC result = null;
foreach (KeyValuePair<string, CUEToolsUDC> decoder in decoders)
if (decoder.Value.Extension == extension && (result == null || result.priority < decoder.Value.priority))
result = decoder.Value;
return result == null ? null : result.Name;
}
public IWebProxy GetProxy()
{
IWebProxy proxy = null;
switch (advanced.UseProxyMode)
{
case CUEConfigAdvanced.ProxyMode.System:
proxy = WebRequest.GetSystemWebProxy();
break;
case CUEConfigAdvanced.ProxyMode.Custom:
proxy = new WebProxy(advanced.ProxyServer, advanced.ProxyPort);
if (advanced.ProxyUser != "")
proxy.Credentials = new NetworkCredential(advanced.ProxyUser, advanced.ProxyPassword);
break;
}
return proxy;
}
public string CleanseString(string s)
{
StringBuilder sb = new StringBuilder();
char[] invalid = Path.GetInvalidFileNameChars();
if (filenamesANSISafe)
s = Encoding.Default.GetString(Encoding.Default.GetBytes(s));
for (int i = 0; i < s.Length; i++)
{
char ch = s[i];
if (filenamesANSISafe && removeSpecial && specialExceptions.IndexOf(ch) < 0 && !(
((ch >= 'a') && (ch <= 'z')) ||
((ch >= 'A') && (ch <= 'Z')) ||
((ch >= '0') && (ch <= '9')) ||
(ch == ' ') || (ch == '_')))
ch = '_';
if ((Array.IndexOf(invalid, ch) >= 0) || (replaceSpaces && ch == ' '))
sb.Append("_");
else
sb.Append(ch);
}
return sb.ToString();
}
}
}

View File

@@ -0,0 +1,72 @@
using System;
using System.ComponentModel;
using System.Xml.Serialization;
namespace CUETools.Processor
{
[Serializable]
public class CUEConfigAdvanced
{
public enum ProxyMode
{
None,
System,
Custom
}
public CUEConfigAdvanced()
{
// Iterate through each property and call ResetValue()
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(this))
{
property.ResetValue(this);
}
}
internal static XmlSerializer serializer = new XmlSerializer(typeof(CUEConfigAdvanced));
[DefaultValue("i"), Category("Freedb"), DisplayName("Email user")]
public string FreedbUser { get; set; }
[DefaultValue("wont.tell"), Category("Freedb"), DisplayName("Email domain")]
public string FreedbDomain { get; set; }
[DefaultValue(ProxyMode.System), Category("Proxy"), DisplayName("Proxy mode")]
public ProxyMode UseProxyMode { get; set; }
[DefaultValue("127.0.0.1"), Category("Proxy"), DisplayName("Proxy server host")]
public string ProxyServer { get; set; }
[DefaultValue(8080), Category("Proxy"), DisplayName("Proxy server port")]
public int ProxyPort { get; set; }
[DefaultValue(""), Category("Proxy"), DisplayName("Proxy auth user")]
public string ProxyUser { get; set; }
[DefaultValue(""), Category("Proxy"), DisplayName("Proxy auth password")]
public string ProxyPassword { get; set; }
[DefaultValue(true), Category("Cache"), DisplayName("Cache metadata")]
public bool CacheMetadata { get; set; }
[DefaultValue(new string[] { "folder.jpg", "cover.jpg", "albumart.jpg", "thumbnail.jpg", "albumartlarge.jpg", "front.jpg", "%album%.jpg" })]
[Category("Cover Art"), DisplayName("Cover Art Files")]
public string[] CoverArtFiles { get; set; }
[DefaultValue(true)]
[Category("Cover Art"), DisplayName("Cover Art Extended Search")]
public bool CoverArtSearchSubdirs { get; set; }
[DefaultValue(false)]
[DisplayName("Create TOC files")]
public bool CreateTOC { get; set; }
[DefaultValue(true), Category("CTDB"), DisplayName("Submit to CTDB")]
public bool CTDBSubmit { get; set; }
[DefaultValue(true), Category("CTDB"), DisplayName("Ask before submitting")]
public bool CTDBAsk { get; set; }
[DefaultValue("db.cuetools.net"), Category("CTDB"), DisplayName("CTDB Server")]
public string CTDBServer { get; set; }
}
}

View File

@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace CUETools.Processor
{
public class CUELine
{
private List<String> _params;
private List<bool> _quoted;
public CUELine()
{
_params = new List<string>();
_quoted = new List<bool>();
}
public CUELine(string line)
{
int start, end, lineLen;
bool isQuoted;
_params = new List<string>();
_quoted = new List<bool>();
start = 0;
lineLen = line.Length;
while (true)
{
while ((start < lineLen) && (line[start] == ' '))
{
start++;
}
if (start >= lineLen)
{
break;
}
isQuoted = (line[start] == '"');
if (isQuoted)
{
start++;
}
end = line.IndexOf(isQuoted ? '"' : ' ', start);
if (end == -1)
{
end = lineLen;
}
_params.Add(line.Substring(start, end - start));
_quoted.Add(isQuoted);
start = isQuoted ? end + 1 : end;
}
}
public List<string> Params
{
get
{
return _params;
}
}
public List<bool> IsQuoted
{
get
{
return _quoted;
}
}
public override string ToString()
{
if (_params.Count != _quoted.Count)
{
throw new Exception("Parameter and IsQuoted lists must match.");
}
StringBuilder sb = new StringBuilder();
int last = _params.Count - 1;
for (int i = 0; i <= last; i++)
{
if (_quoted[i] || _params[i].Contains(" ")) sb.Append('"');
sb.Append(_params[i].Replace('"', '\''));
if (_quoted[i] || _params[i].Contains(" ")) sb.Append('"');
if (i < last) sb.Append(' ');
}
return sb.ToString();
}
}
}

View File

@@ -4,7 +4,7 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Xml.Serialization; using System.Xml.Serialization;
using CUETools.CDImage; using CUETools.Processor.Settings;
namespace CUETools.Processor namespace CUETools.Processor
{ {
@@ -330,48 +330,4 @@ namespace CUETools.Processor
return isVarious; return isVarious;
} }
} }
public class CUETrackMetadata
{
public CUETrackMetadata()
{
Artist = "";
Title = "";
ISRC = "";
}
[DefaultValue("")]
public string Artist { get; set; }
[DefaultValue("")]
public string Title { get; set; }
[DefaultValue("")]
public string ISRC { get; set; }
}
public class CUEMetadataEntry
{
public CUEMetadata metadata { get; set; }
public CDImageLayout TOC { get; set; }
public string ImageKey { get; set; }
public CUEMetadataEntry(CUEMetadata metadata, CDImageLayout TOC, string key)
{
this.metadata = new CUEMetadata(metadata);
this.TOC = TOC;
this.ImageKey = key;
}
public CUEMetadataEntry(CDImageLayout TOC, string key)
: this(new CUEMetadata(TOC.TOCID, (int)TOC.AudioTracks), TOC, key)
{
}
public override string ToString()
{
return string.Format("{0}{1} - {2}{3}{4}", metadata.Year != "" ? metadata.Year + ": " : "",
metadata.Artist == "" ? "Unknown Artist" : metadata.Artist,
metadata.Title == "" ? "Unknown Title" : metadata.Title,
metadata.DiscNumberAndName == "" ? "" : " (disc " + metadata.DiscNumberAndName + ")",
metadata.ReleaseDateAndLabel == "" ? "" : " (" + metadata.ReleaseDateAndLabel + ")");
}
}
} }

View File

@@ -0,0 +1,32 @@
using CUETools.CDImage;
namespace CUETools.Processor
{
public class CUEMetadataEntry
{
public CUEMetadata metadata { get; set; }
public CDImageLayout TOC { get; set; }
public string ImageKey { get; set; }
public CUEMetadataEntry(CUEMetadata metadata, CDImageLayout TOC, string key)
{
this.metadata = new CUEMetadata(metadata);
this.TOC = TOC;
this.ImageKey = key;
}
public CUEMetadataEntry(CDImageLayout TOC, string key)
: this(new CUEMetadata(TOC.TOCID, (int)TOC.AudioTracks), TOC, key)
{
}
public override string ToString()
{
return string.Format("{0}{1} - {2}{3}{4}", metadata.Year != "" ? metadata.Year + ": " : "",
metadata.Artist == "" ? "Unknown Artist" : metadata.Artist,
metadata.Title == "" ? "Unknown Title" : metadata.Title,
metadata.DiscNumberAndName == "" ? "" : " (disc " + metadata.DiscNumberAndName + ")",
metadata.ReleaseDateAndLabel == "" ? "" : " (" + metadata.ReleaseDateAndLabel + ")");
}
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using CUETools.Codecs;
using CUETools.Compression;
using CUETools.Ripper;
namespace CUETools.Processor
{
public static class CUEProcessorPlugins
{
public static List<Type> encs;
public static List<Type> decs;
public static List<Type> arcp;
public static List<string> arcp_fmt;
public static Type hdcd;
public static Type ripper;
static CUEProcessorPlugins()
{
encs = new List<Type>();
decs = new List<Type>();
arcp = new List<Type>();
arcp_fmt = new List<string>();
encs.Add(typeof(CUETools.Codecs.WAVWriter));
decs.Add(typeof(CUETools.Codecs.WAVReader));
//ApplicationSecurityInfo asi = new ApplicationSecurityInfo(AppDomain.CurrentDomain.ActivationContext);
//string arch = asi.ApplicationId.ProcessorArchitecture;
//ActivationContext is null most of the time :(
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 + ")");
if (Directory.Exists(plugins_path))
AddPluginDirectory(plugins_path);
plugins_path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins");
if (Directory.Exists(plugins_path))
AddPluginDirectory(plugins_path);
}
private static void AddPluginDirectory(string plugins_path)
{
foreach (string plugin_path in Directory.GetFiles(plugins_path, "*.dll", SearchOption.TopDirectoryOnly))
{
try
{
AddPlugin(plugin_path);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
}
}
private static void AddPlugin(string plugin_path)
{
AssemblyName name = AssemblyName.GetAssemblyName(plugin_path);
Assembly assembly = Assembly.Load(name, Assembly.GetEntryAssembly().Evidence);
System.Diagnostics.Trace.WriteLine("Loaded " + assembly.FullName);
foreach (Type type in assembly.GetExportedTypes())
{
try
{
if (Attribute.GetCustomAttribute(type, typeof(AudioDecoderClass)) != null)
{
decs.Add(type);
}
//if (type.IsClass && !type.IsAbstract && typeof(IAudioDest).IsAssignableFrom(type))
if (Attribute.GetCustomAttributes(type, typeof(AudioEncoderClass)).Length > 0)
{
encs.Add(type);
}
CompressionProviderClass archclass = Attribute.GetCustomAttribute(type, typeof(CompressionProviderClass)) as CompressionProviderClass;
if (archclass != null)
{
arcp.Add(type);
if (!arcp_fmt.Contains(archclass.Extension))
arcp_fmt.Add(archclass.Extension);
}
if (type.Name == "HDCDDotNet")
{
hdcd = type;
}
if (type.IsClass && !type.IsAbstract && typeof(ICDRipper).IsAssignableFrom(type))
{
ripper = type;
}
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,119 @@
using System;
using CUETools.Codecs;
namespace CUETools.Processor
{
public class CUESheetAudio : IAudioSource
{
private CUESheet cueSheet;
private IAudioSource currentAudio;
private int currentSource;
private long nextPos;
private long _samplePos, _sampleLen;
public long Length
{
get { return _sampleLen; }
}
public long Remaining
{
get { return _sampleLen - _samplePos; }
}
public AudioPCMConfig PCM
{
get { return AudioPCMConfig.RedBook; }
}
public string Path
{
get { return cueSheet.InputPath; }
}
public long Position
{
get
{
return _samplePos;
}
set
{
SetPosition(value);
}
}
public CUESheetAudio(CUESheet cueSheet)
{
this.cueSheet = cueSheet;
this.currentAudio = null;
this._samplePos = 0;
this._sampleLen = 0;
this.currentSource = -1;
this.nextPos = 0;
cueSheet._sources.ForEach(s => this._sampleLen += s.Length);
}
private void SetPosition(long value)
{
if (value == _samplePos)
return;
long sourceStart = 0;
for (int iSource = 0; iSource < cueSheet._sources.Count; iSource++)
{
if (value >= sourceStart && value < sourceStart + cueSheet._sources[iSource].Length)
{
if (iSource != currentSource)
{
if (currentAudio != null)
currentAudio.Close();
currentSource = iSource;
currentAudio = cueSheet.GetAudioSource(currentSource, false);
nextPos = sourceStart + cueSheet._sources[currentSource].Length;
}
currentAudio.Position = value - sourceStart + cueSheet._sources[currentSource].Offset;
_samplePos = value;
return;
}
sourceStart += cueSheet._sources[iSource].Length;
}
throw new Exception("Invalid position");
}
public void Close()
{
if (currentAudio != null)
{
currentAudio.Close();
currentAudio = null;
}
}
public int Read(AudioBuffer buff, int maxLength)
{
buff.Prepare(this, maxLength);
while (_samplePos >= nextPos)
{
currentSource++;
if (currentSource >= cueSheet._sources.Count)
{
buff.Length = 0;
return 0;
}
if (currentAudio != null)
currentAudio.Close();
currentAudio = cueSheet.GetAudioSource(currentSource, false);
int offset = (int)(_samplePos - nextPos);
if (offset != 0)
currentAudio.Position += offset;
nextPos += cueSheet._sources[currentSource].Length;
}
int count = (int)(nextPos - _samplePos);
if (maxLength >= 0)
count = Math.Min(count, maxLength);
count = currentAudio.Read(buff, count);
_samplePos += count;
return count;
}
}
}

View File

@@ -0,0 +1,26 @@
namespace CUETools.Processor
{
public enum CUEStyle
{
/// <summary>
/// Single file with embedded CUE
/// </summary>
SingleFileWithCUE,
/// <summary>
/// Single file with external CUE
/// </summary>
SingleFile,
/// <summary>
/// Gaps prepended file-per-track
/// </summary>
GapsPrepended,
/// <summary>
/// Gaps appended (noncompliant) file-per-track
/// </summary>
GapsAppended,
/// <summary>
/// Gaps left out file-per-track
/// </summary>
GapsLeftOut
}
}

View File

@@ -72,12 +72,44 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ArchiveFileAbstraction.cs" />
<Compile Include="AudioEncoderType.cs" />
<Compile Include="AudioReadWrite.cs" /> <Compile Include="AudioReadWrite.cs" />
<Compile Include="CUEAction.cs" />
<Compile Include="CUEConfig.cs" />
<Compile Include="CUEConfigAdvanced.cs" />
<Compile Include="CUELine.cs" />
<Compile Include="CUEMetadata.cs" /> <Compile Include="CUEMetadata.cs" />
<Compile Include="Processor.cs" /> <Compile Include="CUEMetadataEntry.cs" />
<Compile Include="CUEProcessorPlugins.cs" />
<Compile Include="CUESheet.cs" />
<Compile Include="CUESheetAudio.cs" />
<Compile Include="CUEStyle.cs" />
<Compile Include="CUEToolsFormat.cs" />
<Compile Include="CUEToolsLocalDB.cs" />
<Compile Include="CUEToolsLocalDBEntry.cs" />
<Compile Include="CUEToolsProfile.cs" />
<Compile Include="CUEToolsProgressEventArgs.cs" />
<Compile Include="CUEToolsScript.cs" />
<Compile Include="CUEToolsSelectionEventArgs.cs" />
<Compile Include="CUEToolsSourceFile.cs" />
<Compile Include="CUEToolsTagger.cs" />
<Compile Include="CUEToolsUDC.cs" />
<Compile Include="CUEToolsUDCList.cs" />
<Compile Include="CUEToolsVerifyTask.cs" />
<Compile Include="CUETrackMetadata.cs" />
<Compile Include="FileGroupInfo.cs" />
<Compile Include="FileGroupInfoType.cs" />
<Compile Include="General.cs" />
<Compile Include="IndexInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" /> <Compile Include="Settings\SettingsReader.cs" />
<Compile Include="Settings\SettingsShared.cs" />
<Compile Include="Settings\SettingsWriter.cs" />
<Compile Include="SourceInfo.cs" />
<Compile Include="StopException.cs" />
<Compile Include="Tagging.cs" /> <Compile Include="Tagging.cs" />
<Compile Include="TrackInfo.cs" />
<Compile Include="UserDefined.cs" /> <Compile Include="UserDefined.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -141,6 +173,9 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="License.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,46 @@
namespace CUETools.Processor
{
public class CUEToolsFormat
{
public CUEToolsFormat(
string _extension,
CUEToolsTagger _tagger,
bool _allowLossless,
bool _allowLossy,
bool _allowLossyWAV,
bool _allowEmbed,
bool _builtin,
CUEToolsUDC _encoderLossless,
CUEToolsUDC _encoderLossy,
string _decoder)
{
extension = _extension;
tagger = _tagger;
allowLossless = _allowLossless;
allowLossy = _allowLossy;
allowLossyWAV = _allowLossyWAV;
allowEmbed = _allowEmbed;
builtin = _builtin;
encoderLossless = _encoderLossless;
encoderLossy = _encoderLossy;
decoder = _decoder;
}
public string DotExtension
{
get
{
return "." + extension;
}
}
public override string ToString()
{
return extension;
}
public string extension;
public CUEToolsUDC encoderLossless;
public CUEToolsUDC encoderLossy;
public string decoder;
public CUEToolsTagger tagger;
public bool allowLossless, allowLossy, allowLossyWAV, allowEmbed, builtin;
}
}

View File

@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Xml.Serialization;
using CUETools.CDImage;
using CUETools.Processor.Settings;
namespace CUETools.Processor
{
[Serializable]
public class CUEToolsLocalDB : List<CUEToolsLocalDBEntry>
{
private static XmlSerializer serializer = new XmlSerializer(typeof(CUEToolsLocalDB));
public bool Dirty
{
get;
set;
}
public static List<CUEToolsLocalDBEntry>[] Group(List<CUEToolsLocalDBEntry> items, Converter<CUEToolsLocalDBEntry, string> convert, Comparison<List<CUEToolsLocalDBEntry>> compare)
{
var results = new Dictionary<string, List<CUEToolsLocalDBEntry>>(items.Count);
foreach (var item in items)
{
var key = convert(item);
if (key != null)
{
if (!results.ContainsKey(key))
results[key] = new List<CUEToolsLocalDBEntry>();
results[key].Add(item);
}
}
var groups = new List<CUEToolsLocalDBEntry>[results.Count];
results.Values.CopyTo(groups, 0);
if (compare != null)
Array.Sort(groups, (a, b) => compare(a, b));
else
{
var keys = new string[results.Count];
results.Keys.CopyTo(keys, 0);
Array.Sort(keys, groups);
}
return groups;
}
public CUEToolsLocalDBEntry Lookup(string inputPath)
{
return this.Find(e => e.HasPath(inputPath));
}
public CUEToolsLocalDBEntry Lookup(CDImageLayout layout, List<string> audioPaths)
{
List<string> fullAudioPaths = audioPaths == null ? null : audioPaths.ConvertAll(p => CUEToolsLocalDBEntry.NormalizePath(p));
var entry = this.Find(e => e.Equals(layout, fullAudioPaths));
if (entry == null)
{
entry = new CUEToolsLocalDBEntry();
entry.TrackCount = layout.TrackCount;
entry.AudioTracks = (int)layout.AudioTracks;
entry.FirstAudio = layout.FirstAudio;
entry.TrackOffsets = layout.TrackOffsets;
entry.DiscID = layout.TOCID;
entry.AudioPaths = fullAudioPaths;
this.Add(entry);
this.Dirty = true;
}
return entry;
}
public static string LocalDBPath
{
get
{
return Path.Combine(SettingsShared.GetProfileDir("CUE Tools", System.Windows.Forms.Application.ExecutablePath), "LocalDB.xml.z");
}
}
public void Save()
{
if (!this.Dirty) return;
string tempPath = LocalDBPath + "." + DateTime.Now.Ticks.ToString() + ".tmp";
using (var fileStream = new FileStream(tempPath, FileMode.CreateNew))
using (var deflateStream = new DeflateStream(fileStream, CompressionMode.Compress))
using (TextWriter writer = new StreamWriter(deflateStream))
serializer.Serialize(writer, this);
File.Delete(LocalDBPath);
File.Move(tempPath, LocalDBPath);
this.Dirty = false;
}
public static CUEToolsLocalDB Load()
{
if (!File.Exists(LocalDBPath))
return new CUEToolsLocalDB();
using (var fileStream = new FileStream(LocalDBPath, FileMode.Open))
using (var deflateStream = new DeflateStream(fileStream, CompressionMode.Decompress))
return serializer.Deserialize(deflateStream) as CUEToolsLocalDB;
}
}
}

View File

@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using CUETools.AccurateRip;
using CUETools.CDImage;
namespace CUETools.Processor
{
[Serializable]
public class CUEToolsLocalDBEntry
{
public CUEToolsLocalDBEntry()
{
}
public string DiscID { get; set; }
public OffsetSafeCRCRecord OffsetSafeCRC { get; set; }
public CUEMetadata Metadata { get; set; }
public List<string> InputPaths { get; set; }
public List<string> AudioPaths { get; set; }
public int TrackCount { get; set; }
public int AudioTracks { get; set; }
public int FirstAudio { get; set; }
public string TrackOffsets { get; set; }
public uint ARConfidence { get; set; }
public string Status { get; set; }
public string Log { get; set; }
public DateTime VerificationDate { get; set; }
public DateTime CTDBVerificationDate { get; set; }
public int CTDBConfidence { get; set; }
[XmlIgnore]
public string Path
{
get
{
return InputPaths == null || InputPaths.Count < 1 ? null : InputPaths[0];
}
}
static public string NormalizePath(string path)
{
if (System.Environment.OSVersion.Platform != System.PlatformID.Unix)
return System.IO.Path.GetFullPath(path).ToLower();
else
return System.IO.Path.GetFullPath(path);
}
public bool HasPath(string inputPath)
{
string norm = CUEToolsLocalDBEntry.NormalizePath(inputPath);
return this.InputPaths != null && this.InputPaths.Find(i => i == norm) != null;
}
public bool EqualAudioPaths(List<string> fullAudioPaths)
{
int count1 = this.AudioPaths == null ? 0 : this.AudioPaths.Count;
int count2 = fullAudioPaths == null ? 0 : fullAudioPaths.Count;
if (count1 == count2)
{
bool equals = true;
for (int i = 0; i < count1; i++)
equals &= this.AudioPaths[i] == fullAudioPaths[i];
return equals;
}
return false;
}
public bool EqualLayouts(CDImageLayout layout)
{
return this.TrackCount == layout.TrackCount
&& this.AudioTracks == layout.AudioTracks
&& this.FirstAudio == layout.FirstAudio
&& this.TrackOffsets == layout.TrackOffsets;
}
public bool Equals(CDImageLayout layout, List<string> fullAudioPaths)
{
return EqualLayouts(layout) && EqualAudioPaths(fullAudioPaths);
}
}
}

View File

@@ -0,0 +1,75 @@
using CUETools.Processor.Settings;
namespace CUETools.Processor
{
public class CUEToolsProfile
{
public CUEToolsProfile(string name)
{
_config = new CUEConfig();
_name = name;
switch (name)
{
case "verify":
_action = CUEAction.Verify;
_script = "only if found";
break;
case "convert":
_action = CUEAction.Encode;
break;
case "fix":
_action = CUEAction.Encode;
_script = "fix offset";
break;
}
}
public void Load(SettingsReader sr)
{
_config.Load(sr);
_useFreeDb = sr.LoadBoolean("FreedbLookup") ?? _useFreeDb;
_useMusicBrainz = sr.LoadBoolean("MusicBrainzLookup") ?? _useMusicBrainz;
_useAccurateRip = sr.LoadBoolean("AccurateRipLookup") ?? _useAccurateRip;
_useCUEToolsDB = sr.LoadBoolean("CUEToolsDBLookup") ?? _useCUEToolsDB;
_useLocalDB = sr.LoadBoolean("LocalDBLookup") ?? _useLocalDB;
_skipRecent = sr.LoadBoolean("SkipRecent") ?? _skipRecent;
_outputAudioType = (AudioEncoderType?)sr.LoadInt32("OutputAudioType", null, null) ?? _outputAudioType;
_outputAudioFormat = sr.Load("OutputAudioFmt") ?? _outputAudioFormat;
_action = (CUEAction?)sr.LoadInt32("AccurateRipMode", (int)CUEAction.Encode, (int)CUEAction.CorrectFilenames) ?? _action;
_CUEStyle = (CUEStyle?)sr.LoadInt32("CUEStyle", null, null) ?? _CUEStyle;
_writeOffset = sr.LoadInt32("WriteOffset", null, null) ?? 0;
_outputTemplate = sr.Load("OutputPathTemplate") ?? _outputTemplate;
_script = sr.Load("Script") ?? _script;
}
public void Save(SettingsWriter sw)
{
_config.Save(sw);
sw.Save("FreedbLookup", _useFreeDb);
sw.Save("MusicBrainzLookup", _useMusicBrainz);
sw.Save("AccurateRipLookup", _useAccurateRip);
sw.Save("LocalDBLookup", _useLocalDB);
sw.Save("SkipRecent", _skipRecent);
sw.Save("CUEToolsDBLookup", _useCUEToolsDB);
sw.Save("OutputAudioType", (int)_outputAudioType);
sw.Save("OutputAudioFmt", _outputAudioFormat);
sw.Save("AccurateRipMode", (int)_action);
sw.Save("CUEStyle", (int)_CUEStyle);
sw.Save("WriteOffset", (int)_writeOffset);
sw.Save("OutputPathTemplate", _outputTemplate);
sw.Save("Script", _script);
}
public CUEConfig _config;
public AudioEncoderType _outputAudioType = AudioEncoderType.Lossless;
public string _outputAudioFormat = "flac", _outputTemplate = null, _script = "default";
public CUEAction _action = CUEAction.Encode;
public CUEStyle _CUEStyle = CUEStyle.SingleFileWithCUE;
public int _writeOffset = 0;
public bool _useFreeDb = true, _useMusicBrainz = true, _useAccurateRip = true, _useCUEToolsDB = true, _useLocalDB = true, _skipRecent = false;
public string _name;
}
}

View File

@@ -0,0 +1,14 @@
using System;
namespace CUETools.Processor
{
public class CUEToolsProgressEventArgs : EventArgs
{
public string status = string.Empty;
public double percent = 0.0;
public int offset = 0;
public string input = string.Empty;
public string output = string.Empty;
public CUESheet cueSheet;
}
}

View File

@@ -0,0 +1,29 @@
using System.Collections.Generic;
namespace CUETools.Processor
{
public class CUEToolsScript
{
public string name { get; set; }
public bool builtin;
public List<CUEAction> conditions;
public string code;
public CUEToolsScript(string _name, bool _builtin, IEnumerable<CUEAction> _conditions, string _code)
{
name = _name;
builtin = _builtin;
conditions = new List<CUEAction>();
foreach (CUEAction condition in _conditions)
{
conditions.Add(condition);
}
code = _code;
}
public override string ToString()
{
return name;
}
}
}

View File

@@ -0,0 +1,10 @@
using System;
namespace CUETools.Processor
{
public class CUEToolsSelectionEventArgs : EventArgs
{
public object[] choices;
public int selection = -1;
}
}

View File

@@ -0,0 +1,18 @@
using System.IO;
namespace CUETools.Processor
{
public class CUEToolsSourceFile
{
public string path;
public string contents;
public object data;
public CUEToolsSourceFile(string _path, TextReader reader)
{
path = _path;
contents = reader.ReadToEnd();
reader.Close();
}
}
}

View File

@@ -0,0 +1,9 @@
namespace CUETools.Processor
{
public enum CUEToolsTagger
{
TagLibSharp = 0,
APEv2 = 1,
ID3v2 = 2,
}
}

View File

@@ -0,0 +1,148 @@
using System;
using System.ComponentModel;
using System.Xml.Serialization;
using CUETools.Codecs;
namespace CUETools.Processor
{
public class CUEToolsUDC : INotifyPropertyChanged
{
public string name = "";
public string extension = "wav";
public string path = "";
public string parameters = "";
public Type type = null;
public object settings = null;
public XmlSerializer settingsSerializer = null;
public string supported_modes = "";
public string default_mode = "";
public bool lossless = false;
public int priority = 0;
public event PropertyChangedEventHandler PropertyChanged;
public CUEToolsUDC(
string _name,
string _extension,
bool _lossless,
string _supported_modes,
string _default_mode,
string _path,
string _parameters
)
{
name = _name;
extension = _extension;
lossless = _lossless;
supported_modes = _supported_modes;
default_mode = _default_mode;
priority = 0;
path = _path;
parameters = _parameters;
type = null;
}
public CUEToolsUDC(AudioEncoderClass enc, Type enctype)
{
name = enc.EncoderName;
extension = enc.Extension;
lossless = enc.Lossless;
supported_modes = enc.SupportedModes;
default_mode = enc.DefaultMode;
priority = enc.Priority;
path = null;
parameters = "";
type = enctype;
settingsSerializer = null;
settings = null;
if (enc.Settings != null && enc.Settings != typeof(object))
{
settingsSerializer = new XmlSerializer(enc.Settings);
settings = Activator.CreateInstance(enc.Settings);
}
}
public CUEToolsUDC(AudioDecoderClass dec, Type dectype)
{
name = dec.DecoderName;
extension = dec.Extension;
lossless = true;
supported_modes = "";
default_mode = "";
priority = 1;
path = null;
parameters = null;
type = dectype;
}
public override string ToString()
{
return name;
}
public string Name
{
get { return name; }
set { name = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Name")); }
}
public string Path
{
get { return path; }
set { path = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Path")); }
}
public string Parameters
{
get { return parameters; }
set { parameters = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Parameters")); }
}
public bool Lossless
{
get { return lossless; }
set { lossless = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Lossless")); }
}
public string Extension
{
get { return extension; }
set { extension = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Extension")); }
}
public string DotExtension
{
get { return "." + extension; }
}
public string SupportedModesStr
{
get { return supported_modes; }
set { supported_modes = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("SupportedModesStr")); }
}
public string[] SupportedModes
{
get
{
return supported_modes.Split(' ');
}
}
public int DefaultModeIndex
{
get
{
string[] modes = supported_modes.Split(' ');
if (modes == null || modes.Length < 2)
return -1;
for (int i = 0; i < modes.Length; i++)
if (modes[i] == default_mode)
return i;
return -1;
}
}
public bool CanBeDeleted
{
get
{
return path != null;
}
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.ComponentModel;
namespace CUETools.Processor
{
public class CUEToolsUDCList : BindingList<CUEToolsUDC>
{
public CUEToolsUDCList()
: base()
{
AddingNew += OnAddingNew;
}
private void OnAddingNew(object sender, AddingNewEventArgs e)
{
string name = "new";
CUEToolsUDC temp;
while (TryGetValue(name, out temp))
{
name += "(1)";
}
e.NewObject = new CUEToolsUDC(name, "wav", true, "", "", "", "");
}
public bool TryGetValue(string name, out CUEToolsUDC result)
{
foreach (CUEToolsUDC udc in this)
{
if (udc.name == name)
{
result = udc;
return true;
}
}
result = null;
return false;
}
public CUEToolsUDC GetDefault(string extension, bool lossless)
{
CUEToolsUDC result = null;
foreach (CUEToolsUDC udc in this)
{
if (udc.extension == extension && udc.lossless == lossless && (result == null || result.priority < udc.priority))
{
result = udc;
}
}
return result;
}
public CUEToolsUDC this[string name]
{
get
{
CUEToolsUDC udc;
if (!TryGetValue(name, out udc))
{
throw new Exception("CUEToolsUDCList: member not found");
}
return udc;
}
}
}
}

View File

@@ -0,0 +1,93 @@
using System;
using CUETools.AccurateRip;
using CUETools.Codecs;
namespace CUETools.Processor
{
internal class CUEToolsVerifyTask
{
private CUESheet cueSheet;
public IAudioSource source { get; private set; }
public int start { get; private set; }
public int end { get; private set; }
public AccurateRipVerify ar { get; private set; }
public IAudioDest hdcd { get; private set; }
public CUEToolsVerifyTask(CUESheet cueSheet, int start, int end)
: this(cueSheet, start, end, cueSheet._useAccurateRip || cueSheet._useCUEToolsDB ? new AccurateRipVerify(cueSheet.TOC, null) : null, null)
{
}
public CUEToolsVerifyTask(CUESheet cueSheet, int start, int end, AccurateRipVerify ar)
: this(cueSheet, start, end, ar, null)
{
if (cueSheet.Config.detectHDCD && CUEProcessorPlugins.hdcd != null)
{
try { this.hdcd = Activator.CreateInstance(CUEProcessorPlugins.hdcd, 2, 44100, 20, false) as IAudioDest; }
catch { this.hdcd = null; }
}
}
private CUEToolsVerifyTask(CUESheet cueSheet, int start, int end, AccurateRipVerify ar, IAudioDest hdcd)
{
this.cueSheet = cueSheet;
this.start = start;
this.end = end;
this.source = new CUESheetAudio(cueSheet);
if (cueSheet.IsCD || cueSheet.Config.separateDecodingThread)
this.source = new AudioPipe(this.source, 0x10000);
this.source.Position = start;
this.ar = cueSheet._useAccurateRip ? ar : null;
this.hdcd = hdcd;
if (this.ar != null)
this.ar.Position = start;
}
public bool TryClose()
{
try { Close(); }
catch { return false; }
return true;
}
public void Close()
{
if (this.source != null)
{
this.source.Close();
this.source = null;
}
if (this.ar != null)
{
//this.ar.Close(); can't! throws
this.ar = null;
}
}
public int Step(AudioBuffer sampleBuffer)
{
if (Remaining == 0)
return 0;
int copyCount = source.Read(sampleBuffer, Remaining);
if (copyCount == 0)
return 0;
if (ar != null)
ar.Write(sampleBuffer);
if (hdcd != null)
{
hdcd.Write(sampleBuffer);
if (cueSheet.Config.wait750FramesForHDCD && source.Position > start + 750 * 588 && string.Format("{0:s}", hdcd) == "")
hdcd = null;
}
return copyCount;
}
public void Combine(CUEToolsVerifyTask task)
{
if (ar != null)
ar.Combine(task.ar, task.start, task.end);
}
public int Remaining { get { return end - (int)source.Position; } }
}
}

View File

@@ -0,0 +1,21 @@
using System.ComponentModel;
namespace CUETools.Processor
{
public class CUETrackMetadata
{
[DefaultValue("")]
public string Artist { get; set; }
[DefaultValue("")]
public string Title { get; set; }
[DefaultValue("")]
public string ISRC { get; set; }
public CUETrackMetadata()
{
Artist = "";
Title = "";
ISRC = "";
}
}
}

View File

@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.IO;
using CUETools.CDImage;
namespace CUETools.Processor
{
public class FileGroupInfo
{
public List<FileSystemInfo> files;
public Dictionary<FileSystemInfo, uint> numbers;
public Dictionary<FileSystemInfo, TimeSpan> durations;
public FileSystemInfo main;
public FileGroupInfoType type;
public CDImageLayout TOC;
public uint discNo;
public string album;
public override string ToString()
{
switch (type)
{
case FileGroupInfoType.TrackFiles:
return (album == null ? main.Name :
album + (discNo > 0 ? string.Format(" (disc {0})", discNo) : "")) + ": " + files.Count.ToString() + " files";
}
return main.Name;
}
public FileGroupInfo(FileSystemInfo _main, FileGroupInfoType _type)
{
main = _main;
type = _type;
files = new List<FileSystemInfo>();
numbers = new Dictionary<FileSystemInfo, uint>();
}
public static long IntPrefix(ref string a)
{
long na = 0;
string sa = a;
sa = sa.TrimStart(' ', '_');
if (!(sa.Length > 0 && sa[0] >= '0' && sa[0] <= '9'))
return -1;
while (sa.Length > 0 && sa[0] >= '0' && sa[0] <= '9')
{
na = 10 * na + (sa[0] - '0');
sa = sa.Substring(1);
}
a = sa.TrimStart(' ', '_');
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)
{
while (a.Length > 0 && b.Length > 0 && a[0] == b[0])
{
a = a.Substring(1);
b = b.Substring(1);
}
long na = IntPrefix(ref a);
long nb = IntPrefix(ref b);
if (na != nb)
return Comparer<long>.Default.Compare(na, nb);
if (na < 0)
return Comparer<string>.Default.Compare(a, b);
return CompareTrackNames(a, b);
}
public bool Contains(string pathIn)
{
if (type != FileGroupInfoType.TrackFiles)
return main.FullName.ToLower() == pathIn.ToLower();
return null != files.Find(file => file.FullName.ToLower() == pathIn.ToLower());
}
}
}

View File

@@ -0,0 +1,12 @@
namespace CUETools.Processor
{
public enum FileGroupInfoType
{
Folder,
Archive,
CUESheetFile,
M3UFile,
FileWithCUE,
TrackFiles
}
}

View File

@@ -0,0 +1,498 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Text;
namespace CUETools.Processor
{
public static class General
{
public static string GetCUELine(List<CUELine> list, string command)
{
var line = General.FindCUELine(list, command);
return (line == null || line.Params.Count < 2) ? String.Empty : line.Params[1];
}
public static string GetCUELine(List<CUELine> list, string command, string command2)
{
var line = General.FindCUELine(list, command, command2);
return (line == null || line.Params.Count < 3) ? String.Empty : line.Params[2];
}
public static CUELine FindCUELine(List<CUELine> list, string command)
{
command = command.ToUpper();
foreach (CUELine line in list)
{
if (line.Params[0].ToUpper() == command)
{
return line;
}
}
return null;
}
public static CUELine FindCUELine(List<CUELine> list, string command, string command2)
{
command = command.ToUpper();
command2 = command2.ToUpper();
foreach (CUELine line in list)
{
if (line.Params.Count > 1 && line.Params[0].ToUpper() == command && line.Params[1].ToUpper() == command2)
{
return line;
}
}
return null;
}
//public static CUELine FindCUELine(List<CUELine> list, string [] commands)
//{
// foreach (CUELine line in list)
// {
// if (line.Params.Count < commands.Length)
// continue;
// for (int i = 0; i < commands.Length; i++)
// {
// if (line.Params[i].ToUpper() != commands[i].ToUpper())
// break;
// if (i == commands.Length - 1)
// return line;
// }
// }
// return null;
//}
public static void SetCUELine(List<CUELine> list, string command, string value, bool quoted)
{
if (value == "")
{
General.DelCUELine(list, command);
return;
}
CUELine line = General.FindCUELine(list, command);
if (line == null)
{
line = new CUELine();
line.Params.Add(command); line.IsQuoted.Add(false);
line.Params.Add(value); line.IsQuoted.Add(quoted);
list.Add(line);
}
else
{
while (line.Params.Count > 1)
{
line.Params.RemoveAt(1);
line.IsQuoted.RemoveAt(1);
}
line.Params.Add(value); line.IsQuoted.Add(quoted);
}
}
public static void SetCUELine(List<CUELine> list, string command, string command2, string value, bool quoted)
{
if (value == "")
{
General.DelCUELine(list, command, command2);
return;
}
CUELine line = General.FindCUELine(list, command, command2);
if (line == null)
{
line = new CUELine();
line.Params.Add(command); line.IsQuoted.Add(false);
line.Params.Add(command2); line.IsQuoted.Add(false);
line.Params.Add(value); line.IsQuoted.Add(quoted);
list.Add(line);
}
else
{
while (line.Params.Count > 2)
{
line.Params.RemoveAt(2);
line.IsQuoted.RemoveAt(2);
}
line.Params.Add(value); line.IsQuoted.Add(quoted);
}
}
public static void DelCUELine(List<CUELine> list, string command, string command2)
{
CUELine line = General.FindCUELine(list, command, command2);
if (line == null)
return;
list.Remove(line);
}
public static void DelCUELine(List<CUELine> list, string command)
{
CUELine line = General.FindCUELine(list, command);
if (line == null)
return;
list.Remove(line);
}
class TitleFormatFunctionInfo
{
public string func;
public List<int> positions;
public List<bool> found;
public TitleFormatFunctionInfo(string _func, int position)
{
func = _func;
positions = new List<int>();
found = new List<bool>();
NextArg(position);
}
public void Found()
{
found[found.Count - 1] = true;
}
public void NextArg(int position)
{
positions.Add(position);
found.Add(false);
}
public string GetArg(StringBuilder sb, int no)
{
return sb.ToString().Substring(positions[no],
((no == positions.Count - 1) ? sb.Length : positions[no + 1]) - positions[no]);
}
public int GetIntArg(StringBuilder sb, int no)
{
int res;
return int.TryParse(GetArg(sb, no), out res) ? res : 0;
}
void Returns(StringBuilder sb, string res)
{
sb.Length = positions[0];
sb.Append(res);
}
public bool Finalise(StringBuilder sb)
{
switch (func)
{
case "[":
if (positions.Count != 1)
return false;
if (!found[0])
sb.Length = positions[0];
return true;
case "if":
if (positions.Count != 3)
return false;
Returns(sb, GetArg(sb, found[0] ? 1 : 2));
return true;
case "if2":
if (positions.Count != 2)
return false;
Returns(sb, GetArg(sb, found[0] ? 0 : 1));
return true;
case "if3":
if (positions.Count < 1)
return false;
for (int argno = 0; argno < positions.Count; argno++)
if (found[argno] || argno == positions.Count - 1)
{
Returns(sb, GetArg(sb, argno));
return true;
}
return false;
case "ifgreater":
if (positions.Count != 4)
return false;
Returns(sb, GetArg(sb, (GetIntArg(sb, 0) > GetIntArg(sb, 1)) ? 2 : 3));
return true;
case "iflonger":
if (positions.Count != 4)
return false;
Returns(sb, GetArg(sb, (GetArg(sb, 0).Length > GetIntArg(sb, 1)) ? 2 : 3));
return true;
case "ifequal":
if (positions.Count != 4)
return false;
Returns(sb, GetArg(sb, (GetIntArg(sb, 0) == GetIntArg(sb, 1)) ? 2 : 3));
return true;
case "len":
if (positions.Count != 1)
return false;
Returns(sb, GetArg(sb, 0).Length.ToString());
return true;
case "max":
if (positions.Count != 2)
return false;
Returns(sb, Math.Max(GetIntArg(sb, 0), GetIntArg(sb, 1)).ToString());
return true;
case "directory":
if (positions.Count != 1 && positions.Count != 2 && positions.Count != 3)
return false;
try
{
int arg3 = positions.Count > 1 ? GetIntArg(sb, 1) : 1;
int arg2 = positions.Count > 2 ? GetIntArg(sb, 2) : arg3;
Returns(sb, General.GetDirectoryElements(Path.GetDirectoryName(GetArg(sb, 0)), -arg2, -arg3));
}
catch { return false; }
return true;
case "directory_path":
if (positions.Count != 1)
return false;
try { Returns(sb, Path.GetDirectoryName(GetArg(sb, 0))); }
catch { return false; }
return true;
case "ext":
if (positions.Count != 1)
return false;
try { Returns(sb, Path.GetExtension(GetArg(sb, 0))); }
catch { return false; }
return true;
case "filename":
if (positions.Count != 1)
return false;
try { Returns(sb, Path.GetFileNameWithoutExtension(GetArg(sb, 0))); }
catch { return false; }
return true;
}
return false;
}
}
public static string GetDirectoryElements(string dir, int first, int last)
{
if (dir == null)
return "";
string[] dirSplit = dir.Split(Path.DirectorySeparatorChar,
Path.AltDirectorySeparatorChar);
int count = dirSplit.Length;
if ((first == 0) && (last == 0))
{
first = 1;
last = count;
}
if (first < 0) first = (count + 1) + first;
if (last < 0) last = (count + 1) + last;
if ((first < 1) && (last < 1))
{
return String.Empty;
}
else if ((first > count) && (last > count))
{
return String.Empty;
}
else
{
int i;
StringBuilder sb = new StringBuilder();
if (first < 1) first = 1;
if (first > count) first = count;
if (last < 1) last = 1;
if (last > count) last = count;
if (last >= first)
{
for (i = first; i <= last; i++)
{
sb.Append(dirSplit[i - 1]);
sb.Append(Path.DirectorySeparatorChar);
}
}
else
{
for (i = first; i >= last; i--)
{
sb.Append(dirSplit[i - 1]);
sb.Append(Path.DirectorySeparatorChar);
}
}
return sb.ToString(0, sb.Length - 1);
}
}
public static string ReplaceMultiple(string s, NameValueCollection tags, int maxLen)
{
List<string> find = new List<string>();
List<string> replace = new List<string>();
foreach (string tag in tags.AllKeys)
{
string key = '%' + tag.ToLower() + '%';
string val = tags[tag];
if (!find.Contains(key) && val != null && val != "")
{
find.Add(key);
replace.Add(val);
}
}
return ReplaceMultiple(s, find, replace, maxLen);
}
public delegate bool CheckIfExists(string output);
public static string ReplaceMultiple(string fmt, NameValueCollection tags, string unique_key, CheckIfExists exists, int maxLen)
{
string result = ReplaceMultiple(fmt, tags, maxLen);
if (result == String.Empty || result == null)
return result;
int unique = 1;
try
{
while (exists(result))
{
tags[unique_key] = unique.ToString();
string new_result = ReplaceMultiple(fmt, tags, maxLen);
if (new_result == result || new_result == String.Empty || new_result == null)
break;
result = new_result;
unique++;
}
}
catch { }
return result;
}
public static string Shorten(string f, string s, int maxLen)
{
return maxLen <= 0 || maxLen >= s.Length || f == "music" || f == "path" || f == "filename" || f == "filename_ext" || f == "directoryname" ?
s : s.Substring(0, maxLen);
}
public static string ReplaceMultiple(string s, List<string> find, List<string> replace, int maxLen)
{
if (find.Count != replace.Count)
{
throw new ArgumentException();
}
StringBuilder sb;
int iChar, iFind;
string f;
bool found;
List<TitleFormatFunctionInfo> formatFunctions = new List<TitleFormatFunctionInfo>();
bool quote = false;
sb = new StringBuilder();
for (iChar = 0; iChar < s.Length; iChar++)
{
found = false;
if (quote)
{
if (s[iChar] == '\'')
{
if (iChar > 0 && s[iChar - 1] == '\'')
sb.Append(s[iChar]);
quote = false;
continue;
}
sb.Append(s[iChar]);
continue;
}
if (s[iChar] == '\'')
{
quote = true;
continue;
}
if (s[iChar] == '[')
{
formatFunctions.Add(new TitleFormatFunctionInfo("[", sb.Length));
continue;
}
if (s[iChar] == '$')
{
int funcEnd = s.IndexOf('(', iChar + 1);
if (funcEnd < 0)
return null;
formatFunctions.Add(new TitleFormatFunctionInfo(s.Substring(iChar + 1, funcEnd - iChar - 1), sb.Length));
iChar = funcEnd;
continue;
}
if (s[iChar] == ',')
{
if (formatFunctions.Count < 1)
return null;
formatFunctions[formatFunctions.Count - 1].NextArg(sb.Length);
continue;
}
if (s[iChar] == ']')
{
if (formatFunctions.Count < 1 ||
formatFunctions[formatFunctions.Count - 1].func != "["
|| !formatFunctions[formatFunctions.Count - 1].Finalise(sb))
return null;
formatFunctions.RemoveAt(formatFunctions.Count - 1);
continue;
}
if (s[iChar] == ')')
{
if (formatFunctions.Count < 1 ||
formatFunctions[formatFunctions.Count - 1].func == "["
|| !formatFunctions[formatFunctions.Count - 1].Finalise(sb))
return null;
formatFunctions.RemoveAt(formatFunctions.Count - 1);
continue;
}
for (iFind = 0; iFind < find.Count; iFind++)
{
f = find[iFind];
if ((f.Length <= (s.Length - iChar)) && (s.Substring(iChar, f.Length) == f))
{
if (formatFunctions.Count > 0)
{
if (replace[iFind] != null)
{
formatFunctions[formatFunctions.Count - 1].Found();
sb.Append(Shorten(f, replace[iFind], maxLen));
}
}
else
{
if (replace[iFind] != null)
sb.Append(Shorten(f, replace[iFind], maxLen));
else
return null;
}
iChar += f.Length - 1;
found = true;
break;
}
}
if (!found)
{
sb.Append(s[iChar]);
}
}
return sb.ToString();
}
public static string EmptyStringToNull(string s)
{
return ((s != null) && (s.Length == 0)) ? null : s;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace CUETools.Processor
{
struct IndexInfo
{
public int Track;
public int Index;
public int Time;
}
}

View File

@@ -0,0 +1,17 @@
CUE Tools
Copyright (C) 2006-2007 Moitah (moitah@yahoo.com)
Copyright (C) 2008-2010 Gregory S. Chudov (gchudov@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

File diff suppressed because it is too large Load Diff

View File

@@ -1,198 +0,0 @@
// ****************************************************************************
//
// CUE Tools
// Copyright (C) 2006-2007 Moitah (moitah@yahoo.com)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// ****************************************************************************
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace CUETools.Processor
{
static class SettingsShared
{
public static string GetMyAppDataDir(string appName) {
string appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string myAppDataDir = Path.Combine(appDataDir, appName);
if (Directory.Exists(myAppDataDir) == false) {
Directory.CreateDirectory(myAppDataDir);
}
return myAppDataDir;
}
public static string GetProfileDir(string appName, string appPath)
{
bool userProfilesEnabled = (appPath == null || File.Exists(Path.Combine(Path.GetDirectoryName(appPath), "user_profiles_enabled")));
string appDataDir = userProfilesEnabled ?
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) :
Path.GetDirectoryName(appPath);
string myAppDataDir = Path.Combine(appDataDir, appName);
if (!Directory.Exists(myAppDataDir))
Directory.CreateDirectory(myAppDataDir);
return myAppDataDir;
}
}
public class SettingsReader {
Dictionary<string, string> _settings;
string profilePath;
public string ProfilePath
{
get
{
return profilePath;
}
}
public SettingsReader(string appName, string fileName, string appPath) {
_settings = new Dictionary<string, string>();
profilePath = SettingsShared.GetProfileDir(appName, appPath);
string path = Path.Combine(profilePath, fileName);
if (!File.Exists(path))
return;
using (StreamReader sr = new StreamReader(path, Encoding.UTF8)) {
string line, name = null, val;
int pos;
while ((line = sr.ReadLine()) != null) {
pos = line.IndexOf('=');
if (pos != -1) {
if (pos > 0)
{
name = line.Substring(0, pos);
val = line.Substring(pos + 1);
if (!_settings.ContainsKey(name))
_settings.Add(name, val);
}
else
{
val = line.Substring(pos + 1);
if (_settings.ContainsKey(name))
_settings[name] += "\r\n" + val;
}
}
}
}
}
public string Load(string name) {
return _settings.ContainsKey(name) ? _settings[name] : null;
}
public bool? LoadBoolean(string name) {
string val = Load(name);
if (val == "0") return false;
if (val == "1") return true;
return null;
}
public int? LoadInt32(string name, int? min, int? max) {
int val;
if (!Int32.TryParse(Load(name), out val)) return null;
if (min.HasValue && (val < min.Value)) return null;
if (max.HasValue && (val > max.Value)) return null;
return val;
}
public uint? LoadUInt32(string name, uint? min, uint? max) {
uint val;
if (!UInt32.TryParse(Load(name), out val)) return null;
if (min.HasValue && (val < min.Value)) return null;
if (max.HasValue && (val > max.Value)) return null;
return val;
}
public long? LoadLong(string name, long? min, long? max)
{
long val;
if (!long.TryParse(Load(name), out val)) return null;
if (min.HasValue && (val < min.Value)) return null;
if (max.HasValue && (val > max.Value)) return null;
return val;
}
public DateTime? LoadDate(string name)
{
long? val = LoadLong(name, null, null);
if (!val.HasValue) return null;
return DateTime.FromBinary(val.Value);
}
}
public class SettingsWriter {
StreamWriter _sw;
public SettingsWriter(string appName, string fileName, string appPath)
{
string path = Path.Combine(SettingsShared.GetProfileDir(appName, appPath), fileName);
_sw = new StreamWriter(path, false, Encoding.UTF8);
}
public void Save(string name, string value) {
_sw.WriteLine(name + "=" + value);
}
public void SaveText(string name, string value)
{
_sw.Write(name);
if (value == "")
{
_sw.WriteLine("=");
return;
}
using (StringReader sr = new StringReader(value))
{
string lineStr;
while ((lineStr = sr.ReadLine()) != null)
_sw.WriteLine("=" + lineStr);
}
}
public void Save(string name, bool value) {
Save(name, value ? "1" : "0");
}
public void Save(string name, int value) {
Save(name, value.ToString());
}
public void Save(string name, uint value) {
Save(name, value.ToString());
}
public void Save(string name, long value)
{
Save(name, value.ToString());
}
public void Save(string name, DateTime value)
{
Save(name, value.ToBinary());
}
public void Close() {
_sw.Close();
}
}
}

View File

@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace CUETools.Processor.Settings
{
public class SettingsReader
{
Dictionary<string, string> _settings;
string profilePath;
public string ProfilePath
{
get
{
return profilePath;
}
}
public SettingsReader(string appName, string fileName, string appPath)
{
_settings = new Dictionary<string, string>();
profilePath = SettingsShared.GetProfileDir(appName, appPath);
string path = Path.Combine(profilePath, fileName);
if (!File.Exists(path))
return;
using (StreamReader sr = new StreamReader(path, Encoding.UTF8))
{
string line, name = null, val;
int pos;
while ((line = sr.ReadLine()) != null)
{
pos = line.IndexOf('=');
if (pos != -1)
{
if (pos > 0)
{
name = line.Substring(0, pos);
val = line.Substring(pos + 1);
if (!_settings.ContainsKey(name))
_settings.Add(name, val);
}
else
{
val = line.Substring(pos + 1);
if (_settings.ContainsKey(name))
_settings[name] += "\r\n" + val;
}
}
}
}
}
public string Load(string name)
{
return _settings.ContainsKey(name) ? _settings[name] : null;
}
public bool? LoadBoolean(string name)
{
string val = Load(name);
if (val == "0") return false;
if (val == "1") return true;
return null;
}
public int? LoadInt32(string name, int? min, int? max)
{
int val;
if (!Int32.TryParse(Load(name), out val)) return null;
if (min.HasValue && (val < min.Value)) return null;
if (max.HasValue && (val > max.Value)) return null;
return val;
}
public uint? LoadUInt32(string name, uint? min, uint? max)
{
uint val;
if (!UInt32.TryParse(Load(name), out val)) return null;
if (min.HasValue && (val < min.Value)) return null;
if (max.HasValue && (val > max.Value)) return null;
return val;
}
public long? LoadLong(string name, long? min, long? max)
{
long val;
if (!long.TryParse(Load(name), out val)) return null;
if (min.HasValue && (val < min.Value)) return null;
if (max.HasValue && (val > max.Value)) return null;
return val;
}
public DateTime? LoadDate(string name)
{
long? val = LoadLong(name, null, null);
if (!val.HasValue) return null;
return DateTime.FromBinary(val.Value);
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.IO;
namespace CUETools.Processor.Settings
{
static class SettingsShared
{
public static string GetMyAppDataDir(string appName)
{
string appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string myAppDataDir = Path.Combine(appDataDir, appName);
if (Directory.Exists(myAppDataDir) == false)
{
Directory.CreateDirectory(myAppDataDir);
}
return myAppDataDir;
}
public static string GetProfileDir(string appName, string appPath)
{
bool userProfilesEnabled = (appPath == null || File.Exists(Path.Combine(Path.GetDirectoryName(appPath), "user_profiles_enabled")));
string appDataDir = userProfilesEnabled ?
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) :
Path.GetDirectoryName(appPath);
string myAppDataDir = Path.Combine(appDataDir, appName);
if (!Directory.Exists(myAppDataDir))
Directory.CreateDirectory(myAppDataDir);
return myAppDataDir;
}
}
}

View File

@@ -0,0 +1,68 @@
using System;
using System.IO;
using System.Text;
namespace CUETools.Processor.Settings
{
public class SettingsWriter
{
StreamWriter _sw;
public SettingsWriter(string appName, string fileName, string appPath)
{
string path = Path.Combine(SettingsShared.GetProfileDir(appName, appPath), fileName);
_sw = new StreamWriter(path, false, Encoding.UTF8);
}
public void Save(string name, string value)
{
_sw.WriteLine(name + "=" + value);
}
public void SaveText(string name, string value)
{
_sw.Write(name);
if (value == "")
{
_sw.WriteLine("=");
return;
}
using (StringReader sr = new StringReader(value))
{
string lineStr;
while ((lineStr = sr.ReadLine()) != null)
_sw.WriteLine("=" + lineStr);
}
}
public void Save(string name, bool value)
{
Save(name, value ? "1" : "0");
}
public void Save(string name, int value)
{
Save(name, value.ToString());
}
public void Save(string name, uint value)
{
Save(name, value.ToString());
}
public void Save(string name, long value)
{
Save(name, value.ToString());
}
public void Save(string name, DateTime value)
{
Save(name, value.ToBinary());
}
public void Close()
{
_sw.Close();
}
}
}

View File

@@ -0,0 +1,9 @@
namespace CUETools.Processor
{
struct SourceInfo
{
public string Path;
public uint Offset;
public uint Length;
}
}

View File

@@ -0,0 +1,12 @@
using System;
namespace CUETools.Processor
{
public class StopException : Exception
{
public StopException()
: base()
{
}
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace CUETools.Processor
{
public class TrackInfo
{
private List<CUELine> _attributes;
public TagLib.File _fileInfo;
public List<CUELine> Attributes
{
get
{
return _attributes;
}
}
public TrackInfo()
{
_attributes = new List<CUELine>();
_fileInfo = null;
}
}
}

View File

@@ -1,15 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using System.Text;
using CUETools.Processor;
using System.Threading;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Runtime.Remoting; using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Ipc; using System.Runtime.Remoting.Channels.Ipc;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using CUETools.Processor;
using CUETools.Processor.Settings;
namespace JDP { namespace JDP
{
static class Program { static class Program {
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)

View File

@@ -1,15 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.ComponentModel; using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Diagnostics; using System.Windows.Forms;
using CUETools.Compression; using CUETools.Compression;
using CUETools.Processor; using CUETools.Processor;
using CUETools.Processor.Settings;
namespace JDP namespace JDP
{ {

View File

@@ -18,31 +18,31 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// **************************************************************************** // ****************************************************************************
// **************************************************************************** // ****************************************************************************
// Access to AccurateRip is regulated, see // Access to AccurateRip is regulated, see
// http://www.accuraterip.com/3rdparty-access.htm for details. // http://www.accuraterip.com/3rdparty-access.htm for details.
// **************************************************************************** // ****************************************************************************
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Text; using System.Globalization;
using System.Windows.Forms;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Globalization; using System.Text;
using System.Threading; using System.Threading;
using System.Diagnostics; using System.Windows.Forms;
using CUETools.Processor;
using CUETools.CDImage;
using CUETools.Compression;
using CUETools.AccurateRip; using CUETools.AccurateRip;
using CUETools.CDImage;
using CUETools.CTDB; using CUETools.CTDB;
using CUETools.Compression;
using CUETools.Processor;
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");