public static bool DoExport(string sExportFormat, Session[] oSessions, Dictionary <string, object> dictOptions, EventHandler <ProgressCallbackEventArgs> ehPCEA) { if (string.IsNullOrEmpty(sExportFormat)) { return(false); } TranscoderTuple tuple = oTranscoders.GetExporter(sExportFormat); if (tuple == null) { return(false); } bool flag = false; try { ISessionExporter exporter = (ISessionExporter)Activator.CreateInstance(tuple.typeFormatter); if (ehPCEA == null) { ehPCEA = delegate(object sender, ProgressCallbackEventArgs oPCE) { string str = (oPCE.PercentComplete > 0) ? ("Export is " + oPCE.PercentComplete + "% complete; ") : string.Empty; Application.DoEvents(); }; } flag = exporter.ExportSessions(sExportFormat, oSessions, dictOptions, ehPCEA); exporter.Dispose(); } catch (Exception exception) { LogAddonException(exception, "Exporter for " + sExportFormat + " failed."); flag = false; } return(flag); }
public static bool DoExport(string sExportFormat, Session[] oSessions, Dictionary <string, object> dictOptions, EventHandler <ProgressCallbackEventArgs> ehPCEA) { if (string.IsNullOrEmpty(sExportFormat)) { return(false); } TranscoderTuple exporter = FiddlerApplication.oTranscoders.GetExporter(sExportFormat); if (exporter == null) { FiddlerApplication.Log.LogFormat("No exporter for the format '{0}' was available.", new object[] { sExportFormat }); return(false); } bool result = false; try { ISessionExporter sessionExporter = (ISessionExporter)Activator.CreateInstance(exporter.typeFormatter); if (ehPCEA == null) { ehPCEA = delegate(object sender, ProgressCallbackEventArgs e) { string text = (e.PercentComplete > 0) ? ("Export is " + e.PercentComplete + "% complete; ") : string.Empty; FiddlerApplication.Log.LogFormat("{0}{1}", new object[] { text, e.ProgressText }); }; } result = sessionExporter.ExportSessions(sExportFormat, oSessions, dictOptions, ehPCEA); sessionExporter.Dispose(); } catch (Exception eX) { FiddlerApplication.LogAddonException(eX, "Exporter for " + sExportFormat + " failed."); result = false; } return(result); }
public static bool DoExport(string sExportFormat, Session[] oSessions, Dictionary <string, object> dictOptions, EventHandler <ProgressCallbackEventArgs> ehPCEA) { if (string.IsNullOrEmpty(sExportFormat)) { return(false); } TranscoderTuple tuple = oTranscoders.GetExporter(sExportFormat); if (tuple == null) { return(false); } bool flag = false; try { if (CONFIG.IsMicrosoftMachine) { logSelfHost(130); } UI.UseWaitCursor = true; ISessionExporter exporter = (ISessionExporter)Activator.CreateInstance(tuple.typeFormatter); if (ehPCEA == null) { ehPCEA = delegate(object sender, ProgressCallbackEventArgs oPCE) { string str = (oPCE.PercentComplete > 0) ? ("Export is " + oPCE.PercentComplete + "% complete; ") : string.Empty; Log.LogFormat("{0}{1}", new object[] { str, oPCE.ProgressText }); Application.DoEvents(); }; } flag = exporter.ExportSessions(sExportFormat, oSessions, dictOptions, ehPCEA); exporter.Dispose(); } catch (Exception exception) { LogAddonException(exception, "Exporter for " + sExportFormat + " failed."); flag = false; } UI.UseWaitCursor = false; return(flag); }