diff --git a/TConvert/CommandLine.cs b/TConvert/CommandLine.cs
index e6615fc..18acf5c 100644
--- a/TConvert/CommandLine.cs
+++ b/TConvert/CommandLine.cs
@@ -71,8 +71,8 @@ public string OptionsToString() {
/**The collection of command line options.*/
private static readonly Dictionary Options = new Dictionary() {
- { ArgTypes.Input, new OptionInfo(ProcessInput, "Input", "Specify input files & folders.", "[filepaths]", "-i", "--input") },
- { ArgTypes.Output, new OptionInfo(ProcessOutput, "Output", "Specify output files & folders.", "[filepaths]", "-o", "--output") },
+ { ArgTypes.Input, new OptionInfo(ProcessInput, "Input", "Specify input files & folders.", "filepaths", "-i", "--input") },
+ { ArgTypes.Output, new OptionInfo(ProcessOutput, "Output", "Specify output files & folders.", "filepaths", "-o", "--output") },
#if !(CONSOLE)
{ ArgTypes.Console, new OptionInfo(ProcessConsole, "Console", "Don't display a progress window.", null, "-C", "--Console") },
#endif
@@ -469,8 +469,8 @@ private static void ProcessHelp() {
line += " " + argInfo.Value.PostOptions;
if (line.Length < 22)
line += new string(' ', 22 - line.Length);
- else if (line.Length < 30)
- line += new string(' ', 30 - line.Length);
+ else if (line.Length < 27)
+ line += new string(' ', 27 - line.Length);
line += argInfo.Value.Description;
Log(line);
}
diff --git a/TConvert/Convert/PngConverter.cs b/TConvert/Convert/PngConverter.cs
index cd890b8..6d7c928 100644
--- a/TConvert/Convert/PngConverter.cs
+++ b/TConvert/Convert/PngConverter.cs
@@ -99,9 +99,15 @@ public static bool Convert(string inputFile, string outputFile, bool changeExten
if (changeExtension) {
outputFile = Path.ChangeExtension(outputFile, ".xnb");
}
+
+ // Throw more helpful exceptions than what Bitmap.ctor() throws.
if (!Directory.Exists(Path.GetDirectoryName(inputFile))) {
throw new DirectoryNotFoundException("Could not find a part of the path '" + inputFile + "'.");
}
+ else if (!File.Exists(inputFile)) {
+ throw new FileNotFoundException("Could not find file '" + inputFile + "'.");
+ }
+
using (Bitmap bmp = new Bitmap(inputFile)) {
using (FileStream stream = new FileStream(outputFile, FileMode.OpenOrCreate, FileAccess.Write)) {
using (BinaryWriter writer = new BinaryWriter(stream)) {
diff --git a/TConvert/Convert/WavConverter.cs b/TConvert/Convert/WavConverter.cs
index 61bb3d5..7583695 100644
--- a/TConvert/Convert/WavConverter.cs
+++ b/TConvert/Convert/WavConverter.cs
@@ -22,7 +22,7 @@ public static bool Convert(string inputFile, string outputFile, bool changeExten
int dataChunkSize;
byte[] waveData;
-
+
using (FileStream stream = new FileStream(inputFile, FileMode.Open)) {
using (BinaryReader reader = new BinaryReader(stream)) {
string format = new string(reader.ReadChars(4));
diff --git a/TConvert/MainWindow.xaml b/TConvert/MainWindow.xaml
index 3a212f6..6765942 100644
--- a/TConvert/MainWindow.xaml
+++ b/TConvert/MainWindow.xaml
@@ -112,14 +112,16 @@
Folder
File
-
+
+
+
-
+
-
+
@@ -127,12 +129,10 @@
-
-
-
-
+
-
+
+
@@ -141,56 +141,55 @@
Folder
File
+
+
-
+
-
+
-
-
-
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
diff --git a/TConvert/MainWindow.xaml.cs b/TConvert/MainWindow.xaml.cs
index 6fb913e..4a41efa 100644
--- a/TConvert/MainWindow.xaml.cs
+++ b/TConvert/MainWindow.xaml.cs
@@ -201,6 +201,8 @@ private void OnExtract(object sender, RoutedEventArgs e) {
TriggerMessageBox.Show(this, MessageIcon.Warning, "Output folder path is invalid.", "Invalid Path");
return;
}
+ input = Helpers.FixPathSafe(input);
+ output = Helpers.FixPathSafe(output);
thread = new Thread(() => {
Processing.ExtractAll(input, output, allowImages, allowSounds, allowFonts, allowWaveBank);
});
@@ -214,6 +216,8 @@ private void OnExtract(object sender, RoutedEventArgs e) {
TriggerMessageBox.Show(this, MessageIcon.Warning, "Output file path is invalid.", "Invalid Path");
return;
}
+ input = Helpers.FixPathSafe(input);
+ output = Helpers.FixPathSafe(output);
thread = new Thread(() => {
Processing.ExtractSingleFile(input, output);
});
@@ -319,6 +323,8 @@ private void OnConvert(object sender, RoutedEventArgs e) {
TriggerMessageBox.Show(this, MessageIcon.Warning, "Output folder path is invalid.", "Invalid Path");
return;
}
+ input = Helpers.FixPathSafe(input);
+ output = Helpers.FixPathSafe(output);
thread = new Thread(() => {
Processing.ConvertAll(input, output, allowImages, allowSounds);
});
@@ -332,6 +338,8 @@ private void OnConvert(object sender, RoutedEventArgs e) {
TriggerMessageBox.Show(this, MessageIcon.Warning, "Output file path is invalid.", "Invalid Path");
return;
}
+ input = Helpers.FixPathSafe(input);
+ output = Helpers.FixPathSafe(output);
thread = new Thread(() => {
Processing.ConvertSingleFile(input, output);
});
@@ -428,6 +436,8 @@ private void OnBackup(object sender, RoutedEventArgs e) {
return;
}
+ input = Helpers.FixPathSafe(input);
+ output = Helpers.FixPathSafe(output);
Thread thread = new Thread(() => {
Processing.BackupFiles(input, output);
});
@@ -450,6 +460,8 @@ private void OnRestore(object sender, RoutedEventArgs e) {
return;
}
+ input = Helpers.FixPathSafe(input);
+ output = Helpers.FixPathSafe(output);
Thread thread = new Thread(() => {
Processing.RestoreFiles(input, output);
});
@@ -510,6 +522,7 @@ private void OnRunScript(object sender, RoutedEventArgs e) {
TriggerMessageBox.Show(this, MessageIcon.Warning, "Could not find the script file.", "Invalid Path");
return;
}
+ input = Helpers.FixPathSafe(input);
thread = new Thread(() => {
Processing.RunScript(input);
});
diff --git a/TConvert/Processing.cs b/TConvert/Processing.cs
index fe2add7..a6e6d12 100644
--- a/TConvert/Processing.cs
+++ b/TConvert/Processing.cs
@@ -4,6 +4,7 @@
using System.IO;
using System.Linq;
using System.Media;
+using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -225,8 +226,12 @@ private static void WriteTimeAndPercentage(string message, bool finished = false
}
/**Called when the progress window is canceled.*/
private static void OnProgressCancel() {
+ Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
ErrorLogger.Close();
if (errorLog.Count > 0) {
+ #if !(CONSOLE)
+ progressWindow = null;
+ #endif
ShowErrorLog();
errorLog.Clear();
}
@@ -253,6 +258,7 @@ public static void UpdateProgress(string message, bool forceUpdate = false) {
}
/**Called to finish the progress with a message.*/
public static void FinishProgress(string message) {
+ Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
#if !(CONSOLE)
if (progressWindow != null) {
progressWindow.Dispatcher.Invoke(() => {
@@ -521,6 +527,8 @@ private static bool ExtractFile(string inputFile, string inputDirectory, string
catch (XnbException ex) {
LogError("Extracting: " + inputFile, "Xnb error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Extracting: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
@@ -561,6 +569,8 @@ private static bool ExtractFile2(string inputFile, string outputFile) {
catch (XnbException ex) {
LogError("Extracting: " + inputFile, "Xnb error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Extracting: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
@@ -641,6 +651,8 @@ private static bool ConvertFile(string inputFile, string inputDirectory, string
catch (WavException ex) {
LogError("Converting: " + inputFile, "Wav error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Converting: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
@@ -684,6 +696,8 @@ private static bool ConvertFile2(string inputFile, string outputFile, bool compr
catch (WavException ex) {
LogError("Converting: " + inputFile, "Wav error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Converting: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
@@ -788,6 +802,8 @@ public static Script LoadScript(string inputScript) {
try {
Directory.SetCurrentDirectory(Path.GetDirectoryName(inputScript));
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Setting working directory failed", ex.Message);
FinishProgress("Finished Script");
@@ -822,20 +838,22 @@ public static Script LoadScript(string inputScript) {
FinishProgress("Finished Script");
return null;
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Reading Script: " + inputScript, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
FinishProgress("Finished Script");
return null;
}
- XmlElement root = doc["ConvertScript"];
+ XmlElement root = doc["TConvertScript"];
// Find all the files and restores
if (root != null) {
LoadScriptFolder(root, files, backups, restores, "", "", compressImages, true);
}
else {
- LogError("Reading Script", "No root ConvertScript");
+ LogError("Reading Script", "No root element TConvertScript.");
FinishProgress("Finished Script");
return null;
}
@@ -847,7 +865,7 @@ public static Script LoadScript(string inputScript) {
switch (ext) {
case ".xnb": case ".xwb":
extracts.Add(file); break;
- case ".png": case ".bmp": case ".jpg":
+ case ".wav": case ".png": case ".bmp": case ".jpg":
converts.Add(file); break;
}
}
@@ -868,7 +886,7 @@ private static void LoadScriptFolder(XmlElement element, List files, L
if (bool.TryParse(attribute.InnerText, out nextCompress))
newCompress = nextCompress;
else
- LogWarning("Reading Script", "Failed to parse Compress attribute Value.");
+ LogWarning("Reading Script", "Failed to parse Value attribute in Compress: '" + attribute.InnerText + "'.");
}
else {
LogWarning("Reading Script", "No Value attribute in Compress.");
@@ -877,12 +895,17 @@ private static void LoadScriptFolder(XmlElement element, List files, L
case "Backup":
attribute = next.Attributes["Path"];
if (attribute != null) {
- string nextPath;
- if (path == string.Empty)
- nextPath = attribute.InnerText;
- else
- nextPath = Path.Combine(path, attribute.InnerText);
- backups.Add(new PathPair(nextPath, newOutput));
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ string nextPath;
+ if (path == string.Empty)
+ nextPath = attribute.InnerText;
+ else
+ nextPath = Path.Combine(path, attribute.InnerText);
+ backups.Add(new PathPair(nextPath, newOutput));
+ }
+ else {
+ LogWarning("Reading Script", "Invalid Path attribute in Backup: '" + attribute.InnerText + "'.");
+ }
}
else {
LogWarning("Reading Script", "No Path attribute in Backup.");
@@ -891,12 +914,17 @@ private static void LoadScriptFolder(XmlElement element, List files, L
case "Restore":
attribute = next.Attributes["Path"];
if (attribute != null) {
- string nextPath;
- if (path == string.Empty)
- nextPath = attribute.InnerText;
- else
- nextPath = Path.Combine(path, attribute.InnerText);
- restores.Add(new PathPair(nextPath, newOutput));
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ string nextPath;
+ if (path == string.Empty)
+ nextPath = attribute.InnerText;
+ else
+ nextPath = Path.Combine(path, attribute.InnerText);
+ restores.Add(new PathPair(nextPath, newOutput));
+ }
+ else {
+ LogWarning("Reading Script", "Invalid Path attribute in Restore: '" + attribute.InnerText + "'.");
+ }
}
else {
LogWarning("Reading Script", "No Path attribute in Restore.");
@@ -905,10 +933,15 @@ private static void LoadScriptFolder(XmlElement element, List files, L
case "Output":
attribute = next.Attributes["Path"];
if (attribute != null) {
- if (output == string.Empty)
- newOutput = attribute.InnerText;
- else
- newOutput = Path.Combine(output, attribute.InnerText);
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ if (output == string.Empty)
+ newOutput = attribute.InnerText;
+ else
+ newOutput = Path.Combine(output, attribute.InnerText);
+ }
+ else {
+ LogWarning("Reading Script", "Invalid Path attribute in Output: '" + attribute.InnerText + "'.");
+ }
}
else {
LogWarning("Reading Script", "No Path attribute in Output.");
@@ -917,12 +950,17 @@ private static void LoadScriptFolder(XmlElement element, List files, L
case "Folder":
attribute = next.Attributes["Path"];
if (attribute != null) {
- string nextPath;
- if (path == string.Empty)
- nextPath = attribute.InnerText;
- else
- nextPath = Path.Combine(path, attribute.InnerText);
- LoadScriptFolder(next, files, backups, restores, newOutput, nextPath, newCompress);
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ string nextPath;
+ if (path == string.Empty)
+ nextPath = attribute.InnerText;
+ else
+ nextPath = Path.Combine(path, attribute.InnerText);
+ LoadScriptFolder(next, files, backups, restores, newOutput, nextPath, newCompress);
+ }
+ else {
+ LogWarning("Reading Script", "Invalid Path attribute in Folder: '" + attribute.InnerText + "'.");
+ }
}
else {
LogWarning("Reading Script", "No Path attribute in Folder.");
@@ -931,31 +969,39 @@ private static void LoadScriptFolder(XmlElement element, List files, L
case "File":
attribute = next.Attributes["Path"];
if (attribute != null) {
- string nextPath;
- bool nextCompress = newCompress;
- if (path == string.Empty)
- nextPath = attribute.InnerText;
- else
- nextPath = Path.Combine(path, attribute.InnerText);
- attribute = next.Attributes["Compress"];
- if (attribute != null) {
- if (!bool.TryParse(attribute.InnerText, out nextCompress)) {
- LogWarning("Reading Script", "Failed to parse File attribute Compress.");
- nextCompress = newCompress;
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ string nextPath;
+ bool nextCompress = newCompress;
+ if (path == string.Empty)
+ nextPath = attribute.InnerText;
+ else
+ nextPath = Path.Combine(path, attribute.InnerText);
+ attribute = next.Attributes["Compress"];
+ if (attribute != null) {
+ if (!bool.TryParse(attribute.InnerText, out nextCompress)) {
+ LogWarning("Reading Script", "Failed to parse Compress attribute in File: '" + attribute.InnerText + "'.");
+ nextCompress = newCompress;
+ }
}
+ attribute = next.Attributes["OutPath"];
+ if (attribute != null) {
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ string nextOutput;
+ if (newOutput == string.Empty)
+ nextOutput = Helpers.FixPathSafe(attribute.InnerText);
+ else
+ nextOutput = Path.Combine(newOutput, attribute.InnerText);
+ files.Add(new PathPair(nextPath, nextOutput, nextCompress));
+ }
+ else {
+ LogWarning("Reading Script", "Invalid OutPath attribute in File: '" + attribute.InnerText + "'."); ;
+ }
+ }
+ LoadScriptFile(next, files, newOutput, nextPath, nextCompress);
}
- attribute = next.Attributes["OutPath"];
- if (attribute != null) {
- string nextOutput;
- if (newOutput == string.Empty)
- nextOutput = attribute.InnerText;
- else
- nextOutput = Path.Combine(newOutput, attribute.InnerText);
- if (!Path.HasExtension(nextOutput))
- nextOutput = Path.ChangeExtension(nextOutput, ".xnb");
- files.Add(new PathPair(nextPath, nextOutput, nextCompress));
+ else {
+ LogWarning("Reading Script", "Invalid Path attribute in File: '" + attribute.InnerText + "'.");
}
- LoadScriptFile(next, files, newOutput, nextPath, nextCompress);
}
else {
LogWarning("Reading Script", "No Path attribute in File.");
@@ -981,7 +1027,7 @@ private static void LoadScriptFile(XmlElement element, List files, str
if (bool.TryParse(attribute.InnerText, out nextCompress))
newCompress = nextCompress;
else
- LogWarning("Reading Script", "Failed to parse Compress attribute Value.");
+ LogWarning("Reading Script", "Failed to parse Value attribute in Compress: '" + attribute.InnerText + "'.");
}
else {
LogWarning("Reading Script", "No Value attribute in Compress.");
@@ -990,10 +1036,15 @@ private static void LoadScriptFile(XmlElement element, List files, str
case "Output":
attribute = next.Attributes["Path"];
if (attribute != null) {
- if (output == string.Empty)
- newOutput = attribute.InnerText;
- else
- newOutput = Path.Combine(output, attribute.InnerText);
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ if (output == string.Empty)
+ newOutput = attribute.InnerText;
+ else
+ newOutput = Path.Combine(output, attribute.InnerText);
+ }
+ else {
+ LogWarning("Reading Script", "Invalid Path attribute in Output: '" + attribute.InnerText + "'.");
+ }
}
else {
LogWarning("Reading Script", "No Path attribute in Output.");
@@ -1002,25 +1053,28 @@ private static void LoadScriptFile(XmlElement element, List files, str
case "Out":
attribute = next.Attributes["Path"];
if (attribute != null) {
- string nextOutput;
- bool nextCompress = newCompress;
- if (newOutput == string.Empty)
- nextOutput = attribute.InnerText;
- else
- nextOutput = Path.Combine(newOutput, attribute.InnerText);
- if (!Path.HasExtension(nextOutput))
- nextOutput = Path.ChangeExtension(nextOutput, ".xnb");
- attribute = next.Attributes["Compress"];
- if (attribute != null) {
- if (!bool.TryParse(attribute.InnerText, out nextCompress)) {
- LogWarning("Reading Script", "Failed to parse Out attribute Compress.");
- nextCompress = newCompress;
+ if (Helpers.IsPathValid(attribute.InnerText)) {
+ string nextOutput;
+ bool nextCompress = newCompress;
+ if (newOutput == string.Empty)
+ nextOutput = attribute.InnerText;
+ else
+ nextOutput = Path.Combine(newOutput, attribute.InnerText);
+ attribute = next.Attributes["Compress"];
+ if (attribute != null) {
+ if (!bool.TryParse(attribute.InnerText, out nextCompress)) {
+ LogWarning("Reading Script", "Failed to parse Compress attribute in Out: '" + attribute.InnerText + "'.");
+ nextCompress = newCompress;
+ }
}
+ files.Add(new PathPair(path, nextOutput, nextCompress));
+ }
+ else {
+ LogWarning("Reading Script", "Invalid Path attribute in Out: '" + attribute.InnerText + "'.");
}
- files.Add(new PathPair(path, nextOutput, nextCompress));
}
else {
- LogWarning("Reading Script", "No Path attribute in Out");
+ LogWarning("Reading Script", "No Path attribute in Out.");
}
break;
default:
@@ -1081,6 +1135,8 @@ private static bool BackupFile(string inputFile, string inputDirectory, string o
catch (IOException ex) {
LogError("Backing up: " + inputFile, "IO error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Backing up: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
@@ -1109,6 +1165,8 @@ private static bool BackupFile2(string inputFile, string outputFile) {
catch (IOException ex) {
LogError("Backing up: " + inputFile, "IO error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Backing up: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
@@ -1146,6 +1204,8 @@ private static bool RestoreFile(string inputFile, string inputDirectory, string
catch (IOException ex) {
LogError("Restoring: " + inputFile, "IO error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Restoring: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
@@ -1182,6 +1242,8 @@ private static bool RestoreFile2(string inputFile, string outputFile) {
catch (IOException ex) {
LogError("Restoring: " + inputFile, "IO error (" + ex.Message + ")");
}
+ catch (ThreadAbortException) { }
+ catch (ThreadInterruptedException) { }
catch (Exception ex) {
LogError("Restoring: " + inputFile, ex.GetType().ToString().Split('.').Last() + " (" + ex.Message + ")");
}
diff --git a/TConvert/TConvert - Copy.csproj b/TConvert/TConvert - Copy.csproj
deleted file mode 100644
index f0b4126..0000000
--- a/TConvert/TConvert - Copy.csproj
+++ /dev/null
@@ -1,263 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {A0490315-2780-4572-BBA1-F56A7C2A5901}
- Properties
- TConvert
- v4.5.2
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
-
-
- TConvert
- WinExe
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- TConvert
- WinExe
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 2
-
-
- App.ico
-
-
- TConvert.Startup
-
-
- TConvertCon
- Exe
- true
- bin\Debug Console\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
- TConvertCon
- Exe
- bin\Release Console\
- TRACE
- true
- 2
- pdbonly
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- AboutWindow.xaml
-
-
- CreditsWindow.xaml
-
-
- ErrorLogWindow.xaml
-
-
-
- ProgressWindow.xaml
-
-
-
- ErrorMessageBox.xaml
-
-
- TriggerMessageBox.xaml
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
-
-
-
-
-
- MainWindow.xaml
- Code
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/TConvert/TConvert.csproj b/TConvert/TConvert.csproj
index c891813..5d98719 100644
--- a/TConvert/TConvert.csproj
+++ b/TConvert/TConvert.csproj
@@ -130,6 +130,7 @@
ErrorLogWindow.xaml
+
ProgressWindow.xaml
@@ -147,11 +148,6 @@
-
- True
- True
- Resources.resx
-
@@ -168,12 +164,16 @@
-
Code
+
+ True
+ True
+ Resources.resx
+
True
Settings.settings
diff --git a/TConvert/Util/Helpers.cs b/TConvert/Util/Helpers.cs
index b648efd..5091f3a 100644
--- a/TConvert/Util/Helpers.cs
+++ b/TConvert/Util/Helpers.cs
@@ -64,6 +64,18 @@ public static void CreateDirectorySafe(string directory) {
}
catch { }
}
+ /**Safely gets the full path.*/
+ public static string FixPathSafe(string path) {
+ try {
+ path = Path.GetFullPath(path);
+ if (path != string.Empty && (path.Last() == '\\' || path.Last() == '/'))
+ path = path.Remove(path.Length - 1);
+ return path;
+ }
+ catch {
+ return "";
+ }
+ }
/**Safely tests if a directory exists.*/
public static bool DirectoryExistsSafe(string path) {
try {
diff --git a/TConvert/Windows/CreditsWindow.xaml b/TConvert/Windows/CreditsWindow.xaml
index 4206bd7..8f1d62f 100644
--- a/TConvert/Windows/CreditsWindow.xaml
+++ b/TConvert/Windows/CreditsWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TConvert"
mc:Ignorable="d"
- Title="Credits" Height="280" Width="350" Background="#FFECEEF1" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" SnapsToDevicePixels="True" UseLayoutRounding="True" Icon="/Resources/Icons/Credits.png">
+ Title="Credits" Height="332" Width="360" Background="#FFECEEF1" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" SnapsToDevicePixels="True" UseLayoutRounding="True" Icon="/Resources/Icons/Credits.png">
@@ -56,6 +56,18 @@
+
+
+ Wave bank song conversion thanks to FFmpeg, which is under GNU Lesser General Public License version 2.1.
+
+
+
+
+
+
+
+
+
Most icons from or modified from Fugue Icon Pack.
diff --git a/TConvert/Windows/FolderBrowserLauncher.cs b/TConvert/Windows/FolderBrowserLauncher.cs
index c02225b..c59d040 100644
--- a/TConvert/Windows/FolderBrowserLauncher.cs
+++ b/TConvert/Windows/FolderBrowserLauncher.cs
@@ -58,7 +58,8 @@ public static class FolderBrowserLauncher {
///
public static DialogResult ShowFolderBrowser(FolderBrowserDialog dlg, IWin32Window parent = null) {
DialogResult result = DialogResult.Cancel;
- int retries = 10;
+ int retries = 40;
+ dlg.SelectedPath = System.IO.Path.GetFullPath(dlg.SelectedPath);
using (Timer t = new Timer()) {
t.Tick += (s, a) => {
@@ -73,9 +74,11 @@ public static DialogResult ShowFolderBrowser(FolderBrowserDialog dlg, IWin32Wind
if (hwndTV != IntPtr.Zero) {
IntPtr item = SendMessage(hwndTV, (uint)TVM_GETNEXTITEM, new IntPtr(TVGN_CARET), IntPtr.Zero);
if (item != IntPtr.Zero) {
+ // Let's send this 40 times until we drill it into the folder browser's thick skull.
+ // Otherwise it will just go back to the beginning.
SendMessage(hwndTV, TVM_ENSUREVISIBLE, IntPtr.Zero, item);
- retries = 0;
- t.Stop();
+ //retries = 0;
+ //t.Stop();
}
}
}
@@ -91,7 +94,7 @@ public static DialogResult ShowFolderBrowser(FolderBrowserDialog dlg, IWin32Wind
// the Tree View to scroll to the selected item.
//
t.Stop();
- SendKeys.Send("{TAB}{TAB}{DOWN}{DOWN}{UP}{UP}");
+ //SendKeys.Send("{TAB}{TAB}{DOWN}{DOWN}{UP}{UP}");
}
};