Skip to content

Commit fc649d4

Browse files
authored
Merge pull request #20 from AngleSharp/devel
Release 0.12
2 parents 0efab91 + 1b818fb commit fc649d4

34 files changed

+3416
-85
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 0.12.0
2+
3+
Released on Thursday, May 2 2019.
4+
5+
- Reference latest AngleSharp
6+
- Added `InputFile` class as a standard `IFile` implementation
7+
- Added `AppendFile` extensions for `IHtmlInputElement`
8+
- Included `WithDownload` and `WithStandardDownload` configuration
9+
- Added ability for binary data restore on assets (#19)
10+
- Added `DownloadAsync` extension method to `IUrlUtilities` elements
11+
- Added more extension methods to `IResponse` (e.g., `SaveToAsync`)
12+
- Introduced improved cookie container (#15)
13+
114
# 0.10.1
215

316
Released on Monday, January 7 2019.

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
[![GitHub Tag](https://img.shields.io/github/tag/AngleSharp/AngleSharp.Io.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.Io/releases)
77
[![NuGet Count](https://img.shields.io/nuget/dt/AngleSharp.Io.svg?style=flat-square)](https://www.nuget.org/packages/AngleSharp.Io/)
88
[![Issues Open](https://img.shields.io/github/issues/AngleSharp/AngleSharp.Io.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.Io/issues)
9+
[![Gitter Chat](http://img.shields.io/badge/gitter-AngleSharp/AngleSharp-blue.svg?style=flat-square)](https://gitter.im/AngleSharp/AngleSharp)
910
[![StackOverflow Questions](https://img.shields.io/stackexchange/stackoverflow/t/anglesharp.svg?style=flat-square)](https://stackoverflow.com/tags/anglesharp)
1011
[![CLA Assistant](https://cla-assistant.io/readme/badge/AngleSharp/AngleSharp.Io?style=flat-square)](https://cla-assistant.io/AngleSharp/AngleSharp.Io)
1112

1213
AngleSharp.Io extends AngleSharp with powerful requesters, caching mechanisms, and storage systems. It is coupled more strongly to the underlying operating system than AngleSharp itself. Therefore it has stronger dependencies and demands and cannot be released for the standard framework (4.6). Nevertheless, it is released as a .NET Standard 2.0 library.
1314

1415
## Basic Configuration
1516

17+
### Requesters
18+
1619
If you just want to use *all* available requesters provided by AngleSharp.Io you can do the following:
1720

1821
```cs
@@ -23,6 +26,64 @@ var config = Configuration.Default
2326

2427
This will register all requesters. Alternatively, the requesters can be provided explicitly. They are located in the `AngleSharp.Io.Network` namespace and have names such as `DataRequester`.
2528

29+
### Cookies
30+
31+
To get improved cookie support, e.g., do
32+
33+
```cs
34+
var config = Configuration.Default
35+
.WithTemporaryCookies(); // Uses memory cookies
36+
```
37+
38+
or if you want to have persistent cookies you can use:
39+
40+
```cs
41+
var syncPath = $"Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)\\anglesharp.cookies";
42+
var config = Configuration.Default
43+
.WithPersistentCookies(syncPath); // Uses sync cookies against the given path
44+
```
45+
46+
Alternatively, the new overloads for the `WithCookies` extension method can be used.
47+
48+
### Downloads
49+
50+
AngleSharp.Io offers you the possibility of a simplified downloading experience. Just use `WithStandardDownload` to redirect resources to a callback.
51+
52+
In the simplest case you can write:
53+
54+
```cs
55+
var config = Configuration.Default
56+
.WithStandardDownload((fileName, content) =>
57+
{
58+
// store fileName with the content stream ...
59+
});
60+
```
61+
62+
Alternatively, use `WithDownload`, which allows you to distinguish also on the provided MIME type.
63+
64+
## DOM Extension Methods
65+
66+
The `IHtmlInputElement` interface now has `AppendFile` to easily allow appending files without much trouble.
67+
68+
```cs
69+
document
70+
.QuerySelector<IHtmlInputElement>("input[type=file]")
71+
.AppendFile("c:\\example.jpg");
72+
```
73+
74+
More overloads exist.
75+
76+
Furthermore, the `IUrlUtilities` interface now has `DownloadAsync`.
77+
78+
```cs
79+
document
80+
.QuerySelector<IHtmlAnchorElement>("a#download-document")
81+
.DownloadAsync()
82+
.SaveToAsync("c:\\example.pdf");
83+
```
84+
85+
The `SaveToAsync` (as well as the `CopyToAsync`) are extension methods for the `IResponse` interface.
86+
2687
## Features
2788

2889
- New requesters
@@ -33,13 +94,25 @@ This will register all requesters. Alternatively, the requesters can be provided
3394
- Enhanced support for about: URLs
3495
- WebSockets (mostly interesting for scripting engines, e.g., JS)
3596
- Storage support by providing the `IStorage` interface
97+
- Improved cookie container (`AdvancedCookieContainer`)
98+
- Enhanced download capabilities for resources / links
3699

37100
## Participating
38101

39102
Participation in the project is highly welcome. For this project the same rules as for the AngleSharp core project may be applied.
40103

41104
If you have any question, concern, or spot an issue then please report it before opening a pull request. An initial discussion is appreciated regardless of the nature of the problem.
42105

106+
Live discussions can take place in our [Gitter chat](https://gitter.im/AngleSharp/AngleSharp), which supports using GitHub accounts.
107+
108+
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
109+
110+
For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
111+
112+
## .NET Foundation
113+
114+
This project is supported by the [.NET Foundation](https://dotnetfoundation.org).
115+
43116
## License
44117

45118
The MIT License (MIT)

build.cake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Task("Create-Package")
127127

128128
Task("Publish-Package")
129129
.IsDependentOn("Create-Package")
130+
.IsDependentOn("Run-Unit-Tests")
130131
.Does(() =>
131132
{
132133
var apiKey = EnvironmentVariable("NUGET_API_KEY");
@@ -148,6 +149,7 @@ Task("Publish-Package")
148149

149150
Task("Publish-Release")
150151
.IsDependentOn("Publish-Package")
152+
.IsDependentOn("Run-Unit-Tests")
151153
.Does(() =>
152154
{
153155
var githubToken = EnvironmentVariable("GITHUB_API_TOKEN");

src/AngleSharp.Io.Tests/AngleSharp.Io.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<SignAssembly>true</SignAssembly>
55
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
66
<IsPackable>false</IsPackable>
7+
<LangVersion>7.1</LangVersion>
78
</PropertyGroup>
89

910
<ItemGroup>

0 commit comments

Comments
 (0)