Example #1
0
 static FiddlerApplication()
 {
     FiddlerApplication.Counters      = new DataPoints();
     FiddlerApplication._Log          = new Logger(false);
     FiddlerApplication.Janitor       = new PeriodicWorker();
     FiddlerApplication._Prefs        = null;
     FiddlerApplication.oTranscoders  = new FiddlerTranscoders();
     FiddlerApplication.slLeakedFiles = new List <string>();
     FiddlerApplication._SetXceedLicenseKeys();
     FiddlerApplication._Prefs = new PreferenceBag(null);
 }
Example #2
0
        private bool ScanAssemblyForTranscoders(Assembly assemblyInput)
        {
            bool result   = false;
            bool boolPref = FiddlerApplication.Prefs.GetBoolPref("fiddler.debug.extensions.verbose", false);

            try
            {
                if (!Utilities.FiddlerMeetsVersionRequirement(assemblyInput, "Importers and Exporters"))
                {
                    FiddlerApplication.Log.LogFormat("Assembly {0} did not specify a RequiredVersionAttribute. Aborting load of transcoders.", new object[]
                    {
                        assemblyInput.CodeBase
                    });
                    bool result2 = false;
                    return(result2);
                }
                Type[] exportedTypes = assemblyInput.GetExportedTypes();
                for (int i = 0; i < exportedTypes.Length; i++)
                {
                    Type type = exportedTypes[i];
                    if (!type.IsAbstract && type.IsPublic && type.IsClass)
                    {
                        if (!typeof(ISessionImporter).IsAssignableFrom(type))
                        {
                            goto IL_235;
                        }
                        try
                        {
                            if (!FiddlerTranscoders.AddToImportOrExportCollection(this.m_Importers, type))
                            {
                                FiddlerApplication.Log.LogFormat("WARNING: SessionImporter {0} from {1} failed to specify any ImportExportFormat attributes.", new object[]
                                {
                                    type.Name,
                                    assemblyInput.CodeBase
                                });
                            }
                            else
                            {
                                result = true;
                                if (boolPref)
                                {
                                    FiddlerApplication.Log.LogFormat("    Added SessionImporter {0}", new object[]
                                    {
                                        type.FullName
                                    });
                                }
                            }
                            goto IL_235;
                        }
                        catch (Exception ex)
                        {
                            FiddlerApplication.DoNotifyUser(string.Format("[Fiddler] Failure loading {0} SessionImporter from {1}: {2}\n\n{3}\n\n{4}", new object[]
                            {
                                type.Name,
                                assemblyInput.CodeBase,
                                ex.Message,
                                ex.StackTrace,
                                ex.InnerException
                            }), "Extension Load Error");
                            goto IL_235;
                        }
IL_167:
                        try
                        {
                            if (!FiddlerTranscoders.AddToImportOrExportCollection(this.m_Exporters, type))
                            {
                                FiddlerApplication.Log.LogFormat("WARNING: SessionExporter {0} from {1} failed to specify any ImportExportFormat attributes.", new object[]
                                {
                                    type.Name,
                                    assemblyInput.CodeBase
                                });
                            }
                            else
                            {
                                result = true;
                                if (boolPref)
                                {
                                    FiddlerApplication.Log.LogFormat("    Added SessionExporter {0}", new object[]
                                    {
                                        type.FullName
                                    });
                                }
                            }
                        }
                        catch (Exception ex2)
                        {
                            FiddlerApplication.DoNotifyUser(string.Format("[Fiddler] Failure loading {0} SessionExporter from {1}: {2}\n\n{3}\n\n{4}", new object[]
                            {
                                type.Name,
                                assemblyInput.CodeBase,
                                ex2.Message,
                                ex2.StackTrace,
                                ex2.InnerException
                            }), "Extension Load Error");
                        }
                        goto IL_22A;
IL_235:
                        if (typeof(ISessionExporter).IsAssignableFrom(type))
                        {
                            goto IL_167;
                        }
                    }
                    IL_22A :;
                }
            }
            catch (Exception ex3)
            {
                FiddlerApplication.DoNotifyUser(string.Format("[Fiddler] Failure loading Importer/Exporter from {0}: {1}", assemblyInput.CodeBase, ex3.Message), "Extension Load Error");
                bool result2 = false;
                return(result2);
            }
            return(result);
        }