Skip to content

Commit f79d9b6

Browse files
Merge branch 'feature/Misc_PR#6,7,8,9_cleanup' into develop
Conflicts: NScrape/Forms/InputHtmlFormControl.cs NScrape/GetWebRequest.cs NScrape/IWebClient.cs NScrape/PostWebRequest.cs NScrape/WebClient.cs
2 parents 9cd51ae + 6aeff47 commit f79d9b6

15 files changed

+164
-79
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33

4+
# Help files
5+
*.chm
6+
47
# User-specific files
58
*.suo
69
*.user

NScrape/ExceptionWebResponse.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ namespace NScrape {
88
public class ExceptionWebResponse : WebResponse {
99
private readonly WebException exception;
1010

11-
public ExceptionWebResponse( WebException exception, Uri url )
12-
: base( url, WebResponseType.Exception, false ) {
11+
/// <summary>
12+
/// Initializes a new instance of the <see cref="ExceptionWebResponse"/> class.
13+
/// </summary>
14+
/// <param name="exception">The exception of the response.</param>
15+
/// <param name="responseUrl">The URL of the response.</param>
16+
public ExceptionWebResponse( WebException exception, Uri responseUrl )
17+
: base( responseUrl, WebResponseType.Exception, false ) {
1318
this.exception = exception;
1419
}
1520

NScrape/Forms/HtmlForm.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ public void Load( Uri formUrl, HtmlFormDefinition formDefinition ) {
137137
PopulateForm( formDefinition );
138138
}
139139

140+
/// <summary>
141+
/// Gets the action URL of the form.
142+
/// </summary>
143+
/// <remarks>
144+
/// The action URL is URL to which the form shall be submitted. If the form does not specify an action URL,
145+
/// the form URL shall be used.
146+
/// </remarks>
140147
protected Uri ActionUrl {
141148
get {
142149
if ( Attributes.ContainsKey( "action" ) ) {

NScrape/Forms/InputHtmlFormControl.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ public override string EncodedData {
8989
/// <returns>
9090
/// A <see cref="string"/> that represents the current <see cref="InputHtmlFormControl"/>.
9191
/// </returns>
92-
public override string ToString()
93-
{
94-
return string.Format("{0}: {1} ({2})", this.Name, this.Value, this.ControlType);
92+
public override string ToString() {
93+
return string.Format( "{0}: {1} ({2})", Name, Value, ControlType );
9594
}
9695
}
9796
}

NScrape/HtmlWebResponse.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ namespace NScrape {
77
/// </summary>
88
public class HtmlWebResponse : TextWebResponse {
99

10-
public HtmlWebResponse( bool success, Uri url, string html, Encoding encoding )
11-
: base( url, WebResponseType.Html, success, html, encoding ) {
10+
/// <summary>
11+
/// Initializes a new instance of the <see cref="HtmlWebResponse"/> class.
12+
/// </summary>
13+
/// <param name="success"><b>true</b> if the response is considered successful, <b>false</b> otherwise.</param>
14+
/// <param name="responseUrl">The URL of the response.</param>
15+
/// <param name="html">The HTML text of the response.</param>
16+
/// <param name="encoding">The encoding of the HTML text.</param>
17+
public HtmlWebResponse( bool success, Uri responseUrl, string html, Encoding encoding )
18+
: base( responseUrl, WebResponseType.Html, success, html, encoding ) {
1219
}
1320

1421
/// <summary>

NScrape/IWebClient.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,33 @@ namespace NScrape
88
/// </summary>
99
public interface IWebClient
1010
{
11-
/// <include file='IWebClient.xml' path='/IWebClient/AddingCookie'/>
11+
/// <include file='IWebClient.xml' path='/IWebClient/AddingCookie/*'/>
1212
event EventHandler<AddingCookieEventArgs> AddingCookie;
1313

14-
/// <include file='IWebClient.xml' path='/IWebClient/SendingRequest'/>
14+
/// <include file='IWebClient.xml' path='/IWebClient/SendingRequest/*'/>
1515
event EventHandler<SendingRequestEventArgs> SendingRequest;
1616

17-
/// <include file='IWebClient.xml' path='/IWebClient/ProcessingResponse'/>
17+
/// <include file='IWebClient.xml' path='/IWebClient/ProcessingResponse/*'/>
1818
event EventHandler<ProcessingResponseEventArgs> ProcessingResponse;
1919

20-
/// <include file='IWebClient.xml' path='/IWebClient/CookieJar'/>
20+
/// <include file='IWebClient.xml' path='/IWebClient/CookieJar/*'/>
2121
CookieContainer CookieJar { get; }
2222

23-
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri'/>
23+
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri/*'/>
2424
WebResponse SendRequest(Uri destination);
25-
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri_bool'/>
25+
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri_bool/*'/>
2626
WebResponse SendRequest(Uri destination, bool autoRedirect);
2727

28-
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri_string'/>
28+
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri_string/*'/>
2929
WebResponse SendRequest(Uri destination, string requestData);
3030

31-
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri_string_bool'/>
31+
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_Uri_string_bool/*'/>
3232
WebResponse SendRequest(Uri destination, string requestData, bool autoRedirect);
3333

34-
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_WebRequest'/>
34+
/// <include file='IWebClient.xml' path='/IWebClient/SendRequest_WebRequest/*'/>
3535
WebResponse SendRequest(WebRequest webRequest);
3636

37-
/// <include file='IWebClient.xml' path='/IWebClient/UserAgent'/>
37+
/// <include file='IWebClient.xml' path='/IWebClient/UserAgent/*'/>
3838
string UserAgent { get; set; }
3939
}
4040
}

NScrape/IWebClient.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<IWebClient>
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<IWebClient>
23
<AddingCookie>
34
<summary>
45
Occurs when a cookie is added to the <see cref="CookieJar"/>.
@@ -23,10 +24,10 @@
2324

2425
<ProcessingResponse>
2526
<summary>
26-
Occurs when a response has been received.
27+
Occurs when a response has been received and is about to be processed.
2728
</summary>
2829
<remarks>
29-
Use this event to be notified when the <see cref="IWebClient"/> receives a response.
30+
Use this event to be notified just before the <see cref="IWebClient"/> begins to process a newly-received response.
3031
</remarks>
3132
</ProcessingResponse>
3233

@@ -157,8 +158,8 @@
157158
var webClient = new WebClient();
158159

159160
var request = new PostWebRequest() {
160-
Destination = new Uri( "http://www.foo.com" ),
161-
RequestData = "step=confirmation&amp;rt=L&amp;rp=%2Flogin%2Fhome&amp;p=0&amp;inputEmailHandle=foo&amp;inputPassword=bar"
161+
Destination = new Uri( "http://www.foo.com" ),
162+
RequestData = "step=confirmation&amp;rt=L&amp;rp=%2Flogin%2Fhome&amp;p=0&amp;inputEmailHandle=foo&amp;inputPassword=bar"
162163
};
163164

164165
var response = webClient.SendRequest( request );
@@ -178,7 +179,7 @@
178179
<example>
179180
<code>
180181
var webClient = new WebClient {
181-
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
182+
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
182183
};
183184
</code>
184185
</example>

NScrape/ImageWebResponse.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ namespace NScrape {
88
public class ImageWebResponse : WebResponse {
99
private readonly Bitmap image;
1010

11-
public ImageWebResponse( bool success, Uri url, Bitmap image )
12-
: base( url, WebResponseType.Image, success ) {
11+
/// <summary>
12+
/// Initializes a new instance of the <see cref="ImageWebResponse"/> class.
13+
/// </summary>
14+
/// <param name="success"><b>true</b> if the response is considered successful, <b>false</b> otherwise.</param>
15+
/// <param name="responseUrl">The URL of the response.</param>
16+
/// <param name="image">The image of the response.</param>
17+
public ImageWebResponse( bool success, Uri responseUrl, Bitmap image )
18+
: base( responseUrl, WebResponseType.Image, success ) {
1319
this.image = image;
1420
}
1521

NScrape/JavaScriptWebResponse.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ namespace NScrape {
77
/// </summary>
88
public class JavaScriptWebResponse : TextWebResponse {
99

10-
public JavaScriptWebResponse( bool success, Uri url, string text, Encoding encoding )
11-
: base( url, WebResponseType.JavaScript, success, text, encoding ) {
10+
/// <summary>
11+
/// Initializes a new instance of the <see cref="JavaScriptWebResponse"/> class.
12+
/// </summary>
13+
/// <param name="success"><b>true</b> if the response is considered successful, <b>false</b> otherwise.</param>
14+
/// <param name="responseUrl">The URL of the response.</param>
15+
/// <param name="text">The JavaScript text of the response.</param>
16+
/// <param name="encoding">The encoding of the JavaScript text.</param>
17+
public JavaScriptWebResponse( bool success, Uri responseUrl, string text, Encoding encoding )
18+
: base( responseUrl, WebResponseType.JavaScript, success, text, encoding ) {
1219
}
1320

1421
/// <summary>

NScrape/PlaintextWebResponse.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ namespace NScrape {
77
/// </summary>
88
public class PlainTextWebResponse : TextWebResponse {
99

10-
public PlainTextWebResponse( bool success, Uri url, string text, Encoding encoding )
11-
: base( url, WebResponseType.PlainText, success, text, encoding ) {
10+
/// <summary>
11+
/// Initializes a new instance of the <see cref="PlainTextWebResponse"/> class.
12+
/// </summary>
13+
/// <param name="success"><b>true</b> if the response is considered successful, <b>false</b> otherwise.</param>
14+
/// <param name="responseUrl">The URL of the response.</param>
15+
/// <param name="text">The plain text of the response.</param>
16+
/// <param name="encoding">The encoding of the plain text.</param>
17+
public PlainTextWebResponse( bool success, Uri responseUrl, string text, Encoding encoding )
18+
: base( responseUrl, WebResponseType.PlainText, success, text, encoding ) {
1219
}
1320

1421
/// <summary>

0 commit comments

Comments
 (0)