From 64f9f6672419845b34ed94e85fa57a3766db293c Mon Sep 17 00:00:00 2001 From: Tichau Date: Tue, 12 Jan 2016 08:34:19 +0100 Subject: [PATCH] Cleaning and stylecop --- Application/FileConverter/Application.xaml.cs | 9 ++++----- .../ConversionJobs/ConversionJob_FFMPEG.cs | 12 ++++++++++-- Application/FileConverter/Diagnostics/Debug.cs | 8 +++----- .../FileConverter/Diagnostics/DiagnosticsData.cs | 9 ++++----- .../ValueConverters/FileNameConverter.cs | 8 ++++---- .../ValueConverters/Generic/FormatStringConverter.cs | 2 +- Application/FileConverter/XmlHelpers.cs | 2 +- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs index 4794249..457fd59 100644 --- a/Application/FileConverter/Application.xaml.cs +++ b/Application/FileConverter/Application.xaml.cs @@ -24,7 +24,6 @@ namespace FileConverter using FileConverter.ConversionJobs; using FileConverter.Diagnostics; - using FileConverter.Upgrade; using FileConverter.Windows; public partial class Application : System.Windows.Application @@ -174,7 +173,7 @@ namespace FileConverter #if (DEBUG) if (args.Length <= 1) { - System.Array.Resize(ref args, 8); + //System.Array.Resize(ref args, 8); //args[1] = "--conversion-preset"; //args[2] = "To Ogg"; //args[3] = "--verbose"; @@ -187,14 +186,14 @@ namespace FileConverter //args[6] = @"D:\Test\Track03.mp3"; //args[7] = @"D:\Test\Track04.mp3"; - System.Array.Resize(ref args, 1); + System.Array.Resize(ref args, 2); args[1] = "--settings"; //System.Array.Resize(ref args, 5); //args[1] = "--conversion-preset"; - //args[2] = "To Wav"; + //args[2] = "To Jpg"; //args[3] = "--verbose"; - //args[4] = @"D:\Test\Track01.mp3"; + //args[4] = @"D:\Test\Test avec accents héhé\imagé.png"; } #endif diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs index 87e1b6e..5f21fab 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs @@ -28,6 +28,15 @@ namespace FileConverter.ConversionJobs { } + protected virtual string FfmpegPath + { + get + { + string applicationDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + return System.IO.Path.Combine(applicationDirectory, "ffmpeg.exe"); + } + } + protected override void Initialize() { base.Initialize(); @@ -39,8 +48,7 @@ namespace FileConverter.ConversionJobs this.ffmpegProcessStartInfo = null; - string applicationDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); - string ffmpegPath = string.Format("{0}\\ffmpeg.exe", applicationDirectory); + string ffmpegPath = this.FfmpegPath; if (!System.IO.File.Exists(ffmpegPath)) { this.ConversionFailed("Can't find ffmpeg executable. You should try to reinstall the application."); diff --git a/Application/FileConverter/Diagnostics/Debug.cs b/Application/FileConverter/Diagnostics/Debug.cs index 30ea220..779cab6 100644 --- a/Application/FileConverter/Diagnostics/Debug.cs +++ b/Application/FileConverter/Diagnostics/Debug.cs @@ -1,6 +1,5 @@ // License: http://www.gnu.org/licenses/gpl.html GPL version 3. -using System.Linq; namespace FileConverter.Diagnostics { @@ -9,7 +8,7 @@ namespace FileConverter.Diagnostics using System.ComponentModel; using System.Diagnostics; using System.IO; - using System.Text; + using System.Linq; using System.Windows; public static class Debug @@ -18,8 +17,6 @@ namespace FileConverter.Diagnostics private static Dictionary diagnosticsDataById = new Dictionary(); private static int threadCount = 0; - public static event EventHandler StaticPropertyChanged; - static Debug() { string path = PathHelpers.GetUserDataFolderPath(); @@ -42,6 +39,8 @@ namespace FileConverter.Diagnostics Directory.CreateDirectory(Debug.diagnosticsFolderPath); } + public static event EventHandler StaticPropertyChanged; + public static DiagnosticsData[] Data { get @@ -91,6 +90,5 @@ namespace FileConverter.Diagnostics Debug.diagnosticsDataById.Clear(); } - } } diff --git a/Application/FileConverter/Diagnostics/DiagnosticsData.cs b/Application/FileConverter/Diagnostics/DiagnosticsData.cs index ce6fa59..ac2efc6 100644 --- a/Application/FileConverter/Diagnostics/DiagnosticsData.cs +++ b/Application/FileConverter/Diagnostics/DiagnosticsData.cs @@ -1,14 +1,13 @@ // License: http://www.gnu.org/licenses/gpl.html GPL version 3. -using System.Collections.ObjectModel; - namespace FileConverter.Diagnostics { using System.Collections.Generic; + using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; - using System.Text; using System.Runtime.CompilerServices; + using System.Text; using FileConverter.Annotations; @@ -19,14 +18,14 @@ namespace FileConverter.Diagnostics private System.IO.TextWriter logFileWriter; private string name; - public event PropertyChangedEventHandler PropertyChanged; - public DiagnosticsData(string name) { this.Name = name; this.LogMessages = new ReadOnlyCollection(this.logMessages); } + public event PropertyChangedEventHandler PropertyChanged; + public string Name { get diff --git a/Application/FileConverter/ValueConverters/FileNameConverter.cs b/Application/FileConverter/ValueConverters/FileNameConverter.cs index eb4dbe9..b348b1c 100644 --- a/Application/FileConverter/ValueConverters/FileNameConverter.cs +++ b/Application/FileConverter/ValueConverters/FileNameConverter.cs @@ -62,19 +62,19 @@ namespace FileConverter.ValueConverters outputPath = outputPath.Replace("(i)", inputExtension); outputPath = outputPath.Replace("(I)", inputExtension.ToUpperInvariant()); - string myDocumentsFolder = System.Environment.GetFolderPath((System.Environment.SpecialFolder.MyDocuments)) + "\\"; + string myDocumentsFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "\\"; outputPath = outputPath.Replace("(p:d)", myDocumentsFolder); outputPath = outputPath.Replace("(p:documents)", myDocumentsFolder); - string myMusicFolder = System.Environment.GetFolderPath((System.Environment.SpecialFolder.MyMusic)) + "\\"; + string myMusicFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyMusic) + "\\"; outputPath = outputPath.Replace("(p:m)", myMusicFolder); outputPath = outputPath.Replace("(p:music)", myMusicFolder); - string myVideoFolder = System.Environment.GetFolderPath((System.Environment.SpecialFolder.MyVideos)) + "\\"; + string myVideoFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos) + "\\"; outputPath = outputPath.Replace("(p:v)", myVideoFolder); outputPath = outputPath.Replace("(p:videos)", myVideoFolder); - string myPictureFolder = System.Environment.GetFolderPath((System.Environment.SpecialFolder.MyPictures)) + "\\"; + string myPictureFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures) + "\\"; outputPath = outputPath.Replace("(p:p)", myPictureFolder); outputPath = outputPath.Replace("(p:pictures)", myPictureFolder); diff --git a/Application/FileConverter/ValueConverters/Generic/FormatStringConverter.cs b/Application/FileConverter/ValueConverters/Generic/FormatStringConverter.cs index 020814c..d2282e5 100644 --- a/Application/FileConverter/ValueConverters/Generic/FormatStringConverter.cs +++ b/Application/FileConverter/ValueConverters/Generic/FormatStringConverter.cs @@ -1,4 +1,4 @@ -// License: http://www.gnu.org/licenses/gpl.html GPL version 3. +// License: http://www.gnu.org/licenses/gpl.html GPL version 3. namespace FileConverter.ValueConverters.Generic { diff --git a/Application/FileConverter/XmlHelpers.cs b/Application/FileConverter/XmlHelpers.cs index b33b337..14c1d18 100644 --- a/Application/FileConverter/XmlHelpers.cs +++ b/Application/FileConverter/XmlHelpers.cs @@ -40,7 +40,7 @@ namespace FileConverter } } } - catch (System.Exception exception) + catch (System.Exception) { throw; }