File tree Expand file tree Collapse file tree 4 files changed +45
-16
lines changed Expand file tree Collapse file tree 4 files changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,6 @@ public class Reddit
41
41
42
42
#endregion
43
43
44
- #region Static Variables
45
-
46
- static Reddit ( )
47
- {
48
- DefaultWebAgent . UserAgent = "" ;
49
- DefaultWebAgent . RateLimit = DefaultWebAgent . RateLimitMode . Pace ;
50
- DefaultWebAgent . Protocol = "https" ;
51
- DefaultWebAgent . RootDomain = "www.reddit.com" ;
52
- }
53
-
54
- #endregion
55
44
56
45
internal IWebAgent WebAgent { get ; set ; }
57
46
/// <summary>
Original file line number Diff line number Diff line change 105
105
<Compile Include =" ToolBoxUserNotes.cs" />
106
106
<Compile Include =" Exceptions\ToolBoxUserNotesException.cs" />
107
107
</ItemGroup >
108
- <ItemGroup />
108
+ <ItemGroup >
109
+ <None Include =" RedditSharp.nuspec" />
110
+ </ItemGroup >
109
111
<Import Project =" $(MSBuildToolsPath)\Microsoft.CSharp.targets" />
110
112
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
111
113
Other similar extension points exist, see Microsoft.Common.targets.
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <package xmlns : xsd =" http://www.w3.org/2001/XMLSchema" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" >
3
+ <metadata xmlns =" http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" >
4
+ <id >RedditSharp</id >
5
+ <version >1.1.0</version >
6
+ <authors >Meepster23</authors >
7
+ <owners >RobIII, Meepster23</owners >
8
+ <licenseUrl >https://github.com/CrustyJew/RedditSharp/blob/master/LICENSE</licenseUrl >
9
+ <projectUrl >https://github.com/CrustyJew/RedditSharp</projectUrl >
10
+ <requireLicenseAcceptance >false</requireLicenseAcceptance >
11
+ <description >C# Implementation of the Reddit API</description >
12
+ <tags >Reddit API</tags >
13
+ <iconUrl >http://i.imgur.com/8ONCXMl.png</iconUrl >
14
+ <releaseNotes >
15
+ Minor bugfixes, tweaks and improvements
16
+ </releaseNotes >
17
+ <summary >
18
+ RedditSharp is a .NET library for working with the Reddit API. It is incomplete. If you want
19
+ more features out of it, you are expected to add them yourself and submit a pull request on
20
+ GitHub. More details are available in the README.
21
+ </summary >
22
+ <language >en-US</language >
23
+ <dependencies >
24
+ <dependency id =" Newtonsoft.Json" version =" 8.0.3" />
25
+ <dependency id =" HtmlAgilityPack" version =" 1.4.9" />
26
+ </dependencies >
27
+ </metadata >
28
+ <files >
29
+ <file src =" \RedditSharp\bin\Release\RedditSharp.dll" target =" lib" />
30
+ </files >
31
+ </package >
Original file line number Diff line number Diff line change @@ -75,25 +75,32 @@ public enum RateLimitMode
75
75
/// <summary>
76
76
/// UTC DateTime of last request made to Reddit API
77
77
/// </summary>
78
- public DateTime LastRequest
78
+ public DateTime LastRequest
79
79
{
80
80
get { return _lastRequest ; }
81
81
}
82
82
/// <summary>
83
83
/// UTC DateTime of when the last burst started
84
84
/// </summary>
85
- public DateTime BurstStart
85
+ public DateTime BurstStart
86
86
{
87
87
get { return _burstStart ; }
88
88
}
89
89
/// <summary>
90
90
/// Number of requests made during the current burst
91
91
/// </summary>
92
- public int RequestsThisBurst
92
+ public int RequestsThisBurst
93
93
{
94
94
get { return _requestsThisBurst ; }
95
95
}
96
96
97
+ static WebAgent ( )
98
+ {
99
+ UserAgent = "" ;
100
+ RateLimit = RateLimitMode . Pace ;
101
+ Protocol = "https" ;
102
+ RootDomain = "www.reddit.com" ;
103
+ }
97
104
98
105
public virtual JToken CreateAndExecuteRequest ( string url )
99
106
{
@@ -174,7 +181,7 @@ protected virtual void EnforceRateLimit()
174
181
switch ( RateLimit )
175
182
{
176
183
case RateLimitMode . Pace :
177
- while ( ( DateTime . UtcNow - _lastRequest ) . TotalSeconds < 60.0 / limitRequestsPerMinute ) // Rate limiting
184
+ while ( ( DateTime . UtcNow - _lastRequest ) . TotalSeconds < 60.0 / limitRequestsPerMinute ) // Rate limiting
178
185
Thread . Sleep ( 250 ) ;
179
186
_lastRequest = DateTime . UtcNow ;
180
187
break ;
You can’t perform that action at this time.
0 commit comments