Skip to content

Commit 9a10daa

Browse files
chuggafanCrustyJew
authored andcommitted
Redoing all of my changes because of SirCrown (#1)
* Changed quite a few methods to have Async counterparts, all internals I will keep async as you shouldn't be using them outside of the public methods * Did a ton of code cleanup * Moving more stuff into folders for orginization * Added the TINIEST ammount of unit testing * I just discovered I had a bug that didn't allow for compilation, fixed it
1 parent be7cf94 commit 9a10daa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+694
-269
lines changed

RedditSharp.sln

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 11.00
3-
# Visual Studio 2010
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
46
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedditSharp", "RedditSharp\RedditSharp.csproj", "{A368CB75-75F0-4489-904D-B5CEBB0FE624}"
57
EndProject
68
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRedditSharp", "TestRedditSharp\TestRedditSharp.csproj", "{0101B252-0CCE-4572-8882-D5851FE41E4F}"
79
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "UnitTesting\UnitTesting.csproj", "{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}"
11+
ProjectSection(ProjectDependencies) = postProject
12+
{A368CB75-75F0-4489-904D-B5CEBB0FE624} = {A368CB75-75F0-4489-904D-B5CEBB0FE624}
13+
EndProjectSection
14+
EndProject
815
Global
916
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1017
Debug|Any CPU = Debug|Any CPU
@@ -15,17 +22,6 @@ Global
1522
Release|x86 = Release|x86
1623
EndGlobalSection
1724
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Any CPU.ActiveCfg = Debug|x86
19-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Any CPU.Build.0 = Debug|x86
20-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
21-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Mixed Platforms.Build.0 = Debug|x86
22-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|x86.ActiveCfg = Debug|x86
23-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|x86.Build.0 = Debug|x86
24-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|Any CPU.ActiveCfg = Release|x86
25-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|Mixed Platforms.ActiveCfg = Release|x86
26-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|Mixed Platforms.Build.0 = Release|x86
27-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|x86.ActiveCfg = Release|x86
28-
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|x86.Build.0 = Release|x86
2925
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3026
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Any CPU.Build.0 = Debug|Any CPU
3127
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -38,11 +34,34 @@ Global
3834
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Mixed Platforms.Build.0 = Release|Any CPU
3935
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|x86.ActiveCfg = Release|Any CPU
4036
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|x86.Build.0 = Release|Any CPU
41-
EndGlobalSection
42-
GlobalSection(MonoDevelopProperties) = preSolution
43-
StartupItem = TestRedditSharp\TestRedditSharp.csproj
37+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Any CPU.ActiveCfg = Debug|x86
38+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Any CPU.Build.0 = Debug|x86
39+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
40+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|Mixed Platforms.Build.0 = Debug|x86
41+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|x86.ActiveCfg = Debug|x86
42+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Debug|x86.Build.0 = Debug|x86
43+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|Any CPU.ActiveCfg = Release|x86
44+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|Mixed Platforms.ActiveCfg = Release|x86
45+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|Mixed Platforms.Build.0 = Release|x86
46+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|x86.ActiveCfg = Release|x86
47+
{0101B252-0CCE-4572-8882-D5851FE41E4F}.Release|x86.Build.0 = Release|x86
48+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Debug|Any CPU.Build.0 = Debug|Any CPU
50+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
51+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
52+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Debug|x86.ActiveCfg = Debug|Any CPU
53+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Debug|x86.Build.0 = Debug|Any CPU
54+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
57+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Release|Mixed Platforms.Build.0 = Release|Any CPU
58+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Release|x86.ActiveCfg = Release|Any CPU
59+
{A4640FC9-F8A5-4B11-A9FE-8FEB626B2080}.Release|x86.Build.0 = Release|Any CPU
4460
EndGlobalSection
4561
GlobalSection(SolutionProperties) = preSolution
4662
HideSolutionNode = FALSE
4763
EndGlobalSection
64+
GlobalSection(MonoDevelopProperties) = preSolution
65+
StartupItem = TestRedditSharp\TestRedditSharp.csproj
66+
EndGlobalSection
4867
EndGlobal

RedditSharp/AuthProvider.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
using Newtonsoft.Json.Linq;
2+
using RedditSharp.Things;
13
using System;
24
using System.Net;
35
using System.Security.Authentication;
46
using System.Text;
5-
using Newtonsoft.Json.Linq;
6-
using RedditSharp.Things;
77

88
namespace RedditSharp
99
{
@@ -82,7 +82,7 @@ public AuthProvider(string clientId, string clientSecret, string redirectUri,IWe
8282
/// <returns></returns>
8383
public string GetAuthUrl(string state, Scope scope, bool permanent = false)
8484
{
85-
return String.Format("https://ssl.reddit.com/api/v1/authorize?client_id={0}&response_type=code&state={1}&redirect_uri={2}&duration={3}&scope={4}", _clientId, state, _redirectUri, permanent ? "permanent" : "temporary", scope.ToString().Replace(" ",""));
85+
return string.Format("https://ssl.reddit.com/api/v1/authorize?client_id={0}&response_type=code&state={1}&redirect_uri={2}&duration={3}&scope={4}", _clientId, state, _redirectUri, permanent ? "permanent" : "temporary", scope.ToString().Replace(" ",""));
8686
}
8787

8888
/// <summary>
@@ -198,7 +198,7 @@ public void RevokeToken(string token, bool isRefresh)
198198
public AuthenticatedUser GetUser(string accessToken)
199199
{
200200
var request = _webAgent.CreateGet(OauthGetMeUrl);
201-
request.Headers["Authorization"] = String.Format("bearer {0}", accessToken);
201+
request.Headers["Authorization"] = string.Format("bearer {0}", accessToken);
202202
var response = (HttpWebResponse)request.GetResponse();
203203
var result = _webAgent.GetResponseString(response.GetResponseStream());
204204
var thingjson = "{\"kind\": \"t2\", \"data\": " + result + "}";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)