Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tuespetre committed Jan 6, 2015
2 parents b1fd681 + a9878b1 commit bf77c16
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 207 deletions.
41 changes: 0 additions & 41 deletions TuesPechkin.TestFormsApp/TuesPechkin.TestFormsApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
Expand All @@ -56,26 +35,6 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
Expand Down
16 changes: 9 additions & 7 deletions TuesPechkin.TestWebApp/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ public class HomeController : Controller
{
private static IConverter converter =
new ThreadSafeConverter(
new PdfToolset(
new Win64EmbeddedDeployment(
new RemotingToolset<PdfToolset>(
new Win32EmbeddedDeployment(
new StaticDeployment(
Path.Combine(Path.GetTempPath(), "wkhtmltox.dll")))));
Path.Combine(
Path.GetTempPath(),
Guid.NewGuid().ToString(),
"wkhtmltox.dll")))));

//
// GET: /Home/
public ActionResult Index()
{
var html = "<p>Just some test HTML</p>";
var doc = new HtmlToPdfDocument(html);
var doc = new HtmlToPdfDocument();
doc.Objects.Add(new ObjectSettings { PageUrl = "www.google.com " });

for (var i = 0; i < 5; i++)
{
var result = converter.Convert(doc);
Expand Down
45 changes: 22 additions & 23 deletions TuesPechkin.TestWebApp/TuesPechkin.TestWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,6 @@
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
Expand Down Expand Up @@ -236,9 +216,9 @@
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TuesPechkin.Wkhtmltox.Win64\TuesPechkin.Wkhtmltox.Win64.csproj">
<Project>{f77cffca-1cf0-49c8-98b6-5c6009c6be63}</Project>
<Name>TuesPechkin.Wkhtmltox.Win64</Name>
<ProjectReference Include="..\TuesPechkin.Wkhtmltox.Win32\TuesPechkin.Wkhtmltox.Win32.csproj">
<Project>{1bcd70ef-32ef-4339-9ccf-ea07415a39a9}</Project>
<Name>TuesPechkin.Wkhtmltox.Win32</Name>
</ProjectReference>
<ProjectReference Include="..\TuesPechkin\TuesPechkin.csproj">
<Project>{023df833-b252-48b3-b6af-dbbb13e39b13}</Project>
Expand All @@ -249,6 +229,25 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
Expand Down
8 changes: 7 additions & 1 deletion TuesPechkin.Tests/GeneralTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ public void ConvertsAfterAppDomainRecycles()
new RemotingToolset<PdfToolset>(
new StaticDeployment(dllPath)));

var document = new HtmlToPdfDocument("<p>some html</p>");
var document = new HtmlToPdfDocument
{
Objects =
{
new ObjectSettings { PageUrl = "www.google.com" }
}
};

AppDomain.CurrentDomain.SetData("result", converter.Convert(document));
};
Expand Down
40 changes: 0 additions & 40 deletions TuesPechkin.Tests/TuesPechkin.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,46 +41,6 @@
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion TuesPechkin.Tests/TuesPechkinTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static TuesPechkinTests()
[TestCleanup]
public void TestCleanup()
{
converter.Invoke(() => toolset.Unload());
toolset.Unload();
}

protected AppDomain GetAppDomain(string name)
Expand Down
21 changes: 9 additions & 12 deletions TuesPechkin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,15 @@ Global
{023DF833-B252-48B3-B6AF-DBBB13E39B13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{023DF833-B252-48B3-B6AF-DBBB13E39B13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{023DF833-B252-48B3-B6AF-DBBB13E39B13}.Release|Any CPU.Build.0 = Release|Any CPU
{35E72E2C-DE58-4ED7-9B47-5EF13860AF42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35E72E2C-DE58-4ED7-9B47-5EF13860AF42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35E72E2C-DE58-4ED7-9B47-5EF13860AF42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35E72E2C-DE58-4ED7-9B47-5EF13860AF42}.Release|Any CPU.Build.0 = Release|Any CPU
{D58769FA-E008-4016-A81C-A85C606B3691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D58769FA-E008-4016-A81C-A85C606B3691}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D58769FA-E008-4016-A81C-A85C606B3691}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D58769FA-E008-4016-A81C-A85C606B3691}.Release|Any CPU.Build.0 = Release|Any CPU
{B12D40DF-C865-4116-9C42-0EEDCF9FB19A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B12D40DF-C865-4116-9C42-0EEDCF9FB19A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B12D40DF-C865-4116-9C42-0EEDCF9FB19A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B12D40DF-C865-4116-9C42-0EEDCF9FB19A}.Release|Any CPU.Build.0 = Release|Any CPU
{35E72E2C-DE58-4ED7-9B47-5EF13860AF42}.Debug|Any CPU.ActiveCfg = Debug|x64
{35E72E2C-DE58-4ED7-9B47-5EF13860AF42}.Release|Any CPU.ActiveCfg = Release|x64
{35E72E2C-DE58-4ED7-9B47-5EF13860AF42}.Release|Any CPU.Build.0 = Release|x64
{D58769FA-E008-4016-A81C-A85C606B3691}.Debug|Any CPU.ActiveCfg = Debug|x86
{D58769FA-E008-4016-A81C-A85C606B3691}.Release|Any CPU.ActiveCfg = Release|x86
{D58769FA-E008-4016-A81C-A85C606B3691}.Release|Any CPU.Build.0 = Release|x86
{B12D40DF-C865-4116-9C42-0EEDCF9FB19A}.Debug|Any CPU.ActiveCfg = Debug|x86
{B12D40DF-C865-4116-9C42-0EEDCF9FB19A}.Release|Any CPU.ActiveCfg = Release|x86
{B12D40DF-C865-4116-9C42-0EEDCF9FB19A}.Release|Any CPU.Build.0 = Release|x86
{1BCD70EF-32EF-4339-9CCF-EA07415A39A9}.Debug|Any CPU.ActiveCfg = Debug|x86
{1BCD70EF-32EF-4339-9CCF-EA07415A39A9}.Debug|Any CPU.Build.0 = Debug|x86
{1BCD70EF-32EF-4339-9CCF-EA07415A39A9}.Release|Any CPU.ActiveCfg = Release|x86
Expand Down
10 changes: 10 additions & 0 deletions TuesPechkin/NestingToolset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public abstract class NestingToolset : MarshalByRefObject, IToolset
{
public abstract event EventHandler Unloaded;

internal event EventHandler BeforeUnload;

public IDeployment Deployment { get; protected set; }

public bool Loaded { get; protected set; }
Expand All @@ -24,6 +26,14 @@ public override object InitializeLifetimeService()
return null;
}

internal void OnBeforeUnload(object sender)
{
if (BeforeUnload != null)
{
BeforeUnload(sender, EventArgs.Empty);
}
}

public void AddObject(IntPtr converter, IntPtr objectConfig, byte[] html)
{
NestedToolset.AddObject(converter, objectConfig, html);
Expand Down
26 changes: 1 addition & 25 deletions TuesPechkin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,11 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TuesPechkin")]
[assembly: AssemblyDescription(".NET wrapper for wkhtmltopdf; supports 32-bit, 64-bit, multi-threaded and IIS environments.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TuesPechkin")]
[assembly: AssemblyCopyright("Copyright 2014 Derek Gray")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.1")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("11f63696-7105-436d-9ec6-2fee54c40b11")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
9 changes: 2 additions & 7 deletions TuesPechkin/RemotingToolset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@ public override void Unload()
{
if (Loaded)
{
NestedToolset.Unload();

TearDownAppDomain(null, EventArgs.Empty);

if (Unloaded != null)
{
Unloaded(this, EventArgs.Empty);
}
}
}

Expand Down Expand Up @@ -99,6 +92,8 @@ private void TearDownAppDomain(object sender, EventArgs e)
return;
}

OnBeforeUnload((ActionShim)(() => NestedToolset.Unload()));

AppDomain.Unload(remoteDomain);

var expected = Path.Combine(
Expand Down
8 changes: 8 additions & 0 deletions TuesPechkin/ThreadSafeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ public ThreadSafeConverter(IToolset toolset)
{
new Thread(() => StopThread()).Start();
};

if (toolset is NestingToolset)
{
(toolset as NestingToolset).BeforeUnload += (sender, args) =>
{
Invoke(sender as ActionShim);
};
}
}

public override byte[] Convert(IDocument document)
Expand Down
Loading

0 comments on commit bf77c16

Please sign in to comment.