From 9ea7abd160d4922d8bc94365bbf9338aca199ecc Mon Sep 17 00:00:00 2001 From: Tichau Date: Fri, 18 Dec 2015 19:23:31 +0100 Subject: [PATCH 1/6] Fixed: Default settings not defined for types Aac and Ico --- .../ConversionPreset/ConversionPreset.cs | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/Application/FileConverter/ConversionPreset/ConversionPreset.cs b/Application/FileConverter/ConversionPreset/ConversionPreset.cs index f364d9d..835b80f 100644 --- a/Application/FileConverter/ConversionPreset/ConversionPreset.cs +++ b/Application/FileConverter/ConversionPreset/ConversionPreset.cs @@ -447,40 +447,42 @@ namespace FileConverter private void InitializeDefaultSettings(OutputType outputType) { - if (outputType == OutputType.Wav) + switch (outputType) { - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioEncodingMode, EncodingMode.Wav16.ToString(), true); - } + case OutputType.Aac: + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "128"); + break; - if (outputType == OutputType.Mp3) - { - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioEncodingMode, EncodingMode.Mp3VBR.ToString(), true); - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "190"); - } + case OutputType.Flac: + case OutputType.Ico: + case OutputType.Png: + break; - if (outputType == OutputType.Ogg) - { - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "160"); - } + case OutputType.Jpg: + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageQuality, "25"); + break; - if (outputType == OutputType.Flac) - { - } + case OutputType.Mkv: + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoQuality, "28"); + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, "Very Slow"); + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "128"); + break; - if (outputType == OutputType.Mkv) - { - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoQuality, "28"); - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, "Very Slow"); - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "128"); - } + case OutputType.Mp3: + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioEncodingMode, EncodingMode.Mp3VBR.ToString(), true); + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "190"); + break; - if (outputType == OutputType.Png) - { - } + case OutputType.Ogg: + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "160"); + break; - if (outputType == OutputType.Jpg) - { - this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageQuality, "25"); + case OutputType.Wav: + this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioEncodingMode, EncodingMode.Wav16.ToString(), true); + break; + + default: + throw new System.Exception("Missing default settings for type " + outputType); } this.OnPropertyChanged("Settings"); From 1d64c778e701fdb7c1c196d90518132d1233c588 Mon Sep 17 00:00:00 2001 From: Tichau Date: Fri, 18 Dec 2015 19:23:45 +0100 Subject: [PATCH 2/6] Change website url in readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30a2d32..d3e881b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This application is under GPL version 3 licence. For more informations check the LICENSE file in your installation folder or the [gnu website](http://www.gnu.org/licenses/gpl.html). -You can download it here: [http://tichau.github.io/FileConverter](http://tichau.github.io/FileConverter). +You can download it here: [www.file-converter.org](http://file-converter.org). ## Supported file formats From 4f38accc9ee8f8c268a23012a318ebd1b366b470 Mon Sep 17 00:00:00 2001 From: Tichau Date: Mon, 21 Dec 2015 22:25:41 +0100 Subject: [PATCH 3/6] Split readme file Add changelog.md and licence.md --- CHANGELOG.md | 45 ++++++++++++++++++ Installer/Product.wxs | 6 +++ LICENSE => LICENSE.md | 14 +++--- README.md | 105 ++---------------------------------------- 4 files changed, 61 insertions(+), 109 deletions(-) create mode 100644 CHANGELOG.md rename LICENSE => LICENSE.md (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..867b6a7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,45 @@ +# Change Log + +## Version 0.4 +- New: Possibility to encode videos (mkv output file format) using H.264 video codec and AAC audio codec. +- New: Possibility to extract Audio CD content. +- New: Possibility to encode audio in aac format. +- New: Possibility to encode images (png, jpg and ico formats). +- New: Support new audio input file format: aac +- New: Support new video input file formats: bik, flv, mov, mkv +- New: Support new image input file formats: bmp, tiff, png, jpg and ico. +- New: Multi-thread conversion (file converter will now start multiple conversions at the time depending on your number of cores). +- New: Copy the currently selected preset when clicking on the add preset button. +- New: Add "My Documents", "My Music", "My Videos" and "My Pictures" folder to output file name generator. +- New: Possibily to chose if the application quit after succeeded conversions. +- Fixed: Reordering presets does not update the registry. +- Tech: Handle incorrect user settings case. +- Tech: Improve diagnostics system (compatibility with logs from multiple threads, dump files in AppData folder and error messages). +- Tech: Update ffmpeg version. + +## Version 0.3 +- New: Possibility to extract audio from videos. +- New: Support new input file formats: aiff, m4a, avi, mp4. +- New: Quality settings for Mp3 (Encoding mode vbr/cbr and bitrate). +- New: Quality settings for Ogg (Bitrate). +- New: Quality settings for Wav (bits per sample: 8, 16, 24 or 32). +- New: Add output file path template system. +- New: Add button to move up or down a preset. +- New: Add input files post conversion action (No action, move in archive folder or delete). +- New: Add categories on input file extensions. +- Fixed: Lose focus of main window don't terminate the application. +- Fixed: The application icon now have a correct resolution at any size. +- Tech: Add error codes on error messages. + +## Version 0.2 +- New: Support new input file format: ape. +- New: Add notion of conversion preset (in order to customize the conversion possibilities). +- New: Add settings window to edit conversion presets. +- New: Add application icon. +- New: Customize application installer. +- New: Add diagnostic window to read the application logs. + +## Version 0.1 +- New: Add decode support for file formats Mp3, Ogg, Wav, Flac, Wma +- New: Add encode support for file formats Mp3, Ogg, Wav, Flac +- New: UI to visualize the conversion progress \ No newline at end of file diff --git a/Installer/Product.wxs b/Installer/Product.wxs index 50d748a..4bf90b1 100644 --- a/Installer/Product.wxs +++ b/Installer/Product.wxs @@ -68,6 +68,12 @@ + + + + + + diff --git a/LICENSE b/LICENSE.md similarity index 99% rename from LICENSE rename to LICENSE.md index 733c072..7b90ef0 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,11 +1,11 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 +# GNU GENERAL PUBLIC LICENSE +## Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble +## Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. @@ -68,7 +68,7 @@ patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. - TERMS AND CONDITIONS +## TERMS AND CONDITIONS 0. Definitions. @@ -618,9 +618,9 @@ an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs +## END OF TERMS AND CONDITIONS +---- +## How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it diff --git a/README.md b/README.md index d3e881b..568e10f 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,6 @@ ## Description **File Converter** is a very simple tool which allows you to convert one or several file(s) from one format to another using the context menu in windows explorer. -This application is under GPL version 3 licence. -For more informations check the LICENSE file in your installation folder or the [gnu website](http://www.gnu.org/licenses/gpl.html). - You can download it here: [www.file-converter.org](http://file-converter.org). ## Supported file formats @@ -20,62 +17,6 @@ Category | Supported output formats | Compatible input formats *Note 2: The mkv output file format encodes video using H.264 encoder for video and AAC encoder for audio.* -## Input file post conversion actions - -This actions allow you to chose what you want to do with your input files if the conversion succeed. - -Action | Description -----------------------------|------------------------------------------------------------------------------------------------ -**None** | Don't modify the input file. If the output file name conflict with the input, it will be renamed. -**Move in archive folder** | Move the input file in a folder named *Conversion Archives* if the conversion is a success. -**Delete** | Delete the input file if the conversion is a success (be careful no warning will be prompted). - -## Output file path template - -This template allow you to define how you want to generate the output file path (depending on the input file path). -You have access to the following informations: - -Pattern | Description | Example (with input path: *C:\Music\Artist\Album\Song.wav*) ---------|-------------------------------|----------------------------------------------------------------- -(p) | Input file path | C:\Music\Artist\Album\ -(p:d) | My documents folder path | C:\Users\UserName\Documents\ -(p:m) | My music folder path | C:\Users\UserName\Music\ -(p:v) | My videos folder path | C:\Users\UserName\Videos\ -(p:p) | My pictures path | C:\Users\UserName\Pictures\ -(f) | Input file name | Song -(o) | Output file format | mp3 -(i) | Input file format | wav -(d0) | Input parent folder name | Album -(d1) | Input sub parent folder name | Artist - -*Tips: You can use uppercase to retrieve caps lock informations. Example: (f) -> Default / (F) -> DEFAULT * - -### Examples - -Simple default template (just change the extension): - - Input: C:\Music\Artist\Album\Song.wav - Template: (p)(f) - Generated output: C:\Music\Artist\Album\Song.mp3 - -File name customization: - - Input: C:\Music\Artist\Album\Song.wav - Template: (p)(O)_(f) (from (i)) - Generated output: C:\Music\Artist\Album\MP3_Song (from wav).mp3 - -File path customization: - - Input: C:\Music\Artist\Album\Song.wav - Template: D:\(o)\(d1)\(f) - Generated output: D:\mp3\Artist\Song.mp3 - -CDA extraction: - - Input: E:\Track01.cda - Template: (p:m)CDA Extraction\(f) - Generated output: C:\Users\UserName\Music\CDA Extraction\Track01.mp3 - ## Thanks File converter uses the following middlewares: @@ -89,47 +30,7 @@ Thanks to Dave Kerr for his work on SharpShell. [CodePlex link](https://sharpshe **Ripper** and **yeti.mmedia** for CD Audio extraction. Thanks to Idael Cardoso for his work on CD Audio ripper. [Code project link](http://www.codeproject.com/Articles/5458/C-Sharp-Ripper) -## Change Log -### v0.4 -- New: Possibility to encode videos (mkv output file format) using H.264 video codec and AAC audio codec. -- New: Possibility to extract Audio CD content. -- New: Possibility to encode audio in aac format. -- New: Possibility to encode images (png, jpg and ico formats). -- New: Support new audio input file format: aac -- New: Support new video input file formats: bik, flv, mov, mkv -- New: Support new image input file formats: bmp, tiff, png, jpg and ico. -- New: Multi-thread conversion (file converter will now start multiple conversions at the time depending on your number of cores). -- New: Copy the currently selected preset when clicking on the add preset button. -- New: Add "My Documents", "My Music", "My Videos" and "My Pictures" folder to output file name generator. -- New: Possibily to chose if the application quit after succeeded conversions. -- Fixed: Reordering presets does not update the registry. -- Tech: Handle incorrect user settings case. -- Tech: Improve diagnostics system (compatibility with logs from multiple threads, dump files in AppData folder and error messages). -- Tech: Update ffmpeg version. +## License -### v0.3 -- New: Possibility to extract audio from videos. -- New: Support new input file formats: aiff, m4a, avi, mp4. -- New: Quality settings for Mp3 (Encoding mode vbr/cbr and bitrate). -- New: Quality settings for Ogg (Bitrate). -- New: Quality settings for Wav (bits per sample: 8, 16, 24 or 32). -- New: Add output file path template system. -- New: Add button to move up or down a preset. -- New: Add input files post conversion action (No action, move in archive folder or delete). -- New: Add categories on input file extensions. -- Fixed: Lose focus of main window don't terminate the application. -- Fixed: The application icon now have a correct resolution at any size. -- Tech: Add error codes on error messages. - -### v0.2 -- New: Support new input file format: ape. -- New: Add notion of conversion preset (in order to customize the conversion possibilities). -- New: Add settings window to edit conversion presets. -- New: Add application icon. -- New: Customize application installer. -- New: Add diagnostic window to read the application logs. - -### v0.1 -- New: Add decode support for file formats Mp3, Ogg, Wav, Flac, Wma -- New: Add encode support for file formats Mp3, Ogg, Wav, Flac -- New: UI to visualize the conversion progress \ No newline at end of file +File Converter is licensed under the GPL version 3 License. +For more informations check the LICENSE.md file in your installation folder or the [gnu website](http://www.gnu.org/licenses/gpl.html). From b6980780a8a6b061d73d2b21438fa1b0206e8537 Mon Sep 17 00:00:00 2001 From: Tichau Date: Mon, 21 Dec 2015 22:34:08 +0100 Subject: [PATCH 4/6] Correction of spell mistakes in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 568e10f..9993e2f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Category | Supported output formats | Compatible input formats File converter uses the following middlewares: **ffmpeg** as file conversion software. -Thanks to ffmpeg devs for this awesome open source file convesion tool. [Web site link](https://www.ffmpeg.org/) +Thanks to ffmpeg devs for this awesome open source file conversion tool. [Web site link](https://www.ffmpeg.org/) **SharpShell** to easily create windows context menu extensions. Thanks to Dave Kerr for his work on SharpShell. [CodePlex link](https://sharpshell.codeplex.com/) @@ -33,4 +33,4 @@ Thanks to Idael Cardoso for his work on CD Audio ripper. [Code project link](htt ## License File Converter is licensed under the GPL version 3 License. -For more informations check the LICENSE.md file in your installation folder or the [gnu website](http://www.gnu.org/licenses/gpl.html). +For more information check the LICENSE.md file in your installation folder or the [gnu website](http://www.gnu.org/licenses/gpl.html). From 07f2f9a2dd95fa81e96d6d5f93755036e18df3e0 Mon Sep 17 00:00:00 2001 From: Tichau Date: Mon, 21 Dec 2015 22:59:53 +0100 Subject: [PATCH 5/6] Merge user settings with default settings to prevent errors after installing a new version. --- Application/FileConverter/Application.xaml.cs | 18 ++--- Application/FileConverter/Settings.cs | 76 ++++++++++++------- Application/FileConverter/XmlHelpers.cs | 7 +- 3 files changed, 54 insertions(+), 47 deletions(-) diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs index 7e26bf5..eecada6 100644 --- a/Application/FileConverter/Application.xaml.cs +++ b/Application/FileConverter/Application.xaml.cs @@ -134,19 +134,11 @@ namespace FileConverter //System.Array.Resize(ref args, 2); //args[1] = "--settings"; - //System.Array.Resize(ref args, 5); - //args[1] = "--conversion-preset"; - //args[2] = "To Flac"; - //args[3] = "--verbose"; - //args[4] = @"D:\Test\02 - Corn on the Cob.mp3"; - - //System.Array.Resize(ref args, 6); - //args[1] = "--conversion-preset"; - //args[2] = "Extract CDA To Ogg"; - //args[3] = "--verbose"; - - //args[4] = @"E:\Track01.cda"; - //args[5] = @"E:\Track02.cda"; + System.Array.Resize(ref args, 5); + args[1] = "--conversion-preset"; + args[2] = "To Aac"; + args[3] = "--verbose"; + args[4] = @"D:\Test\02 - Corn on the Cob.flac"; } #endif diff --git a/Application/FileConverter/Settings.cs b/Application/FileConverter/Settings.cs index 5f56b36..833a59d 100644 --- a/Application/FileConverter/Settings.cs +++ b/Application/FileConverter/Settings.cs @@ -4,7 +4,6 @@ namespace FileConverter { using System; using System.Collections.Generic; - using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.IO; @@ -71,8 +70,8 @@ namespace FileConverter return; } - Settings settings = new Settings(); - XmlHelpers.LoadFromFile("Settings", temporaryFilePath, ref settings); + Settings settings = null; + XmlHelpers.LoadFromFile("Settings", temporaryFilePath, out settings); RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(@"Software\FileConverter"); if (registryKey == null) @@ -97,13 +96,33 @@ namespace FileConverter public static Settings Load() { - Settings settings = new Settings(); + Settings defaultSettings = null; + + // Load the default settings. + string defaultFilePath = Settings.GetDefaultSettingsFilePath(); + if (File.Exists(defaultFilePath)) + { + try + { + XmlHelpers.LoadFromFile("Settings", defaultFilePath, out defaultSettings); + } + catch (Exception exception) + { + Diagnostics.Debug.LogError("Fail to load file converter default settings. {0}", exception.Message); + } + } + else + { + Diagnostics.Debug.LogError("Default settings not found at path {0}. You should try to reinstall the application.", defaultFilePath); + } + + Settings userSettings = null; string userFilePath = Settings.GetUserSettingsFilePath(); if (File.Exists(userFilePath)) { try { - XmlHelpers.LoadFromFile("Settings", userFilePath, ref settings); + XmlHelpers.LoadFromFile("Settings", userFilePath, out userSettings); } catch (Exception exception) { @@ -119,33 +138,13 @@ namespace FileConverter } } - if (settings.SerializationVersion != Version) + if (userSettings != null && userSettings.SerializationVersion != Version) { - Diagnostics.Debug.Log("File converter settings has been imported from version {0} to version {1}.", settings.SerializationVersion, Version); - } - } - else - { - // If user settings doesn't exist, load the default settings. - string defaultFilePath = Settings.GetDefaultSettingsFilePath(); - if (File.Exists(defaultFilePath)) - { - try - { - XmlHelpers.LoadFromFile("Settings", defaultFilePath, ref settings); - } - catch (Exception exception) - { - Diagnostics.Debug.LogError("Fail to load file converter default settings. {0}", exception.Message); - } - } - else - { - Diagnostics.Debug.LogError("Default settings not found at path {0}. You should try to reinstall the application.", defaultFilePath); + Diagnostics.Debug.Log("File converter settings has been imported from version {0} to version {1}.", userSettings.SerializationVersion, Version); } } - return settings; + return userSettings != null ? userSettings.Merge(defaultSettings) : defaultSettings; } public ConversionPreset GetPresetFromName(string presetName) @@ -404,5 +403,26 @@ namespace FileConverter { this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + + private Settings Merge(Settings settings) + { + if (settings == null) + { + return this; + } + + for (int index = 0; index < settings.conversionPresets.Count; index++) + { + ConversionPreset conversionPreset = settings.conversionPresets[index]; + if (this.conversionPresets.Any(match => match.Name == conversionPreset.Name)) + { + continue; + } + + this.conversionPresets.Add(conversionPreset); + } + + return this; + } } } diff --git a/Application/FileConverter/XmlHelpers.cs b/Application/FileConverter/XmlHelpers.cs index 09e7c49..b33b337 100644 --- a/Application/FileConverter/XmlHelpers.cs +++ b/Application/FileConverter/XmlHelpers.cs @@ -10,18 +10,13 @@ namespace FileConverter public class XmlHelpers { - public static void LoadFromFile(string root, string path, ref T deserializedObject) + public static void LoadFromFile(string root, string path, out T deserializedObject) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } - if (deserializedObject == null) - { - throw new ArgumentNullException("deserializedObject"); - } - XmlRootAttribute xmlRoot = new XmlRootAttribute { ElementName = root From 36792c31ab56a5481cb1299ca8afde6dd343fb8d Mon Sep 17 00:00:00 2001 From: Tichau Date: Mon, 21 Dec 2015 23:05:28 +0100 Subject: [PATCH 6/6] Update change log --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 867b6a7..a14655c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,9 @@ - New: Multi-thread conversion (file converter will now start multiple conversions at the time depending on your number of cores). - New: Copy the currently selected preset when clicking on the add preset button. - New: Add "My Documents", "My Music", "My Videos" and "My Pictures" folder to output file name generator. -- New: Possibily to chose if the application quit after succeeded conversions. +- New: Possibility to choose if the application quit after succeeded conversions. - Fixed: Reordering presets does not update the registry. +- Fixed: Merge default settings with user settings to prevent errors when upgrading the application. - Tech: Handle incorrect user settings case. - Tech: Improve diagnostics system (compatibility with logs from multiple threads, dump files in AppData folder and error messages). - Tech: Update ffmpeg version.