From f7b751fa128ee2acdd5e965cc950a2ca3bbf73d4 Mon Sep 17 00:00:00 2001 From: VahidN Date: Sun, 22 Mar 2015 13:01:31 +0430 Subject: [PATCH] Fixed the application crash on startup --- DNTProfiler.MetaData/SharedAssemblyInfo.cs | 4 ++-- DNTProfiler/DNTProfiler.csproj | 4 +++- .../DNTProfiler.Dumper/ViewModels/MainViewModel.cs | 13 ++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/DNTProfiler.MetaData/SharedAssemblyInfo.cs b/DNTProfiler.MetaData/SharedAssemblyInfo.cs index 33f7ed5..0db688e 100644 --- a/DNTProfiler.MetaData/SharedAssemblyInfo.cs +++ b/DNTProfiler.MetaData/SharedAssemblyInfo.cs @@ -23,7 +23,7 @@ #endif // Assembly Versions are incremented manually when branching the code for a release. -[assembly: AssemblyVersion("1.0.808.0")] +[assembly: AssemblyVersion("1.0.810.0")] // Assembly File Version should be incremented automatically as part of the build process. -[assembly: AssemblyFileVersion("1.0.808.0")] +[assembly: AssemblyFileVersion("1.0.810.0")] diff --git a/DNTProfiler/DNTProfiler.csproj b/DNTProfiler/DNTProfiler.csproj index 3187c35..f421447 100644 --- a/DNTProfiler/DNTProfiler.csproj +++ b/DNTProfiler/DNTProfiler.csproj @@ -72,7 +72,9 @@ False ..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Extensions.dll - + + True + False ..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Primitives.dll diff --git a/Plugins/DNTProfiler.Dumper/ViewModels/MainViewModel.cs b/Plugins/DNTProfiler.Dumper/ViewModels/MainViewModel.cs index bff46f2..e50fb20 100644 --- a/Plugins/DNTProfiler.Dumper/ViewModels/MainViewModel.cs +++ b/Plugins/DNTProfiler.Dumper/ViewModels/MainViewModel.cs @@ -24,6 +24,7 @@ public class MainViewModel : MainViewModelBase private readonly string _settingsPath = Path.Combine(AppMessenger.ExecutablePathDir, "Plugins", "DNTProfiler.Dumper.json"); private DirectoryMonitor _directoryMonitor; private JsonLogger _jsonLogger; + public MainViewModel(ProfilerPluginBase pluginContext) : base(pluginContext) { @@ -48,6 +49,12 @@ public MainViewModel(ProfilerPluginBase pluginContext) public MainGuiModel ThisGuiModelData { set; get; } + private void createDumperDirectory() + { + if (!Directory.Exists(ThisGuiModelData.DumperSettings.DumperDirectory)) + Directory.CreateDirectory(ThisGuiModelData.DumperSettings.DumperDirectory); + } + private void disposeLogger() { if (_jsonLogger != null) @@ -200,6 +207,8 @@ private void setDirectoryMonitor() if (_directoryMonitor != null) _directoryMonitor.Dispose(); + createDumperDirectory(); + _directoryMonitor = new DirectoryMonitor(ThisGuiModelData.DumperSettings.DumperDirectory, "*.json") { OnFileSystemChanged = file => @@ -219,9 +228,7 @@ private void setEvenets() private void showFilesList() { - if (!Directory.Exists(ThisGuiModelData.DumperSettings.DumperDirectory)) - Directory.CreateDirectory(ThisGuiModelData.DumperSettings.DumperDirectory); - + createDumperDirectory(); var files = new DirectoryInfo(ThisGuiModelData.DumperSettings.DumperDirectory).GetFiles("*.json").OrderByDescending(x => x.LastWriteTime); ThisGuiModelData.Files = new ObservableCollection(files);