From 6124210ddd99e08de4cf46b38c4591aad02b69e3 Mon Sep 17 00:00:00 2001 From: XyLe-GBP Date: Wed, 9 Nov 2022 22:11:22 +0900 Subject: [PATCH] version 1.27 --- ATRACTool-Reloaded.csproj | 4 +- Program.cs | 5 ++ VERSIONINFO | 2 +- src/Common.cs | 50 ++++++++++++ src/Forms/FormLPC.cs | 12 ++- src/Forms/FormMain.cs | 162 +++++++++++++++++++++++++++----------- 6 files changed, 183 insertions(+), 52 deletions(-) diff --git a/ATRACTool-Reloaded.csproj b/ATRACTool-Reloaded.csproj index 6fdb52a..b8b96c1 100644 --- a/ATRACTool-Reloaded.csproj +++ b/ATRACTool-Reloaded.csproj @@ -7,8 +7,8 @@ enable true enable - 1.26.2220.1027 - 1.26.2220.1027 + 1.27.2220.1109 + 1.27.2220.1109 git XyLe Open source ATRAC conversion utility diff --git a/Program.cs b/Program.cs index 9a77501..6329318 100644 --- a/Program.cs +++ b/Program.cs @@ -47,6 +47,11 @@ static void Main() MessageBox.Show("The required file 'ps4_at9tool.exe' does not exist.\nClose the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } + if (!File.Exists(Directory.GetCurrentDirectory() + @"\res\updater.exe")) + { + MessageBox.Show("The required file 'updater.exe' does not exist.\nClose the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); diff --git a/VERSIONINFO b/VERSIONINFO index d51b1e9..b90aa83 100644 --- a/VERSIONINFO +++ b/VERSIONINFO @@ -1 +1 @@ -version:1.26.2220.1027 \ No newline at end of file +version:1.27.2220.1109 \ No newline at end of file diff --git a/src/Common.cs b/src/Common.cs index 7e3f335..a0359ea 100644 --- a/src/Common.cs +++ b/src/Common.cs @@ -51,6 +51,10 @@ public class Generic public static bool IsWave = false; public static bool IsATRAC = false; /// + /// ファイルをWaveに変換したかどうかを判別するための変数 + /// + public static bool IsATW = false; + /// /// 変換先の形式を判別するための変数 /// public static int WTAFlag = -1; @@ -229,6 +233,52 @@ public static void ShowFolder(string Fullpath, bool Flag = true) } } + /// + /// 該当ファイルが存在する場合は削除 + /// + /// ファイルの場所 + public static void CheckExistsFile(string path) + { + if (File.Exists(path)) + { + File.Delete(path); + return; + } + else + { + return; + } + } + + /// + /// IsATWがtrueならWaveに変換したファイルを削除 + /// + /// Generic.IsATW + public static void ATWCheck(bool flag) + { + switch (flag) + { + case true: + { + foreach (var file in Generic.OpenFilePaths) + { + if (File.Exists(file)) + { + File.Delete(file); + } + + } + break; + } + case false: + { + break; + } + } + Generic.IsATW = false; + return; + } + /// /// 設定ファイルに全てを書き出す /// diff --git a/src/Forms/FormLPC.cs b/src/Forms/FormLPC.cs index a2caa41..5e27c15 100644 --- a/src/Forms/FormLPC.cs +++ b/src/Forms/FormLPC.cs @@ -2,6 +2,7 @@ using ATRACTool_Reloaded.Localizable; using System.Text; using static ATRACTool_Reloaded.Common; +using NAudio.Wave.SampleProviders; namespace ATRACTool_Reloaded { @@ -9,6 +10,7 @@ public partial class FormLPC : Form { private readonly WaveIn wi = new(); private readonly WaveOut wo = new(); + private NotifyingSampleProvider osp = null!; private AudioFileReader reader = null!; long Sample, Start = 0, End = 0; int bytePerSec, position, length, btnpos; @@ -66,7 +68,7 @@ private void FormLPC_Load(object sender, EventArgs e) { reader = new(Common.Generic.OpenFilePaths[0]); FileInfo fi = new(Common.Generic.OpenFilePaths[0]); - label_File.Text = fi.Name; + label_File.Text = fi.Name + "[ " + reader.WaveFormat.BitsPerSample + "-bit, " + reader.WaveFormat.SampleRate + "Hz ]"; button_Prev.Enabled = false; button_Next.Enabled = false; } @@ -194,6 +196,7 @@ private void Playback() { while (wo.PlaybackState != PlaybackState.Stopped) { + position = (int)reader.Position / reader.WaveFormat.AverageBytesPerSecond; time = new(0, 0, position); Sample = reader.Position / reader.WaveFormat.BlockAlign; @@ -218,10 +221,13 @@ private void Button_SetStart_Click(object sender, EventArgs e) private void FormLPC_FormClosed(object sender, FormClosedEventArgs e) { + if (timer_Reload.Enabled == true) timer_Reload.Enabled = false; reader.Position = 0; + wi.Dispose(); + wo.Stop(); wo.Dispose(); reader.Close(); - reader.Dispose(); + reader = null!; } private void Button_Prev_Click(object sender, EventArgs e) @@ -233,6 +239,7 @@ private void Button_Prev_Click(object sender, EventArgs e) wo.Stop(); button_Play.Text = Localization.PlayCaption; reader.Position = 0; + reader.Close(); button_Stop.Enabled = false; if (btnpos == 1) @@ -262,6 +269,7 @@ private void Button_Next_Click(object sender, EventArgs e) wo.Stop(); button_Play.Text = Localization.PlayCaption; reader.Position = 0; + reader.Close(); button_Stop.Enabled = false; if (btnpos == Common.Generic.OpenFilePaths.Length) diff --git a/src/Forms/FormMain.cs b/src/Forms/FormMain.cs index 9a09f00..e554dd7 100644 --- a/src/Forms/FormMain.cs +++ b/src/Forms/FormMain.cs @@ -160,6 +160,8 @@ private void FormMain_Load(object sender, EventArgs e) /// private void OpenFileOToolStripMenuItem_Click(object sender, EventArgs e) { + Utils.ATWCheck(Generic.IsATW); + OpenFileDialog ofd = new() { FileName = "", @@ -320,6 +322,7 @@ private void OpenFileOToolStripMenuItem_Click(object sender, EventArgs e) } else { + ResetStatus(); return; } } @@ -532,6 +535,7 @@ private void Button_Decode_Click(object sender, EventArgs e) { case true: // Œꏊɕۑ { + FileInfo fi = new(Generic.OpenFilePaths[0]); string suffix = ""; switch (bool.Parse(Config.Entry["Save_IsSubfolder"].Value)) { @@ -543,23 +547,21 @@ private void Button_Decode_Click(object sender, EventArgs e) } if (suffix != "") { - if (Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) - { - MessageBox.Show(this, "Folder '" + Config.Entry["Save_Isfolder"].Value + @"\" + suffix + "'is already exists.", Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - } - else + if (!Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) { Directory.CreateDirectory(Config.Entry["Save_Isfolder"].Value + @"\" + suffix); } } - Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + Utils.SFDRandomNumber() + ".wav"; + Utils.CheckExistsFile(Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + fi.Name.Replace(fi.Extension, "") + ".wav"); + Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + fi.Name.Replace(fi.Extension, "") + ".wav"; Generic.ProgressMax = 1; break; } case false: { - Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + Utils.SFDRandomNumber() + ".wav"; + Utils.CheckExistsFile(Config.Entry["Save_Isfolder"].Value + @"\" + fi.Name.Replace(fi.Extension, "") + ".wav"); + Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + fi.Name.Replace(fi.Extension, "") + ".wav"; Generic.ProgressMax = 1; break; } @@ -611,23 +613,43 @@ private void Button_Decode_Click(object sender, EventArgs e) } if (suffix != "") { - if (Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) - { - MessageBox.Show(this, "Folder '" + Config.Entry["Save_Isfolder"].Value + @"\" + suffix + "'is already exists.", Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - } - else + if (!Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) { Directory.CreateDirectory(Config.Entry["Save_Isfolder"].Value + @"\" + suffix); } } Generic.FolderSavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix; + if (Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length != 0) + { + DialogResult dr = MessageBox.Show(this, Localization.AlreadyExistsCaption, Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dr == DialogResult.Yes) + { + Common.Utils.DeleteDirectoryFiles(Common.Generic.FolderSavePath); + } + else + { + return; + } + } Generic.ProgressMax = Common.Generic.OpenFilePaths.Length; break; } case false: { Generic.FolderSavePath = Config.Entry["Save_Isfolder"].Value; + if (Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length != 0) + { + DialogResult dr = MessageBox.Show(this, Localization.AlreadyExistsCaption, Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dr == DialogResult.Yes) + { + Common.Utils.DeleteDirectoryFiles(Common.Generic.FolderSavePath); + } + else + { + return; + } + } Generic.ProgressMax = Common.Generic.OpenFilePaths.Length; break; } @@ -676,7 +698,7 @@ private void Button_Decode_Click(object sender, EventArgs e) formProgress.ShowDialog(); formProgress.Dispose(); - if (Common.Generic.Result == false) + if (Common.Generic.Result == false) // f { Common.Generic.cts.Dispose(); MessageBox.Show(this, Localization.CancelledCaption, Localization.MSGBoxAbortedCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); @@ -684,16 +706,20 @@ private void Button_Decode_Click(object sender, EventArgs e) } else { - if (Common.Generic.OpenFilePaths.Length == 1) + if (Common.Generic.OpenFilePaths.Length == 1) // P { FileInfo fi = new(Common.Generic.SavePath); Common.Generic.cts.Dispose(); if (File.Exists(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name)) { + if (File.Exists(Common.Generic.SavePath)) + { + File.Delete(Common.Generic.SavePath); + } File.Move(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name, Common.Generic.SavePath); if (File.Exists(Common.Generic.SavePath)) { - if (fi.Length != 0) + if (fi.Length != 0) // OK { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.DecodeSuccessCaption, Localization.MSGBoxSuccessCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -701,7 +727,7 @@ private void Button_Decode_Click(object sender, EventArgs e) Utils.ShowFolder(Common.Generic.SavePath, bool.Parse(Config.Entry["ShowFolder"].Value)); return; } - else + else // Error { File.Delete(Common.Generic.SavePath); Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); @@ -710,7 +736,7 @@ private void Button_Decode_Click(object sender, EventArgs e) return; } } - else + else // Exception { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.DecodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -718,7 +744,7 @@ private void Button_Decode_Click(object sender, EventArgs e) return; } } - else + else // Exception { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.DecodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -726,7 +752,7 @@ private void Button_Decode_Click(object sender, EventArgs e) return; } } - else + else // { Common.Generic.cts.Dispose(); foreach (var file in Common.Generic.OpenFilePaths) @@ -734,10 +760,14 @@ private void Button_Decode_Click(object sender, EventArgs e) FileInfo fi = new(file); if (File.Exists(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name.Replace(fi.Extension, ".wav"))) { + if (File.Exists(Common.Generic.FolderSavePath + @"\" + fi.Name.Replace(fi.Extension, ".wav"))) + { + File.Delete(Common.Generic.FolderSavePath + @"\" + fi.Name.Replace(fi.Extension, ".wav")); + } File.Move(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name.Replace(fi.Extension, ".wav"), Common.Generic.FolderSavePath + @"\" + fi.Name.Replace(fi.Extension, ".wav")); continue; } - else + else // Error { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.DecodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -746,7 +776,7 @@ private void Button_Decode_Click(object sender, EventArgs e) } } - if (Common.Generic.OpenFilePaths.Length == Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length) + if (Common.Generic.OpenFilePaths.Length == Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length) // OK { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.DecodeSuccessCaption, Localization.MSGBoxSuccessCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -754,7 +784,7 @@ private void Button_Decode_Click(object sender, EventArgs e) Utils.ShowFolder(Common.Generic.FolderSavePath, bool.Parse(Config.Entry["ShowFolder"].Value)); return; } - else + else // Error { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.DecodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -854,6 +884,7 @@ private void Button_Encode_Click(object sender, EventArgs e) } else // Œꏊɕۑ { + FileInfo fi = new(Common.Generic.OpenFilePaths[0]); string suffix = ""; switch (bool.Parse(Config.Entry["Save_IsSubfolder"].Value)) { @@ -865,11 +896,7 @@ private void Button_Encode_Click(object sender, EventArgs e) } if (suffix != "") { - if (Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) - { - MessageBox.Show(this, "Folder '" + Config.Entry["Save_Isfolder"].Value + @"\" + suffix + "'is already exists.", Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - } - else + if (!Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) { Directory.CreateDirectory(Config.Entry["Save_Isfolder"].Value + @"\" + suffix); } @@ -878,11 +905,13 @@ private void Button_Encode_Click(object sender, EventArgs e) switch (Generic.ATRACFlag) { case 0: - Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + Utils.SFDRandomNumber() + ".at3"; + Utils.CheckExistsFile(Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + fi.Name.Replace(fi.Extension, "") + ".at3"); + Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + fi.Name.Replace(fi.Extension, "") + ".at3"; Generic.ProgressMax = 1; break; case 1: - Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + Utils.SFDRandomNumber() + ".at9"; + Utils.CheckExistsFile(Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + fi.Name.Replace(fi.Extension, "") + ".at9"); + Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix + @"\" + fi.Name.Replace(fi.Extension, "") + ".at9"; Generic.ProgressMax = 1; break; } @@ -893,11 +922,13 @@ private void Button_Encode_Click(object sender, EventArgs e) switch (Generic.ATRACFlag) { case 0: - Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + Utils.SFDRandomNumber() + ".at3"; + Utils.CheckExistsFile(Config.Entry["Save_Isfolder"].Value + @"\" + fi.Name.Replace(fi.Extension, "") + ".at3"); + Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + fi.Name.Replace(fi.Extension, "") + ".at3"; Generic.ProgressMax = 1; break; case 1: - Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + Utils.SFDRandomNumber() + ".at9"; + Utils.CheckExistsFile(Config.Entry["Save_Isfolder"].Value + @"\" + fi.Name.Replace(fi.Extension, "") + ".at9"); + Generic.SavePath = Config.Entry["Save_Isfolder"].Value + @"\" + fi.Name.Replace(fi.Extension, "") + ".at9"; Generic.ProgressMax = 1; break; } @@ -953,23 +984,43 @@ private void Button_Encode_Click(object sender, EventArgs e) } if (suffix != "") { - if (Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) - { - MessageBox.Show(this, "Folder '" + Config.Entry["Save_Isfolder"].Value + @"\" + suffix + "'is already exists.", Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - } - else + if (!Directory.Exists(Config.Entry["Save_Isfolder"].Value + @"\" + suffix)) { Directory.CreateDirectory(Config.Entry["Save_Isfolder"].Value + @"\" + suffix); } } Generic.FolderSavePath = Config.Entry["Save_Isfolder"].Value + @"\" + suffix; + if (Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length != 0) + { + DialogResult dr = MessageBox.Show(this, Localization.AlreadyExistsCaption, Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dr == DialogResult.Yes) + { + Common.Utils.DeleteDirectoryFiles(Common.Generic.FolderSavePath); + } + else + { + return; + } + } Generic.ProgressMax = Common.Generic.OpenFilePaths.Length; break; } case false: { Generic.FolderSavePath = Config.Entry["Save_Isfolder"].Value; + if (Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length != 0) + { + DialogResult dr = MessageBox.Show(this, Localization.AlreadyExistsCaption, Localization.MSGBoxWarningCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dr == DialogResult.Yes) + { + Common.Utils.DeleteDirectoryFiles(Common.Generic.FolderSavePath); + } + else + { + return; + } + } Generic.ProgressMax = Common.Generic.OpenFilePaths.Length; break; } @@ -998,16 +1049,20 @@ private void Button_Encode_Click(object sender, EventArgs e) } else { - if (Common.Generic.OpenFilePaths.Length == 1) + if (Common.Generic.OpenFilePaths.Length == 1) // P { FileInfo fi = new(Common.Generic.SavePath); Common.Generic.cts.Dispose(); if (File.Exists(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name)) { + if (File.Exists(Common.Generic.SavePath)) + { + File.Delete(Common.Generic.SavePath); + } File.Move(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name, Common.Generic.SavePath); if (File.Exists(Common.Generic.SavePath)) { - if (fi.Length != 0) + if (fi.Length != 0) // OK { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.EncodeSuccessCaption, Localization.MSGBoxSuccessCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -1015,7 +1070,7 @@ private void Button_Encode_Click(object sender, EventArgs e) Utils.ShowFolder(Common.Generic.SavePath, bool.Parse(Config.Entry["ShowFolder"].Value)); return; } - else + else // Error { File.Delete(Common.Generic.SavePath); Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); @@ -1024,7 +1079,7 @@ private void Button_Encode_Click(object sender, EventArgs e) return; } } - else + else // Exception { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.EncodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1032,7 +1087,7 @@ private void Button_Encode_Click(object sender, EventArgs e) return; } } - else + else // Exception { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.EncodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1040,7 +1095,7 @@ private void Button_Encode_Click(object sender, EventArgs e) return; } } - else + else // { Common.Generic.cts.Dispose(); foreach (var file in Common.Generic.OpenFilePaths) @@ -1048,6 +1103,10 @@ private void Button_Encode_Click(object sender, EventArgs e) FileInfo fi = new(file); if (File.Exists(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name.Replace(fi.Extension, Common.Generic.ATRACExt))) { + if (File.Exists(Common.Generic.FolderSavePath + @"\" + fi.Name.Replace(fi.Extension, Common.Generic.ATRACExt))) + { + File.Delete(Common.Generic.FolderSavePath + @"\" + fi.Name.Replace(fi.Extension, Common.Generic.ATRACExt)); + } File.Move(Directory.GetCurrentDirectory() + @"\_temp\" + fi.Name.Replace(fi.Extension, Common.Generic.ATRACExt), Common.Generic.FolderSavePath + @"\" + fi.Name.Replace(fi.Extension, Common.Generic.ATRACExt)); if (File.Exists(Common.Generic.FolderSavePath + @"\" + fi.Name.Replace(fi.Extension, Common.Generic.ATRACExt))) { @@ -1062,7 +1121,7 @@ private void Button_Encode_Click(object sender, EventArgs e) continue; } } - else + else // Error { Common.Utils.DeleteDirectoryFiles(Common.Generic.FolderSavePath + @"\"); Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); @@ -1071,7 +1130,7 @@ private void Button_Encode_Click(object sender, EventArgs e) return; } } - else + else // Exception { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.EncodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1080,7 +1139,7 @@ private void Button_Encode_Click(object sender, EventArgs e) } } - if (Common.Generic.OpenFilePaths.Length == Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length) + if (Common.Generic.OpenFilePaths.Length == Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length) // OK { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.EncodeSuccessCaption, Localization.MSGBoxSuccessCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -1088,7 +1147,7 @@ private void Button_Encode_Click(object sender, EventArgs e) Utils.ShowFolder(Common.Generic.FolderSavePath, bool.Parse(Config.Entry["ShowFolder"].Value)); return; } - else if (Common.Generic.OpenFilePaths.Length > Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length && Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length != 0) + else if (Common.Generic.OpenFilePaths.Length > Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length && Directory.GetFiles(Common.Generic.FolderSavePath, "*", SearchOption.AllDirectories).Length != 0) // ꕔϊs { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.EncodePartialCaption, Localization.MSGBoxWarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); @@ -1096,7 +1155,7 @@ private void Button_Encode_Click(object sender, EventArgs e) Utils.ShowFolder(Common.Generic.FolderSavePath, bool.Parse(Config.Entry["ShowFolder"].Value)); return; } - else + else // Error { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); MessageBox.Show(this, Localization.EncodeErrorCaption, Localization.MSGBoxErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1131,6 +1190,7 @@ private void ReadStatus() private void ResetStatus() { + Utils.ATWCheck(Generic.IsATW); Common.Generic.OpenFilePaths = null!; Common.Generic.ProcessFlag = -1; Common.Generic.ProgressMax = -1; @@ -1485,6 +1545,8 @@ private void FormMain_DragEnter(object sender, DragEventArgs e) private void FormMain_DragDrop(object sender, DragEventArgs e) { + Utils.ATWCheck(Generic.IsATW); + if (e.Data != null) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); @@ -1689,6 +1751,7 @@ private void FormMain_DragDrop(object sender, DragEventArgs e) private void FormMain_FormClosed(object sender, FormClosedEventArgs e) { Common.Utils.DeleteDirectoryFiles(Directory.GetCurrentDirectory() + @"\_temp"); + Utils.ATWCheck(Generic.IsATW); Directory.Delete(Directory.GetCurrentDirectory() + @"\_temp"); } @@ -1910,6 +1973,7 @@ private void AudioToWaveConvert() } else { + Generic.IsATW = false; ResetStatus(); return; } @@ -2018,6 +2082,7 @@ private void AudioToWaveConvert() } else { + Generic.IsATW = false; ResetStatus(); return; } @@ -2042,6 +2107,7 @@ private void FormatSorter(bool IsEncode, bool IsNotWave = false) { Common.Generic.IsWave = true; Common.Generic.IsATRAC = false; + Generic.IsATW = false; label_Formattxt.Text = Localization.WAVEFormatCaption; toolStripDropDownButton_EF.Enabled = true; toolStripDropDownButton_EF.Visible = true; @@ -2053,6 +2119,7 @@ private void FormatSorter(bool IsEncode, bool IsNotWave = false) { Common.Generic.IsWave = false; Common.Generic.IsATRAC = false; + Generic.IsATW = true; label_Formattxt.Text = Localization.WAVEConvertedFormatCaption; toolStripDropDownButton_EF.Enabled = true; toolStripDropDownButton_EF.Visible = true; @@ -2066,6 +2133,7 @@ private void FormatSorter(bool IsEncode, bool IsNotWave = false) { Common.Generic.IsWave = false; Common.Generic.IsATRAC = true; + Generic.IsATW = false; toolStripDropDownButton_EF.Enabled = false; toolStripDropDownButton_EF.Visible = false; button_Decode.Enabled = true;