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 - +