Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Lawrence committed Apr 22, 2019
0 parents commit ebda796
Show file tree
Hide file tree
Showing 14 changed files with 1,108 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
113 changes: 113 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#################
## Visual Studio
#################

*.vs/

*.exe

# User-specific files
*.suo
*.user
*.sln.docstates
*.[Cc]ache

# Build results

[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
TestResults/
*.vshost.exe

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml


#############
## Windows detritus
#############

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac crap
.DS_Store

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# If using the old MSBuild-Integrated Package Restore, uncomment this:
#!**/packages/repositories.config
59 changes: 59 additions & 0 deletions FiddlerImportNetlog/FiddlerImportNetlog.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7B641C3F-89B9-44BD-BC81-42A3A9E11161}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FiddlerImportNetlog</RootNamespace>
<AssemblyName>FiddlerImportNetlog</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Fiddler">
<HintPath>..\..\..\Users\ericlaw\AppData\Local\Programs\Fiddler\Fiddler.exe</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FiddlerInterface.cs" />
<Compile Include="Importer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="README.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) "%25userprofile%25\Documents\Fiddler2\ImportExport\$(TargetFilename)"</PostBuildEvent>
</PropertyGroup>
</Project>
25 changes: 25 additions & 0 deletions FiddlerImportNetlog/FiddlerImportNetlog.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.421
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiddlerImportNetlog", "FiddlerImportNetlog.csproj", "{7B641C3F-89B9-44BD-BC81-42A3A9E11161}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7B641C3F-89B9-44BD-BC81-42A3A9E11161}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B641C3F-89B9-44BD-BC81-42A3A9E11161}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B641C3F-89B9-44BD-BC81-42A3A9E11161}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B641C3F-89B9-44BD-BC81-42A3A9E11161}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6BA34491-CF1B-4BB2-80F7-789CCB5E2901}
EndGlobalSection
EndGlobal
69 changes: 69 additions & 0 deletions FiddlerImportNetlog/FiddlerInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using Fiddler;

namespace FiddlerImportNetlog
{
[ProfferFormat("NetLog JSON", "Chromium's JSON-based event log format (v1.1.1). See https://dev.chromium.org/for-testers/providing-network-details for more details.")]
public class HTTPArchiveFormatImport : ISessionImporter
{
public Session[] ImportSessions(string sFormat, Dictionary<string, object> dictOptions, EventHandler<Fiddler.ProgressCallbackEventArgs> evtProgressNotifications)
{
if ((sFormat != "NetLog JSON")) { Debug.Assert(false); return null; }

MemoryStream strmContent = null;
string sFilename = null;
if (null != dictOptions)
{
if (dictOptions.ContainsKey("Filename"))
{
sFilename = dictOptions["Filename"] as string;
}
else if (dictOptions.ContainsKey("Content"))
{
strmContent = new MemoryStream(Encoding.UTF8.GetBytes(dictOptions["Content"] as string));
}
}

if ((null == strmContent) && string.IsNullOrEmpty(sFilename))
{
sFilename = Fiddler.Utilities.ObtainOpenFilename("Import " + sFormat, "NetLog JSON (*.json)|*.json");
}

if ((null != strmContent) || !String.IsNullOrEmpty(sFilename))
{
try
{
List<Session> listSessions = new List<Session>();
StreamReader oSR;

if (null != strmContent)
{
oSR = new StreamReader(strmContent);
}
else
{
oSR = new StreamReader(sFilename, Encoding.UTF8);
}

using (oSR)
{
new NetlogImporter(oSR, listSessions, evtProgressNotifications);
}
return listSessions.ToArray();
}
catch (Exception eX)
{
FiddlerApplication.ReportException(eX, "Failed to import NetLog");
return null;
}
}
return null;
}

public void Dispose() { }
}
}
Loading

0 comments on commit ebda796

Please sign in to comment.