diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs
index bd058a4..eb1b162 100644
--- a/Application/FileConverter/Application.xaml.cs
+++ b/Application/FileConverter/Application.xaml.cs
@@ -13,6 +13,8 @@
You should have received a copy of the GNU General Public License along with this program. If not, see .
*/
+using System.Diagnostics;
+
namespace FileConverter
{
using System;
@@ -22,6 +24,7 @@ namespace FileConverter
using System.Windows;
using FileConverter.ConversionJobs;
+ using FileConverter.Diagnostics;
public partial class Application : System.Windows.Application
{
@@ -90,36 +93,48 @@ namespace FileConverter
private void Initialize()
{
// Load settigns.
- Diagnostics.Log("Retrieve arguments...");
+ Debug.Log("Load settings...");
this.Settings = new Settings();
this.Settings.Load();
// Retrieve arguments.
- Diagnostics.Log("Retrieve arguments...");
+ Debug.Log("Retrieve arguments...");
string[] args = Environment.GetCommandLineArgs();
#if (DEBUG)
if (args.Length <= 1)
{
this.debugMode = true;
- System.Array.Resize(ref args, 5);
+ System.Array.Resize(ref args, 8);
args[1] = "--conversion-preset";
- args[2] = "To Mp3";
+ args[2] = "To Ogg";
args[3] = "--verbose";
- args[4] = @"D:\Test\10 - Get around town (lp version).ogg";
+
+ args[4] = @"D:\Test\TrailerV2 compressed.mkv";
+ args[4] = @"D:\Test\image.png";
+ args[4] = @"E:\Track01.cda";
+ args[4] = @"D:\Test\Track01.mp3";
+ args[5] = @"D:\Test\Track02.mp3";
+ args[6] = @"D:\Test\Track03.mp3";
+ args[7] = @"D:\Test\Track04.mp3";
- System.Array.Resize(ref args, 2);
- args[1] = "--settings";
+ //System.Array.Resize(ref args, 2);
+ //args[1] = "--settings";
+
+ //System.Array.Resize(ref args, 4);
+ //args[1] = "--conversion-preset";
+ //args[2] = "To Ogg";
+ //args[3] = "--verbose";
}
#endif
for (int index = 0; index < args.Length; index++)
{
string argument = args[index];
- Diagnostics.Log("Arg{0}: {1}", index, argument);
+ Debug.Log("Arg{0}: {1}", index, argument);
}
- Diagnostics.Log(string.Empty);
+ Debug.Log(string.Empty);
ConversionPreset conversionPreset = null;
List filePaths = new List();
@@ -147,15 +162,15 @@ namespace FileConverter
case "conversion-preset":
if (index >= args.Length - 1)
{
- MessageBox.Show(string.Format("Invalid format. (code 0x01)"), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ Debug.LogError("Invalid format. (code 0x01)");
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
return;
}
- conversionPreset = Settings.GetPresetFromName(args[index + 1]);
+ conversionPreset = this.Settings.GetPresetFromName(args[index + 1]);
if (conversionPreset == null)
{
- MessageBox.Show(string.Format("Invalid conversion preset '{0}'. (code 0x02)", args[index + 1]), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ Debug.LogError("Invalid conversion preset '{0}'. (code 0x02)", args[index + 1]);
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
return;
}
@@ -171,7 +186,7 @@ namespace FileConverter
break;
default:
- Diagnostics.Log("ERROR ! Unknown option {0}.", parameterTitle);
+ Debug.LogError("Unknown option {0}.", parameterTitle);
return;
}
}
@@ -183,23 +198,41 @@ namespace FileConverter
if (conversionPreset == null)
{
- Diagnostics.Log("ERROR ! Can't retrieve the conversion preset from arguments.");
+ Debug.LogError("Can't retrieve the conversion preset from arguments.");
return;
}
// Create convertion jobs.
- for (int index = 0; index < filePaths.Count; index++)
+ Debug.Log("Create jobs for conversion preset: '{0}'", conversionPreset.Name);
+ try
{
- string inputFilePath = filePaths[index];
- ConversionJob conversionJob = ConversionJobFactory.Create(conversionPreset);
- conversionJob.PrepareConversion(inputFilePath);
+ for (int index = 0; index < filePaths.Count; index++)
+ {
+ string inputFilePath = filePaths[index];
+ ConversionJob conversionJob = ConversionJobFactory.Create(conversionPreset, inputFilePath);
+ conversionJob.PrepareConversion(inputFilePath);
- this.conversionJobs.Add(conversionJob);
+ this.conversionJobs.Add(conversionJob);
+ }
+ }
+ catch (Exception exception)
+ {
+ Debug.LogError(exception.Message);
+ throw;
}
this.initialized = true;
}
+ protected override void OnExit(ExitEventArgs e)
+ {
+ base.OnExit(e);
+
+ Debug.Log("Exit application.");
+
+ Debug.Release();
+ }
+
private void ConvertFiles()
{
for (int index = 0; index < this.conversionJobs.Count; index++)
@@ -214,15 +247,15 @@ namespace FileConverter
if (System.IO.File.Exists(conversionJob.OutputFilePath))
{
- Diagnostics.Log("Success!");
+ Debug.Log("Success!");
}
else
{
- Diagnostics.Log("Fail!");
+ Debug.Log("Fail!");
}
}
- Diagnostics.Log("End of job queue.");
+ Debug.Log("End of job queue.");
#if !DEBUG
bool allConversionsSucceed = true;
@@ -233,6 +266,7 @@ namespace FileConverter
if (allConversionsSucceed)
{
+ Debug.Log("All conversions succeed.");
System.Threading.Thread.Sleep(3000);
if (this.cancelAutoExit)
diff --git a/Application/FileConverter/ConversionJobs/ConversionJob.cs b/Application/FileConverter/ConversionJobs/ConversionJob.cs
index baf214a..ce07bcc 100644
--- a/Application/FileConverter/ConversionJobs/ConversionJob.cs
+++ b/Application/FileConverter/ConversionJobs/ConversionJob.cs
@@ -7,6 +7,8 @@ namespace FileConverter.ConversionJobs
using System.Runtime.CompilerServices;
using System.Text;
+ using FileConverter.Diagnostics;
+
public class ConversionJob : INotifyPropertyChanged
{
private float progress = 0f;
@@ -159,7 +161,7 @@ namespace FileConverter.ConversionJobs
if (!PathHelpers.IsPathValid(this.OutputFilePath))
{
this.ConversionFailed("Invalid output path generated by output file path template.");
- Diagnostics.Log(string.Format("Invalid output path generated: {0} from input: {1}.", this.OutputFilePath, this.InputFilePath));
+ Debug.Log(string.Format("Invalid output path generated: {0} from input: {1}.", this.OutputFilePath, this.InputFilePath));
return;
}
@@ -193,7 +195,7 @@ namespace FileConverter.ConversionJobs
catch (Exception)
{
this.ConversionFailed("Invalid output path generated by output file path template.");
- Diagnostics.Log(string.Format("Can't create directories for path {0}", this.OutputFilePath));
+ Debug.Log(string.Format("Can't create directories for path {0}", this.OutputFilePath));
return;
}
}
@@ -208,10 +210,10 @@ namespace FileConverter.ConversionJobs
catch (Exception exception)
{
this.ConversionFailed("Can't generate a valid output filename.");
- Diagnostics.Log(exception.Message);
+ Debug.Log(exception.Message);
return;
}
-
+
this.Initialize();
if (this.State == ConversionState.Unknown)
@@ -219,6 +221,8 @@ namespace FileConverter.ConversionJobs
this.State = ConversionState.Ready;
}
+ Debug.Log("Job initialized: Preset: '{0}' Input: {1} Output: {2}", this.ConversionPreset.Name, this.InputFilePath, this.OutputFilePath);
+
this.UserState = "In Queue";
}
@@ -234,7 +238,7 @@ namespace FileConverter.ConversionJobs
throw new Exception("Invalid conversion state.");
}
- Diagnostics.Log("Convert file {0} to {1}.", this.InputFilePath, this.OutputFilePath);
+ Debug.Log("Convert file {0} to {1}.", this.InputFilePath, this.OutputFilePath);
this.State = ConversionState.InProgress;
@@ -256,7 +260,7 @@ namespace FileConverter.ConversionJobs
protected virtual void OnConversionSucceed()
{
- Diagnostics.Log("Conversion Succeed!");
+ Debug.Log("Conversion Succeed!");
// Apply the input post conversion action.
switch (this.InputPostConversionAction)
@@ -275,21 +279,21 @@ namespace FileConverter.ConversionJobs
string newPath = PathHelpers.GenerateUniquePath(archivePath + "\\" + inputFilename);
System.IO.File.Move(this.InputFilePath, newPath);
- Diagnostics.Log("Input file moved in archive folder: '{0}'", newPath);
+ Debug.Log("Input file moved in archive folder: '{0}'", newPath);
break;
case InputPostConversionAction.Delete:
System.IO.File.Delete(this.InputFilePath);
- Diagnostics.Log("Input file deleted: '{0}'", this.initialInputPath);
+ Debug.Log("Input file deleted: '{0}'", this.initialInputPath);
break;
}
- Diagnostics.Log(string.Empty);
+ Debug.Log(string.Empty);
this.Progress = 1f;
this.State = ConversionState.Done;
this.UserState = "Done";
- Diagnostics.Log("Conversion Done!");
+ Debug.Log("Conversion Done!");
}
protected void ConversionFailed(string exitingMessage)
diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs b/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs
index 9479eb2..8cea5e0 100644
--- a/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs
+++ b/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs
@@ -11,6 +11,8 @@ namespace FileConverter.ConversionJobs
using WaveLib;
using Yeti.MMedia;
+ using FileConverter.Diagnostics;
+
public class ConversionJob_ExtractCDA : ConversionJob
{
private Ripper.CDDrive cdDrive;
@@ -112,7 +114,7 @@ namespace FileConverter.ConversionJobs
throw new Exception("The conversion preset must be valid.");
}
- Diagnostics.Log("Starting CDA extraction.");
+ Debug.Log("Starting CDA extraction.");
this.UserState = "Extraction";
@@ -154,9 +156,9 @@ namespace FileConverter.ConversionJobs
return;
}
- Diagnostics.Log("CDA extracted to {0}.", this.intermediateFilePath);
- Diagnostics.Log(string.Empty);
- Diagnostics.Log("Start compression.");
+ Debug.Log("CDA extracted to {0}.", this.intermediateFilePath);
+ Debug.Log(string.Empty);
+ Debug.Log("Start compression.");
this.UserState = "Conversion";
@@ -174,8 +176,8 @@ namespace FileConverter.ConversionJobs
return;
}
- Diagnostics.Log(string.Empty);
- Diagnostics.Log("Delete intermediate file {0}.", this.intermediateFilePath);
+ Debug.Log(string.Empty);
+ Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath);
File.Delete(this.intermediateFilePath);
}
diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs
index dc649d6..54f68f6 100644
--- a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs
+++ b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs
@@ -100,7 +100,7 @@ namespace FileConverter.ConversionJobs
return -2;
}
- throw new Exception("Unknown VBR bitrate.");
+ throw new Exception("Unknown Ogg VBR bitrate.");
}
///
diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs
index fe3ba3e..cb3b3d1 100644
--- a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs
+++ b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs
@@ -7,6 +7,8 @@ namespace FileConverter.ConversionJobs
using System.IO;
using System.Text.RegularExpressions;
+ using FileConverter.Diagnostics;
+
public partial class ConversionJob_FFMPEG : ConversionJob
{
private readonly Regex durationRegex = new Regex(@"Duration:\s*([0-9][0-9]):([0-9][0-9]):([0-9][0-9])\.([0-9][0-9]),.*bitrate:\s*([0-9]+) kb\/s");
@@ -41,7 +43,7 @@ namespace FileConverter.ConversionJobs
if (!System.IO.File.Exists(ffmpegPath))
{
this.ConversionFailed("Can't find ffmpeg executable. You should try to reinstall the application.");
- Diagnostics.Log("Can't find ffmpeg executable ({0}). Try to reinstall the application.", ffmpegPath);
+ Diagnostics.Debug.Log("Can't find ffmpeg executable ({0}). Try to reinstall the application.", ffmpegPath);
return;
}
@@ -166,8 +168,8 @@ namespace FileConverter.ConversionJobs
this.UserState = "Conversion";
- Diagnostics.Log("Execute command: {0} {1}.", this.ffmpegProcessStartInfo.FileName, this.ffmpegProcessStartInfo.Arguments);
- Diagnostics.Log(string.Empty);
+ Diagnostics.Debug.Log("Execute command: {0} {1}.", this.ffmpegProcessStartInfo.FileName, this.ffmpegProcessStartInfo.Arguments);
+ Diagnostics.Debug.Log(string.Empty);
try
{
@@ -181,7 +183,7 @@ namespace FileConverter.ConversionJobs
this.ParseFFMPEGOutput(result);
- Diagnostics.Log("ffmpeg output: {0}", result);
+ Diagnostics.Debug.Log("ffmpeg output: {0}", result);
}
}
diff --git a/Application/FileConverter/Diagnostics.cs b/Application/FileConverter/Diagnostics.cs
deleted file mode 100644
index a500c6c..0000000
--- a/Application/FileConverter/Diagnostics.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// License: http://www.gnu.org/licenses/gpl.html GPL version 3.
-
-namespace FileConverter
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Text;
-
- public static class Diagnostics
- {
- private static List logMessages = new List();
- private static StringBuilder workingStringBuilder = new StringBuilder();
-
- public static event EventHandler StaticPropertyChanged;
-
- public static string Content
- {
- get
- {
- workingStringBuilder.Clear();
- for (int index = 0; index < logMessages.Count; index++)
- {
- workingStringBuilder.AppendLine(logMessages[index]);
- }
-
- return workingStringBuilder.ToString();
- }
- }
-
- public static void Log(string message, params object[] arguments)
- {
- Diagnostics.logMessages.Add(string.Format(message, arguments));
-
- if (StaticPropertyChanged != null)
- {
- StaticPropertyChanged(null, new PropertyChangedEventArgs("Content"));
- }
- }
- }
-}
diff --git a/Application/FileConverter/Diagnostics/Debug.cs b/Application/FileConverter/Diagnostics/Debug.cs
new file mode 100644
index 0000000..acb0b4f
--- /dev/null
+++ b/Application/FileConverter/Diagnostics/Debug.cs
@@ -0,0 +1,120 @@
+// License: http://www.gnu.org/licenses/gpl.html GPL version 3.
+
+namespace FileConverter.Diagnostics
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Text;
+ using System.Threading;
+ using System.Windows;
+
+ public static class Debug
+ {
+ private static StringBuilder workingStringBuilder = new StringBuilder();
+ private static string diagnosticsFolderPath;
+ private static Dictionary diagnosticsDataById = new Dictionary();
+ private static int threadCount = 0;
+
+ public static event EventHandler StaticPropertyChanged;
+
+ static Debug()
+ {
+ string path = PathHelpers.GetUserDataFolderPath();
+
+ // Delete old diagnostics folder.
+ DateTime expirationDate = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0));
+ string[] diagnosticsDirectories = Directory.GetDirectories(path, "Diagnostics.*");
+ for (int index = 0; index < diagnosticsDirectories.Length; index++)
+ {
+ string directory = diagnosticsDirectories[index];
+ DateTime creationTime = Directory.GetCreationTime(directory);
+ if (creationTime < expirationDate)
+ {
+ Directory.Delete(directory, true);
+ }
+ }
+
+ Debug.diagnosticsFolderPath = Path.Combine(path, "Diagnostics." + Process.GetCurrentProcess().Id);
+ Debug.diagnosticsFolderPath = PathHelpers.GenerateUniquePath(Debug.diagnosticsFolderPath);
+ Directory.CreateDirectory(Debug.diagnosticsFolderPath);
+ }
+
+ public static IEnumerable Data
+ {
+ get
+ {
+ return Debug.diagnosticsDataById.Values;
+ }
+ }
+
+ public static string Content
+ {
+ get
+ {
+ DiagnosticsData diagnosticsData;
+ int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
+ if (!Debug.diagnosticsDataById.TryGetValue(threadId, out diagnosticsData))
+ {
+ return string.Empty;
+ }
+
+ workingStringBuilder.Clear();
+ foreach (string logMessage in diagnosticsData.LogMessages)
+ {
+ workingStringBuilder.AppendLine(logMessage);
+ }
+
+ return workingStringBuilder.ToString();
+ }
+ }
+
+ public static void Log(string message, params object[] arguments)
+ {
+ DiagnosticsData diagnosticsData;
+
+ int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
+ lock (Debug.diagnosticsDataById)
+ {
+ if (!Debug.diagnosticsDataById.TryGetValue(threadId, out diagnosticsData))
+ {
+ diagnosticsData = new DiagnosticsData(Debug.threadCount > 0 ? string.Format("Thread {0}", Debug.threadCount) : "Application");
+ diagnosticsData.Initialize(Debug.diagnosticsFolderPath, threadId);
+ Debug.diagnosticsDataById.Add(threadId, diagnosticsData);
+ Debug.threadCount++;
+ }
+ }
+
+ diagnosticsData.Log(message, arguments);
+
+ if (StaticPropertyChanged != null)
+ {
+ StaticPropertyChanged(null, new PropertyChangedEventArgs("Content"));
+ }
+ }
+
+ public static void LogError(string message, params object[] arguments)
+ {
+ string log = string.Format(message, arguments);
+
+ MessageBox.Show(log, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+
+ Debug.Log("Error: " + message, arguments);
+ }
+
+ public static void Release()
+ {
+ Debug.Log("Diagnostics manager released correctly.");
+
+ foreach (KeyValuePair kvp in Debug.diagnosticsDataById)
+ {
+ kvp.Value.Release();
+ }
+
+ Debug.diagnosticsDataById.Clear();
+ }
+
+ }
+}
diff --git a/Application/FileConverter/Diagnostics/DiagnosticsData.cs b/Application/FileConverter/Diagnostics/DiagnosticsData.cs
new file mode 100644
index 0000000..2c8b2d1
--- /dev/null
+++ b/Application/FileConverter/Diagnostics/DiagnosticsData.cs
@@ -0,0 +1,100 @@
+// License: http://www.gnu.org/licenses/gpl.html GPL version 3.
+
+using System.Collections.ObjectModel;
+
+namespace FileConverter.Diagnostics
+{
+ using System.Collections.Generic;
+ using System.ComponentModel;
+ using System.IO;
+ using System.Text;
+ using System.Runtime.CompilerServices;
+
+ using FileConverter.Annotations;
+
+ public class DiagnosticsData : INotifyPropertyChanged
+ {
+ private List logMessages = new List();
+ private StringBuilder stringBuilder = new StringBuilder();
+ 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 string Name
+ {
+ get
+ {
+ return this.name;
+ }
+
+ private set
+ {
+ this.name = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ public string Content
+ {
+ get
+ {
+ this.stringBuilder.Clear();
+ foreach (string logMessage in this.LogMessages)
+ {
+ this.stringBuilder.AppendLine(logMessage);
+ }
+
+ return this.stringBuilder.ToString();
+ }
+ }
+
+ public ReadOnlyCollection LogMessages
+ {
+ get;
+ private set;
+ }
+
+ public void Initialize(string diagnosticsFolderPath, int id)
+ {
+ string path = Path.Combine(diagnosticsFolderPath, string.Format("Diagnostics{0}.log", id));
+ path = PathHelpers.GenerateUniquePath(path);
+ this.logFileWriter = new StreamWriter(File.Open(path, FileMode.Create));
+
+ this.Log("{0} {1}\n", System.DateTime.Now.ToLongDateString(), System.DateTime.Now.ToLongTimeString());
+ }
+
+ public void Release()
+ {
+ this.logFileWriter.Close();
+ this.logFileWriter = null;
+ }
+
+ public void Log(string message, params object[] arguments)
+ {
+ string log = string.Format(message, arguments);
+
+ this.logMessages.Add(log);
+ this.logFileWriter.WriteLine(log);
+ this.logFileWriter.Flush();
+
+ this.OnPropertyChanged("Content");
+ }
+
+ [NotifyPropertyChangedInvocator]
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler handler = this.PropertyChanged;
+ if (handler != null)
+ {
+ handler(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Application/FileConverter/FileConverter.csproj b/Application/FileConverter/FileConverter.csproj
index 64a6a23..2c91e0e 100644
--- a/Application/FileConverter/FileConverter.csproj
+++ b/Application/FileConverter/FileConverter.csproj
@@ -89,6 +89,7 @@
+
@@ -143,7 +144,7 @@
-
+
MainWindow.xaml
Code
diff --git a/Application/FileConverter/PathHelpers.cs b/Application/FileConverter/PathHelpers.cs
index b5e6110..ab11284 100644
--- a/Application/FileConverter/PathHelpers.cs
+++ b/Application/FileConverter/PathHelpers.cs
@@ -135,6 +135,19 @@ namespace FileConverter
}
}
+ public static string GetUserDataFolderPath()
+ {
+ string path = System.Environment.GetEnvironmentVariable("LocalAppData");
+ path = System.IO.Path.Combine(path, "FileConverter");
+
+ if (!System.IO.Directory.Exists(path))
+ {
+ System.IO.Directory.CreateDirectory(path);
+ }
+
+ return path;
+ }
+
public static class InputCategoryNames
{
public const string Audio = "Audio";
diff --git a/Application/FileConverter/Settings.cs b/Application/FileConverter/Settings.cs
index d749387..7c7d17d 100644
--- a/Application/FileConverter/Settings.cs
+++ b/Application/FileConverter/Settings.cs
@@ -14,9 +14,11 @@ namespace FileConverter
using System.Security.Principal;
using System.Windows;
- using FileConverter.Annotations;
using Microsoft.Win32;
+ using FileConverter.Annotations;
+ using FileConverter.Diagnostics;
+
public class Settings : INotifyPropertyChanged, IDataErrorInfo
{
private const char PresetSeparator = ';';
@@ -122,7 +124,7 @@ namespace FileConverter
}
else
{
- Diagnostics.Log("Default settings not found. You should try to reinstall the application.");
+ Diagnostics.Debug.Log("Default settings not found. You should try to reinstall the application.");
}
}
}
@@ -220,7 +222,7 @@ namespace FileConverter
}
catch (Exception exception)
{
- Diagnostics.Log(exception.Message);
+ Diagnostics.Debug.Log(exception.Message);
}
if (subKey == null)
@@ -273,28 +275,14 @@ namespace FileConverter
private static string GetUserSettingsFilePath()
{
- string path = Environment.GetEnvironmentVariable("LocalAppData");
- path = Path.Combine(path, "FileConverter");
-
- if (!Directory.Exists(path))
- {
- Directory.CreateDirectory(path);
- }
-
+ string path = PathHelpers.GetUserDataFolderPath();
path = Path.Combine(path, "Settings.user.xml");
return path;
}
private static string GetUserSettingsTemporaryFilePath()
{
- string path = Environment.GetEnvironmentVariable("LocalAppData");
- path = Path.Combine(path, "FileConverter");
-
- if (!Directory.Exists(path))
- {
- Directory.CreateDirectory(path);
- }
-
+ string path = PathHelpers.GetUserDataFolderPath();
path = Path.Combine(path, "Settings.temp.xml");
return path;
}
diff --git a/Application/FileConverter/Windows/DiagnosticsWindow.xaml b/Application/FileConverter/Windows/DiagnosticsWindow.xaml
index b433847..b4891e9 100644
--- a/Application/FileConverter/Windows/DiagnosticsWindow.xaml
+++ b/Application/FileConverter/Windows/DiagnosticsWindow.xaml
@@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FileConverter.Windows"
xmlns:fileConverter="clr-namespace:FileConverter"
+ xmlns:diagnostics="clr-namespace:FileConverter.Diagnostics"
mc:Ignorable="d"
Title="Diagnostics" Height="600" Width="800" Icon="/FileConverter;component/Resources/ApplicationIcon.ico">
@@ -13,8 +14,20 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Application/FileConverter/XmlHelpers.cs b/Application/FileConverter/XmlHelpers.cs
index 1ef96c3..4483694 100644
--- a/Application/FileConverter/XmlHelpers.cs
+++ b/Application/FileConverter/XmlHelpers.cs
@@ -52,7 +52,7 @@ namespace FileConverter
}
catch (System.Exception exception)
{
- Diagnostics.Log("The database of type '" + typeof(T) + "' failed to load the asset. The following exception was raised:\n " + exception.Message);
+ Diagnostics.Debug.Log("The database of type '" + typeof(T) + "' failed to load the asset. The following exception was raised:\n " + exception.Message);
}
}
@@ -90,7 +90,7 @@ namespace FileConverter
}
catch (System.Exception exception)
{
- Diagnostics.Log("The database of type '" + typeof(T) + "' failed to load the asset. The following exception was raised:\n " + exception.Message);
+ Diagnostics.Debug.Log("The database of type '" + typeof(T) + "' failed to load the asset. The following exception was raised:\n " + exception.Message);
}
}
}