From b7f5ff3b3cff6602a8cdb0dabc7165044d0b1636 Mon Sep 17 00:00:00 2001 From: William Dibbern Date: Wed, 24 Jun 2015 13:30:03 -0500 Subject: [PATCH] Safety Dance - Fixed issue with null/empty overrides - Fixed issue with disabling a profile when the file watcher was not active - Fixed issue with editing a disabled profile - Ensure installer is copying the correct DLLs --- .../Imposter.Fiddler.Installer.csproj | 5 +++-- Imposter.Fiddler.Installer/MainWindow.xaml.cs | 1 + Imposter.Fiddler/Helpers/PathHelper.cs | 6 +++++- Imposter.Fiddler/Imposter.cs | 8 ++++++-- Imposter.Fiddler/Models/Profile.cs | 7 +++++-- Imposter.Fiddler/Properties/AssemblyInfo.cs | 4 ++-- Imposter.Fiddler/Views/ProfileEditor.xaml.cs | 7 +++++-- 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Imposter.Fiddler.Installer/Imposter.Fiddler.Installer.csproj b/Imposter.Fiddler.Installer/Imposter.Fiddler.Installer.csproj index 19b05b5..f239429 100644 --- a/Imposter.Fiddler.Installer/Imposter.Fiddler.Installer.csproj +++ b/Imposter.Fiddler.Installer/Imposter.Fiddler.Installer.csproj @@ -160,9 +160,10 @@ - + Scripts\System.Windows.Interactivity.dll - + Always + diff --git a/Imposter.Fiddler.Installer/MainWindow.xaml.cs b/Imposter.Fiddler.Installer/MainWindow.xaml.cs index 5210ff0..bf259a5 100644 --- a/Imposter.Fiddler.Installer/MainWindow.xaml.cs +++ b/Imposter.Fiddler.Installer/MainWindow.xaml.cs @@ -35,6 +35,7 @@ private void Install_Click(object sender, RoutedEventArgs e) File.Copy("Scripts\\Imposter.Fiddler.dll", installLocation + "Imposter.Fiddler.dll", true); File.Copy("Scripts\\imposter.js", installLocation + "imposter.js", true); File.Copy("Scripts\\MahApps.Metro.dll", installLocation + "MahApps.Metro.dll", true); + File.Copy("Scripts\\System.Windows.Interactivity.dll", installLocation + "System.Windows.Interactivity.dll", true); Tabs.SelectedIndex = _tabIndex = 1; } diff --git a/Imposter.Fiddler/Helpers/PathHelper.cs b/Imposter.Fiddler/Helpers/PathHelper.cs index 7805463..63aef4f 100644 --- a/Imposter.Fiddler/Helpers/PathHelper.cs +++ b/Imposter.Fiddler/Helpers/PathHelper.cs @@ -27,7 +27,11 @@ public static string GetLocalFilePath(string urlFragment, string localDirectory, foreach (var ovr in overrides) { - if (urlFragment.Contains(ovr.RemoteFile.ToLower()) && CheckIfFileExists(ovr.LocalFile)) + if (ovr != null && + !string.IsNullOrEmpty(ovr.RemoteFile) && + !string.IsNullOrEmpty(ovr.LocalFile) && + urlFragment.Contains(ovr.RemoteFile.ToLower()) && + CheckIfFileExists(ovr.LocalFile)) { return ovr.LocalFile; } diff --git a/Imposter.Fiddler/Imposter.cs b/Imposter.Fiddler/Imposter.cs index 292642b..a062f04 100644 --- a/Imposter.Fiddler/Imposter.cs +++ b/Imposter.Fiddler/Imposter.cs @@ -227,9 +227,13 @@ private void ProfileEdit_Click(object sender, EventArgs e) { _enabledProfiles.RemoveAll(p => p.ProfileId == (Guid)parent.Tag); _enabledProfiles.Add(profileEditor.Profile); - } - LoadProfileItems(profileEditor.Profile.Name); + LoadProfileItems(profileEditor.Profile.Name); + } + else + { + LoadProfileItems(); + } } } diff --git a/Imposter.Fiddler/Models/Profile.cs b/Imposter.Fiddler/Models/Profile.cs index e184a2e..58bdcf7 100644 --- a/Imposter.Fiddler/Models/Profile.cs +++ b/Imposter.Fiddler/Models/Profile.cs @@ -57,8 +57,11 @@ public void Stop() { IsRunning = false; - _watcher.Dispose(); - _watcher = null; + if (_watcher != null) + { + _watcher.Dispose(); + _watcher = null; + } } public string GetFileMatch(string url) diff --git a/Imposter.Fiddler/Properties/AssemblyInfo.cs b/Imposter.Fiddler/Properties/AssemblyInfo.cs index c83d2a9..2732152 100644 --- a/Imposter.Fiddler/Properties/AssemblyInfo.cs +++ b/Imposter.Fiddler/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.1")] -[assembly: AssemblyFileVersion("1.0.0.1")] +[assembly: AssemblyVersion("1.0.0.2")] +[assembly: AssemblyFileVersion("1.0.0.2")] [assembly: Fiddler.RequiredVersion("2.2.8.6")] diff --git a/Imposter.Fiddler/Views/ProfileEditor.xaml.cs b/Imposter.Fiddler/Views/ProfileEditor.xaml.cs index 03ed2d7..71217a9 100644 --- a/Imposter.Fiddler/Views/ProfileEditor.xaml.cs +++ b/Imposter.Fiddler/Views/ProfileEditor.xaml.cs @@ -17,14 +17,17 @@ public partial class ProfileEditor : MetroWindow public Profile Profile { get - { + { + var overrides = new List(Overrides.ItemsSource as IEnumerable); + overrides.RemoveAll(o => string.IsNullOrEmpty(o.LocalFile) || string.IsNullOrEmpty(o.RemoteFile)); + return new Profile { ProfileId = ProfileId, Name = Name.Text, LocalDirectory = Local.Text, RemoteUrl = Remote.Text, - Overrides = new List(Overrides.ItemsSource as IEnumerable) + Overrides = overrides }; } set