Skip to content

Commit 2d699c3

Browse files
author
Nick Iliev
committed
address build warnings
1 parent 848a025 commit 2d699c3

File tree

13 files changed

+321
-296
lines changed

13 files changed

+321
-296
lines changed

extend-fiddler/addmenuitems.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To add menu actions to the **Tools** menu or context menus or add options to the
1212

1313
1. Create and execute a .REG file as follows:
1414

15-
```
15+
```txt
1616
[HKEY_CURRENT_USER\Software\Microsoft\Fiddler2\MenuExt\&YourMenuItemName]
1717
"Command"="YourExeName.exe"
1818
"Parameters"="Your Parameters To Pass To The EXE"

extend-fiddler/extendwithdotnet.md

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,26 @@ See [Build extension assemblies to run in both Fiddler Classic versions 2 and 4]
2323
## Debugging
2424

2525
+ To ensure that exceptions and other extension-related errors are not silently caught: [set](slug://ExtensionsForv2Andv4) the `fiddler.debug.extensions.showerrors` preference to **True**.
26-
+ To output logging information to the **Log** tab: [set][1] the `fiddler.debug.extensions.verbose`
27-
28-
[1]: http://fiddler.wikidot.com/prefsaction
26+
+ To output logging information to the **Log** tab: set the `fiddler.debug.extensions.verbose`
2927

3028
## Direct Fiddler Classic to load extension assemblies
3129

3230
+ To make the extensions available to the current user, install extension assembly DLLs to:
3331

34-
```
35-
%localappdata%\Programs\Fiddler\Scripts
36-
OR
37-
%userprofile%\Documents\Fiddler2\Scripts
38-
```
32+
```txt
33+
%localappdata%\Programs\Fiddler\Scripts
34+
OR
35+
%userprofile%\Documents\Fiddler2\Scripts
36+
```
3937

4038
+ Set the **Fiddler.RequiredVersion** attribute in your **AssemblyInfo.cs** file (or elsewhere in your code) as follows:
4139

42-
```c#
43-
using Fiddler;
40+
```c#
41+
using Fiddler;
4442

45-
// Extension requires Fiddler Classic 2.2.8.6+ because it uses types introduced in v2.2.8...
46-
[assembly: Fiddler.RequiredVersion("2.2.8.6")]
47-
```
43+
// Extension requires Fiddler Classic 2.2.8.6+ because it uses types introduced in v2.2.8...
44+
[assembly: Fiddler.RequiredVersion("2.2.8.6")]
45+
```
4846

4947
## Sample Extension: Step by Step
5048

@@ -66,41 +64,41 @@ See [Build extension assemblies to run in both Fiddler Classic versions 2 and 4]
6664
+ In the Solution Explorer, right click the project. Choose Properties.
6765
+ On the Build Events tab, add the following to the Post-build event command line:
6866

69-
```c#
70-
copy "$(TargetPath)" "%userprofile%\Documents\Fiddler2\Scripts\$(TargetFilename)"
71-
```
67+
```c#
68+
copy "$(TargetPath)" "%userprofile%\Documents\Fiddler2\Scripts\$(TargetFilename)"
69+
```
7270

7371
Modify the default class1.cs (or create a new class) in your project as follows:
7472

75-
```c#
76-
using System;
77-
using System.Windows.Forms;
78-
using Fiddler;
73+
```c#
74+
using System;
75+
using System.Windows.Forms;
76+
using Fiddler;
7977

80-
[assembly: Fiddler.RequiredVersion("2.3.5.0")]
78+
[assembly: Fiddler.RequiredVersion("2.3.5.0")]
8179

82-
public class Violin : IAutoTamper // Ensure class is public, or Fiddler won't see it!
83-
{
84-
string sUserAgent = "";
80+
public class Violin : IAutoTamper // Ensure class is public, or Fiddler won't see it!
81+
{
82+
string sUserAgent = "";
8583

86-
public Violin(){
87-
/* NOTE: It's possible that Fiddler Classic UI isn't fully loaded yet, so don't add any UI in the constructor.
84+
public Violin(){
85+
/* NOTE: It's possible that Fiddler Classic UI isn't fully loaded yet, so don't add any UI in the constructor.
8886
89-
But it's also possible that AutoTamper* methods are called before OnLoad (below), so be
90-
sure any needed data structures are initialized to safe values here in this constructor */
91-
92-
sUserAgent = "Violin";
93-
}
87+
But it's also possible that AutoTamper* methods are called before OnLoad (below), so be
88+
sure any needed data structures are initialized to safe values here in this constructor */
89+
90+
sUserAgent = "Violin";
91+
}
9492

95-
public void OnLoad(){ /* Load your UI here */ }
96-
public void OnBeforeUnload() { }
93+
public void OnLoad(){ /* Load your UI here */ }
94+
public void OnBeforeUnload() { }
9795

98-
public void AutoTamperRequestBefore(Session oSession){
99-
oSession.oRequest["User-Agent"] = sUserAgent;
100-
}
101-
public void AutoTamperRequestAfter(Session oSession){}
102-
public void AutoTamperResponseBefore(Session oSession){}
103-
public void AutoTamperResponseAfter(Session oSession){}
104-
public void OnBeforeReturningError(Session oSession){}
96+
public void AutoTamperRequestBefore(Session oSession){
97+
oSession.oRequest["User-Agent"] = sUserAgent;
10598
}
106-
```
99+
public void AutoTamperRequestAfter(Session oSession){}
100+
public void AutoTamperResponseBefore(Session oSession){}
101+
public void AutoTamperResponseAfter(Session oSession){}
102+
public void OnBeforeReturningError(Session oSession){}
103+
}
104+
```

extend-fiddler/extensionsforv2andv4.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,51 @@ position: 11
99

1010
+ If you want your extension Assembly to run in both Fiddler2 and Fiddler4, build it for .NET Framework v2 and avoid taking any dependencies on any classes that were removed or moved in the later version of the Framework. (The only instance I'm aware of is the Microsoft JScript.NET code compiler, whose classes were moved around a bit).
1111

12-
You'll also need to ensure that if you use any methods that are deprecated (for example, calling **Assembly.LoadFrom** with the overload that takes an **Evidence** parameter) you do so only conditionally. For example:
13-
14-
```c#
15-
if (CONFIG.bRunningOnCLRv4)
16-
{
17-
a = Assembly.LoadFrom(oFile.FullName);
18-
}
19-
else
20-
{
21-
a = Assembly.LoadFrom(oFile.FullName, evidenceFiddler);
22-
}
23-
```
12+
You'll also need to ensure that if you use any methods that are deprecated (for example, calling `Assembly.LoadFrom` with the overload that takes an `Evidence` parameter) you do so only conditionally. For example:
13+
14+
```c#
15+
if (CONFIG.bRunningOnCLRv4)
16+
{
17+
a = Assembly.LoadFrom(oFile.FullName);
18+
}
19+
else
20+
{
21+
a = Assembly.LoadFrom(oFile.FullName, evidenceFiddler);
22+
}
23+
```
2424

2525
All of the extensions from the Fiddler Classic website are compiled against Fiddler Classic v2.
2626

2727
+ Alternatively, you can simply build two versions of your DLL, one version targeting .NET Framework v4 and one targeting .NET Framework v2.
2828

2929
This is how Fiddler Classic itself is built. Basically, just add a "clone" version of your v2-targeted Project to the same Solution. Use the **Add > Existing Item** context menu to add the .CS files from the v2-targeted project to the v4-targeted project, but when selecting the files, be very sure to use the split button on the file picker dialog and choose **Add as Link**. On the v4 Project's **Properties > Build** tab, add a **Conditional Compilation** symbol like DOTNET4. You can then put any .NETv4-specific code behind conditional compilation:
3030

31-
```c#
32-
#if DOTNET4
31+
```c#
32+
#if DOTNET4
3333

34-
// ... code targeting .NETv4
34+
// ... code targeting .NETv4
3535
36-
#else
36+
#else
3737

38-
// ... code targeting .NETv2
38+
// ... code targeting .NETv2
3939
40-
#endif
41-
```
40+
#endif
41+
```
4242

4343
Your extension may install the appropriately-targeted version based on the content of the **InstalledVersion** registry key found inside:
4444

45-
```
46-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fiddler2
47-
```
45+
```txt
46+
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fiddler2
47+
```
4848

4949
The .NET2 version of Fiddler Classic is much more popular than the .NETv4 version at this time. When the .NET Framework v4.5 is released, I may move the v4 project over to v4.5. Among other things, that would allow me to take advantage of the new built-in .ZIP classes in that later framework.
5050

5151
+ What about the RequiredVersion attribute?
5252

5353
Fiddler Classic v4 is "smart"-- if your extension specifies
5454

55-
```
56-
[assembly: Fiddler.RequiredVersion("2.1.0.1")]
57-
```
55+
```txt
56+
[assembly: Fiddler.RequiredVersion("2.1.0.1")]
57+
```
5858

5959
When Fiddler Classic v4 loads it, it will require version 4.3.9.9 or later.

extend-fiddler/importerexporterinterfaces.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,48 @@ position: 7
99

1010
## Thread Safety and FiddlerCore
1111

12-
+ Currently, the **ISessionImporter** and **ISessionExporter** interfaces are called on the **MAIN** UI thread. This is almost certain to change in the future, so you should ensure that your classes are thread safe and that they do not attempt to directly manipulate the Fiddler Classic UI.
12+
+ Currently, the `ISessionImporter` and `ISessionExporter` interfaces are called on the **MAIN** UI thread. This is almost certain to change in the future, so you should ensure that your classes are thread safe and that they do not attempt to directly manipulate the Fiddler Classic UI.
1313

1414
+ Manipulation of the Fiddler Classic UI is further ill-advised because Fiddler Classic itself may not be loaded; FiddlerCore may be hosting your Importer/Exporter directly. In order to support FiddlerCore, it's advised that you support the Filename key (with string value of a fully-qualified path) in the dictOptions parameter, and consider supporting a Silent key (value as boolean) as well.
1515

1616
## The ISessionImporter Interface
1717

18-
Extensions that implement the **ISessionImporter** interface (which implements the **IDisposable** interface) are called when the user uses the **File > Import** menu option.
18+
Extensions that implement the `ISessionImporter` interface (which implements the `IDisposable` interface) are called when the user uses the **File > Import** menu option.
1919

20-
```c#
21-
public interface ISessionImporter : IDisposable
22-
{
23-
Session[] ImportSessions(string sImportFormat, Dictionary<string, object> dictOptions,
24-
EventHandler<ProgressCallbackEventArgs> evtProgressNotifications);
25-
}
20+
```c#
21+
public interface ISessionImporter : IDisposable
22+
{
23+
Session[] ImportSessions(string sImportFormat, Dictionary<string, object> dictOptions,
24+
EventHandler<ProgressCallbackEventArgs> evtProgressNotifications);
25+
}
2626

27-
```
27+
```
2828

29-
The method returns an array of **Session** objects created from the Import of the data.
29+
The method returns an array of `Session` objects created from the Import of the data.
3030

31-
The **dictOptions** dictionary may be null, or may contain a set of string-keyed objects. Most importers support specification of a filename. For example:
31+
The `dictOptions` dictionary may be null, or may contain a set of string-keyed objects. Most importers support specification of a filename. For example:
3232

33-
```c#
34-
dictOptions["Filename"] = "C:\\test.file"
35-
```
33+
```c#
34+
dictOptions["Filename"] = "C:\\test.file"
35+
```
3636

3737
## The ISessionExporter Interface
3838

3939
This class is defined by Fiddler Classic and allows you to report on the progress of an import or export operation.
4040

4141
If the completion ratio cannot be determined, simply pass 0 or a "guess" between 0 and 1.0.
4242

43-
If the Cancel flag is set on the **ProgressCallbackEventArgs** object after being passed to the **evtProgressNotifications** callback, import or export should gracefully terminate as soon as possible.
44-
45-
```c#
46-
public class ProgressCallbackEventArgs: EventArgs
47-
{
48-
public ProgressCallbackEventArgs(float flCompletionRatio, string sProgressText)
49-
public string ProgressText { get; }
50-
public string PercentComplete { get; }
51-
public bool Cancel { get; set; }
52-
}
53-
```
43+
If the Cancel flag is set on the `ProgressCallbackEventArgs` object after being passed to the `evtProgressNotifications` callback, import or export should gracefully terminate as soon as possible.
44+
45+
```c#
46+
public class ProgressCallbackEventArgs: EventArgs
47+
{
48+
public ProgressCallbackEventArgs(float flCompletionRatio, string sProgressText)
49+
public string ProgressText { get; }
50+
public string PercentComplete { get; }
51+
public bool Cancel { get; set; }
52+
}
53+
```
5454

5555
## See Also
5656

0 commit comments

Comments
 (0)