From f6138ce9ccde7799613f746e308396ad00343639 Mon Sep 17 00:00:00 2001 From: chudov Date: Sun, 19 Oct 2008 11:20:48 +0000 Subject: [PATCH] Input browse & batch buttons start browsing at the current input location MacLib no longer opens the file for writing when decoding --- APEDotNet/APEDotNet.vcproj | 1 + CUETools/frmCUETools.Designer.cs | 18 +- CUETools/frmCUETools.cs | 12 + CUETools/frmCUETools.resx | 542 +++++--------------- CUEToolsLib/Main.cs | 8 +- MAC_SDK/Source/MACLib/APEInfo.cpp | 4 +- MAC_SDK/Source/MACLib/APEInfo.h | 2 +- MAC_SDK/Source/MACLib/Assembly/Assembly.obj | Bin 836 -> 836 bytes MAC_SDK/Source/MACLib/MACLib.cpp | 2 +- MAC_SDK/Source/MACLib/MACLib.vcproj | 6 +- MAC_SDK/Source/Shared/IO.h | 2 +- MAC_SDK/Source/Shared/WinFileIO.cpp | 6 +- MAC_SDK/Source/Shared/WinFileIO.h | 2 +- 13 files changed, 170 insertions(+), 435 deletions(-) diff --git a/APEDotNet/APEDotNet.vcproj b/APEDotNet/APEDotNet.vcproj index ca5d499..f474f1a 100644 --- a/APEDotNet/APEDotNet.vcproj +++ b/APEDotNet/APEDotNet.vcproj @@ -48,6 +48,7 @@ PreprocessorDefinitions="WIN32;_DEBUG" RuntimeLibrary="3" UsePrecompiledHeader="0" + BrowseInformation="1" WarningLevel="3" DebugInformationFormat="3" /> diff --git a/CUETools/frmCUETools.Designer.cs b/CUETools/frmCUETools.Designer.cs index 56f6ba8..77afebe 100644 --- a/CUETools/frmCUETools.Designer.cs +++ b/CUETools/frmCUETools.Designer.cs @@ -49,6 +49,7 @@ namespace JDP { this.rbAppendFilename = new System.Windows.Forms.RadioButton(); this.txtAppendFilename = new System.Windows.Forms.TextBox(); this.grpAudioOutput = new System.Windows.Forms.GroupBox(); + this.rbAPE = new System.Windows.Forms.RadioButton(); this.rbNoAudio = new System.Windows.Forms.RadioButton(); this.rbWavPack = new System.Windows.Forms.RadioButton(); this.rbFLAC = new System.Windows.Forms.RadioButton(); @@ -68,7 +69,6 @@ namespace JDP { this.toolStripProgressBar2 = new System.Windows.Forms.ToolStripProgressBar(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.btnCUECreator = new System.Windows.Forms.Button(); - this.rbAPE = new System.Windows.Forms.RadioButton(); this.grpCUEPaths.SuspendLayout(); this.grpOutputStyle.SuspendLayout(); this.grpOutputPathGeneration.SuspendLayout(); @@ -266,6 +266,14 @@ namespace JDP { this.grpAudioOutput.Name = "grpAudioOutput"; this.grpAudioOutput.TabStop = false; // + // rbAPE + // + resources.ApplyResources(this.rbAPE, "rbAPE"); + this.rbAPE.Name = "rbAPE"; + this.rbAPE.TabStop = true; + this.rbAPE.UseVisualStyleBackColor = true; + this.rbAPE.CheckedChanged += new System.EventHandler(this.rbAPE_CheckedChanged); + // // rbNoAudio // resources.ApplyResources(this.rbNoAudio, "rbNoAudio"); @@ -411,14 +419,6 @@ namespace JDP { this.btnCUECreator.UseVisualStyleBackColor = true; this.btnCUECreator.Click += new System.EventHandler(this.btnCUECreator_Click); // - // rbAPE - // - resources.ApplyResources(this.rbAPE, "rbAPE"); - this.rbAPE.Name = "rbAPE"; - this.rbAPE.TabStop = true; - this.rbAPE.UseVisualStyleBackColor = true; - this.rbAPE.CheckedChanged += new System.EventHandler(this.rbAPE_CheckedChanged); - // // frmCUETools // resources.ApplyResources(this, "$this"); diff --git a/CUETools/frmCUETools.cs b/CUETools/frmCUETools.cs index fc2b5cc..6c62d3c 100644 --- a/CUETools/frmCUETools.cs +++ b/CUETools/frmCUETools.cs @@ -48,6 +48,12 @@ namespace JDP { fileDlg.Title = "Input CUE Sheet or album image"; fileDlg.Filter = "CUE Sheets (*.cue)|*.cue|FLAC images (*.flac)|*.flac|WavPack images (*.wv)|*.wv|APE images (*.ape)|*.ape"; + try + { + if (Directory.Exists (Path.GetDirectoryName (txtInputPath.Text))) + fileDlg.InitialDirectory = Path.GetDirectoryName (txtInputPath.Text); + } + catch { } dlgRes = fileDlg.ShowDialog(); if (dlgRes == DialogResult.OK) { txtInputPath.Text = fileDlg.FileName; @@ -86,6 +92,12 @@ namespace JDP { FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.Description = "Select the folder containing the CUE sheets you want to convert. Subfolders will be included automatically."; folderDialog.ShowNewFolderButton = false; + try + { + if (Directory.Exists(Path.GetDirectoryName(txtInputPath.Text))) + folderDialog.SelectedPath = Path.GetDirectoryName(txtInputPath.Text); + } + catch { } if (folderDialog.ShowDialog() == DialogResult.OK) { if (!CheckWriteOffset()) return; AddDirToBatch(folderDialog.SelectedPath); diff --git a/CUETools/frmCUETools.resx b/CUETools/frmCUETools.resx index 3a357f9..497f2a8 100644 --- a/CUETools/frmCUETools.resx +++ b/CUETools/frmCUETools.resx @@ -143,102 +143,6 @@ 11 - - btnBrowseOutput - - - System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCUEPaths - - - 0 - - - btnBrowseInput - - - System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCUEPaths - - - 1 - - - lblOutput - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCUEPaths - - - 2 - - - lblInput - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCUEPaths - - - 3 - - - txtOutputPath - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCUEPaths - - - 4 - - - txtInputPath - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCUEPaths - - - 5 - - - 12, 2 - - - 534, 84 - - - 0 - - - CUE Paths - - - grpCUEPaths - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 10 - 461, 49 @@ -342,10 +246,10 @@ 3 - 51, 48 + 59, 48 - 404, 21 + 396, 21 4 @@ -363,10 +267,10 @@ 4 - 51, 22 + 59, 22 - 404, 21 + 396, 21 1 @@ -383,6 +287,30 @@ 5 + + 12, 2 + + + 534, 84 + + + 0 + + + CUE Paths + + + grpCUEPaths + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 10 + True @@ -588,114 +516,6 @@ 8 - - txtCustomFormat - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpOutputPathGeneration - - - 0 - - - rbCustomFormat - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpOutputPathGeneration - - - 1 - - - txtCreateSubdirectory - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpOutputPathGeneration - - - 2 - - - rbDontGenerate - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpOutputPathGeneration - - - 3 - - - rbCreateSubdirectory - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpOutputPathGeneration - - - 4 - - - rbAppendFilename - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpOutputPathGeneration - - - 5 - - - txtAppendFilename - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpOutputPathGeneration - - - 6 - - - 12, 92 - - - 328, 113 - - - 1 - - - Output Path - - - grpOutputPathGeneration - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 7 - 144, 62 @@ -876,6 +696,45 @@ 6 + + 12, 92 + + + 328, 113 + + + 1 + + + Output Path + + + grpOutputPathGeneration + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + + + True + + + 11, 51 + + + 44, 17 + + + 7 + + + APE + rbAPE @@ -888,78 +747,6 @@ 0 - - rbNoAudio - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAudioOutput - - - 1 - - - rbWavPack - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAudioOutput - - - 2 - - - rbFLAC - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAudioOutput - - - 3 - - - rbWAV - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAudioOutput - - - 4 - - - 12, 211 - - - 96, 118 - - - 2 - - - Audio Output - - - grpAudioOutput - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 6 - True @@ -1071,6 +858,30 @@ 4 + + 12, 211 + + + 96, 118 + + + 2 + + + Audio Output + + + grpAudioOutput + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + 410, 259 @@ -1143,90 +954,6 @@ 3 - - label1 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAccurateRip - - - 0 - - - txtDataTrackLength - - - System.Windows.Forms.MaskedTextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAccurateRip - - - 1 - - - rbArApplyOffset - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAccurateRip - - - 2 - - - rbArVerify - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAccurateRip - - - 3 - - - rbArNone - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAccurateRip - - - 4 - - - 238, 211 - - - 144, 118 - - - 11 - - - AccurateRip - - - grpAccurateRip - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - True @@ -1374,9 +1101,51 @@ 4 + + 238, 211 + + + 144, 118 + + + 11 + + + AccurateRip + + + grpAccurateRip + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + 0, 339 + + 254, 17 + + + MiddleLeft + + + 140, 16 + + + Track progress + + + 140, 16 + + + Disk progress + 0, 339 @@ -1401,24 +1170,6 @@ 1 - - 254, 17 - - - MiddleLeft - - - 140, 16 - - - Track progress - - - 140, 16 - - - Disk progress - NoControl @@ -1446,33 +1197,6 @@ 0 - - True - - - 11, 51 - - - 44, 17 - - - 7 - - - APE - - - rbAPE - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAudioOutput - - - 0 - True diff --git a/CUEToolsLib/Main.cs b/CUEToolsLib/Main.cs index a0be8a5..a2b53a8 100644 --- a/CUEToolsLib/Main.cs +++ b/CUEToolsLib/Main.cs @@ -221,18 +221,18 @@ namespace CUEToolsLib public CUEConfig() { - fixWhenConfidence = 1; + fixWhenConfidence = 2; fixWhenPercent = 51; - encodeWhenConfidence = 1; + encodeWhenConfidence = 2; encodeWhenPercent = 100; - fixOffset = true; + fixOffset = false; noUnverifiedOutput = false; writeArTags = true; writeArLog = true; autoCorrectFilenames = true; flacVerify = false; - flacCompressionLevel = 5; + flacCompressionLevel = 8; preserveHTOA = false; wvCompressionMode = 1; wvExtraMode = 0; diff --git a/MAC_SDK/Source/MACLib/APEInfo.cpp b/MAC_SDK/Source/MACLib/APEInfo.cpp index ce3b4e9..7e01b69 100644 --- a/MAC_SDK/Source/MACLib/APEInfo.cpp +++ b/MAC_SDK/Source/MACLib/APEInfo.cpp @@ -11,7 +11,7 @@ CAPEInfo: /***************************************************************************************** Construction *****************************************************************************************/ -CAPEInfo::CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag) +CAPEInfo::CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag, bool fReadOnly) { *pErrorCode = ERROR_SUCCESS; CloseFile(); @@ -19,7 +19,7 @@ CAPEInfo::CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag) // open the file m_spIO.Assign(new IO_CLASS_NAME); - if (m_spIO->Open(pFilename) != 0) + if (m_spIO->Open(pFilename, fReadOnly) != 0) { CloseFile(); *pErrorCode = ERROR_INVALID_INPUT_FILE; diff --git a/MAC_SDK/Source/MACLib/APEInfo.h b/MAC_SDK/Source/MACLib/APEInfo.h index 49e5c2f..07115fa 100644 --- a/MAC_SDK/Source/MACLib/APEInfo.h +++ b/MAC_SDK/Source/MACLib/APEInfo.h @@ -77,7 +77,7 @@ class CAPEInfo public: // construction and destruction - CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag = NULL); + CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag = NULL, bool fReadOnly = 0); CAPEInfo(int * pErrorCode, CIO * pIO, CAPETag * pTag = NULL); virtual ~CAPEInfo(); diff --git a/MAC_SDK/Source/MACLib/Assembly/Assembly.obj b/MAC_SDK/Source/MACLib/Assembly/Assembly.obj index 53479934e05055a14d69f01ef172c8d2f855e505..2d336e619c57a20444ffd245cd07471654bd6f9d 100644 GIT binary patch delta 16 XcmX@Yc7%=HhmnzC(ve>q*=?BtEGY#t delta 16 XcmX@Yc7%=Hhmnzi_xX>F?6%ARDNY2= diff --git a/MAC_SDK/Source/MACLib/MACLib.cpp b/MAC_SDK/Source/MACLib/MACLib.cpp index 19a5acb..600ba6a 100644 --- a/MAC_SDK/Source/MACLib/MACLib.cpp +++ b/MAC_SDK/Source/MACLib/MACLib.cpp @@ -75,7 +75,7 @@ IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int else if ((wcsicmp(pExtension, L".mac") == 0) || (wcsicmp(pExtension, L".ape") == 0)) { // plain .ape file - pAPEInfo = new CAPEInfo(&nErrorCode, pFilename); + pAPEInfo = new CAPEInfo(&nErrorCode, pFilename, NULL, 1); } // fail if we couldn't get the file information diff --git a/MAC_SDK/Source/MACLib/MACLib.vcproj b/MAC_SDK/Source/MACLib/MACLib.vcproj index 2c90e99..029ebc0 100644 --- a/MAC_SDK/Source/MACLib/MACLib.vcproj +++ b/MAC_SDK/Source/MACLib/MACLib.vcproj @@ -49,10 +49,10 @@ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE" BasicRuntimeChecks="3" RuntimeLibrary="3" - PrecompiledHeaderFile=".\Debug/MACLib.pch" AssemblerListingLocation=".\Debug/" ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" + BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="true" DebugInformationFormat="4" @@ -139,7 +139,6 @@ /> spName(GetANSIFromUTF16(pName), TRUE); #endif - m_hFile = ::CreateFile(spName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + m_hFile = INVALID_HANDLE_VALUE; + if (!fReadonly) + m_hFile = ::CreateFile(spName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (m_hFile == INVALID_HANDLE_VALUE) { m_hFile = ::CreateFile(spName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); diff --git a/MAC_SDK/Source/Shared/WinFileIO.h b/MAC_SDK/Source/Shared/WinFileIO.h index cbe5811..e633dc5 100644 --- a/MAC_SDK/Source/Shared/WinFileIO.h +++ b/MAC_SDK/Source/Shared/WinFileIO.h @@ -14,7 +14,7 @@ public: ~CWinFileIO(); // open / close - int Open(const wchar_t * pName); + int Open(const wchar_t * pName, int fReadonly = 0); int Close(); // read / write