Skip to content

Commit

Permalink
Fix match highlight, add version, display enabled
Browse files Browse the repository at this point in the history
- Session highlight was inconsistent, updated to use documented APIs for
session styles
- Version number now displayed in main file menu
- Menu item now displays (Enabled) when Imposter is active and one or
more profiles are being matched against
  • Loading branch information
gotdibbs committed Dec 1, 2015
1 parent a52a779 commit bc13f08
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Imposter.Fiddler.Installer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.5")]
[assembly: AssemblyFileVersion("1.0.0.5")]
24 changes: 22 additions & 2 deletions Imposter.Fiddler/Imposter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
Expand Down Expand Up @@ -59,6 +60,8 @@ private void Start()
profile.Start(EnableAutoReload);
}
}

_imposterMenu.Text = "Imposter (Enabled)";
}
}

Expand All @@ -68,6 +71,8 @@ private void Stop()
{
profile.Stop();
}

_imposterMenu.Text = "Imposter";
}

#region Menu and Menu Events
Expand All @@ -86,12 +91,17 @@ private void InitializeMenu()
_autoReload.Enabled = false;
_autoReload.Checked = EnableAutoReload;

var version = new ToolStripMenuItem(string.Format("v{0}", Assembly.GetExecutingAssembly().GetName().Version));
version.Enabled = false;

var icon = Resources.Resources.Imposter;
var image = icon.ToBitmap();
_imposterMenu = new ToolStripMenuItem("Imposter", image);
_imposterMenu = new ToolStripMenuItem("&Imposter", image);
_imposterMenu.DropDownItems.Add(_profiles);
_imposterMenu.DropDownItems.Add(new ToolStripSeparator());
_imposterMenu.DropDownItems.AddRange(new ToolStripMenuItem[] { _isEnabled, _autoReload });
_imposterMenu.DropDownItems.Add(new ToolStripSeparator());
_imposterMenu.DropDownItems.Add(version);

LoadProfileItems();
}
Expand Down Expand Up @@ -284,6 +294,8 @@ public void AutoTamperRequestBefore(Session oSession)
return;
}

bool isTampered = false;

string fullString = oSession.fullUrl.ToLower();

if (fullString.EndsWith("imposter.js") && EnableAutoReload)
Expand All @@ -292,6 +304,8 @@ public void AutoTamperRequestBefore(Session oSession)
var js = Path.GetFullPath("Scripts\\imposter.js");
oSession.LoadResponseFromFile(js);
oSession.ResponseHeaders.Add("x-imposter", js);

isTampered = true;
}

if (fullString.ToLower().Contains("/imposter-poll-for-changes?profileid=") && EnableAutoReload)
Expand All @@ -314,6 +328,8 @@ public void AutoTamperRequestBefore(Session oSession)
{
oSession.utilSetResponseBody("false");
}

isTampered = true;
}

foreach (var profile in _enabledProfiles)
Expand All @@ -330,8 +346,12 @@ public void AutoTamperRequestBefore(Session oSession)
oSession.ResponseHeaders.Add("x-imposter", path);
if (oSession.ViewItem != null)
{
oSession.ViewItem.BackColor = Color.SkyBlue;
oSession["ui-backcolor"] = "#4683ea";
oSession["ui-color"] = "#ffffff";
}

isTampered = true;

// Only swap for the first match
break;
}
Expand Down
4 changes: 2 additions & 2 deletions Imposter.Fiddler/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.4")]
[assembly: AssemblyFileVersion("1.0.0.4")]
[assembly: AssemblyVersion("1.0.0.5")]
[assembly: AssemblyFileVersion("1.0.0.5")]
[assembly: Fiddler.RequiredVersion("2.2.8.6")]

0 comments on commit bc13f08

Please sign in to comment.