Fiddler Extension Updater – For Developers

The Fiddler Extension Updater extension supports any IFiddlerExtension (or IAutoTamper as it derives from IFiddlerExtension) loaded in Fiddler. The code sample below shows the 2 required methods. The remaining methods are optional; you don’t even need to have them in your code if you don’t want to use them.

public class MyExtension : IFiddlerExtension
{
 
/* The rest of your IFiddlerExtension here */
 
/// <summary>
/// FiddlerExtensionUpdater hook (Required): Return a URI to download the latest version of your extension from.
/// </summary>
public static Uri FEU_GetExtensionUpdateUrl()
{
    return "http://www.chadsowald.com/d/Fiddler+Extension+%E2%80%93+Request+To+Code";
}
 
/// <summary>
/// FiddlerExtensionUpdater hook (Required): Return the version of the latest version of your extension.
/// </summary>
/// <param name="headers">The HTTP headers received from downloading the file from GetExtensionUpdateUrl.</param>
/// <param name="localFilename">The filename, only, of the file that was downloaded from GetExtensionUpdateUrl.</param>
/// <param name="filePath">The full path, including filename, of the file that was downloaded from GetExtensionUpdateUrl.</param>
public static Version FEU_GetNewestVersion(Dictionary<string, string> headers, string localFilename, string filePath)
{
    return new Version("1.8");
}
 
/// <summary>
/// FiddlerExtensionUpdater hook (Optional): Return a URI that the user can open to show information about the extension (e.g. extension homepage or changelog).
/// </summary>
public static Uri FEU_GetExtensionUpdateInfoUrl()
{
    return "http://www.chadsowald.com/software/fiddler-extension-request-to-code";
}
 
/// <summary>
/// FiddlerExtensionUpdater hook (Optional): Return false to not download the latest version and not update your extension; true otherwise.
/// </summary>
/// <returns></returns>
public static bool FEU_NeedToDownload(Version currentVersion)
{
    return true;
}
 
/// <summary>
/// FiddlerExtensionUpdater hook (Optional): Return an empty list to extract all files or a list of only the zip-file relative paths that you want to extract.
/// </summary>
/// <param name="filePath">The full path, including filename, of the file that was downloaded from GetExtensionUpdateUrl.</param>
public static List<string> FEU_GetZipFilesToExtract(string filePath)
{
    return new List<string>();
}
 
/// <summary>
/// FiddlerExtensionUpdater hook (Optional): Return an empty list to extract all files or a list of only the zip-file relative paths that you don't want to extract.
/// </summary>
/// <param name="filePath">The full path, including filename, of the file that was downloaded from GetExtensionUpdateUrl.</param>
public static List<string> FEU_GetZipFilesNotToExtract(string filePath)
{
    return new List<string>();
}
 
/// <summary>
/// FiddlerExtensionUpdater hook (Optional): Gives you an opportunity to perform actions before an *attempt* to update your extension is taken.
/// </summary>    
public static void FEU_PreInstall(string localPath, string filePath)
{
}
 
/// <summary>
/// FiddlerExtensionUpdater hook (Optional): Gives you an opportunity to perform actions once your extension has been successfully updated.
/// </summary>    
public static void FEU_OnUpdateSucceeded(Version pastVersion, Version newVersion, string installationFolder)
{
}
 
}

The Extension Updater accesses these methods via reflection. Thus, you don’t need to add a dependency to your project or build against any DLLs.

Leave a Reply

Your email address will not be published. Required fields are marked *