Skip to content

Commit b4af995

Browse files
committed
Fix .gitattributes to solve line ending issues
Fix line endings
1 parent d917647 commit b4af995

File tree

9 files changed

+590
-589
lines changed

9 files changed

+590
-589
lines changed

.gitattributes

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###############################################################################
22
# Set default behavior to automatically normalize line endings.
33
###############################################################################
4-
#* text=auto
4+
* text=auto
55

66
###############################################################################
77
# Set default behavior for command prompt diff.
@@ -10,8 +10,9 @@
1010
# default for csharp files.
1111
# Note: This is only used by command line
1212
###############################################################################
13-
#*.cs diff=csharp
14-
13+
*.cs text diff=csharp
14+
*.sln text eol=crlf
15+
*.csproj text eol=crlf
1516
###############################################################################
1617
# Set the merge driver for project and solution files
1718
#

RedditSharp.sln

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 11.00
3-
# Visual Studio 2010
4-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedditSharp", "RedditSharp\RedditSharp.csproj", "{A368CB75-75F0-4489-904D-B5CEBB0FE624}"
5-
EndProject
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRedditSharp", "TestRedditSharp\TestRedditSharp.csproj", "{0101B252-0CCE-4572-8882-D5851FE41E4F}"
7-
EndProject
8-
Global
9-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10-
Debug|Any CPU = Debug|Any CPU
11-
Debug|Mixed Platforms = Debug|Mixed Platforms
12-
Debug|x86 = Debug|x86
13-
Release|Any CPU = Release|Any CPU
14-
Release|Mixed Platforms = Release|Mixed Platforms
15-
Release|x86 = Release|x86
16-
EndGlobalSection
17-
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
29-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Any CPU.Build.0 = Debug|Any CPU
31-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
32-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
33-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|x86.ActiveCfg = Debug|Any CPU
34-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|x86.Build.0 = Debug|Any CPU
35-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Any CPU.ActiveCfg = Release|Any CPU
36-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Any CPU.Build.0 = Release|Any CPU
37-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
38-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Mixed Platforms.Build.0 = Release|Any CPU
39-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|x86.ActiveCfg = Release|Any CPU
40-
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|x86.Build.0 = Release|Any CPU
41-
EndGlobalSection
42-
GlobalSection(MonoDevelopProperties) = preSolution
43-
StartupItem = TestRedditSharp\TestRedditSharp.csproj
44-
EndGlobalSection
45-
GlobalSection(SolutionProperties) = preSolution
46-
HideSolutionNode = FALSE
47-
EndGlobalSection
48-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedditSharp", "RedditSharp\RedditSharp.csproj", "{A368CB75-75F0-4489-904D-B5CEBB0FE624}"
5+
EndProject
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRedditSharp", "TestRedditSharp\TestRedditSharp.csproj", "{0101B252-0CCE-4572-8882-D5851FE41E4F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Debug|Mixed Platforms = Debug|Mixed Platforms
12+
Debug|x86 = Debug|x86
13+
Release|Any CPU = Release|Any CPU
14+
Release|Mixed Platforms = Release|Mixed Platforms
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
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
29+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
32+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
33+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|x86.ActiveCfg = Debug|Any CPU
34+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Debug|x86.Build.0 = Debug|Any CPU
35+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
38+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|Mixed Platforms.Build.0 = Release|Any CPU
39+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|x86.ActiveCfg = Release|Any CPU
40+
{A368CB75-75F0-4489-904D-B5CEBB0FE624}.Release|x86.Build.0 = Release|Any CPU
41+
EndGlobalSection
42+
GlobalSection(MonoDevelopProperties) = preSolution
43+
StartupItem = TestRedditSharp\TestRedditSharp.csproj
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
EndGlobal

RedditSharp/Reddit.cs

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class Reddit
3636
private const string PopularSubredditsUrl = "/subreddits/popular.json";
3737
private const string GoldSubredditsUrl = "/subreddits/gold.json";
3838
private const string DefaultSubredditsUrl = "/subreddits/default.json";
39-
private const string SearchSubredditsUrl = "/subreddits/search.json?q={0}";
39+
private const string SearchSubredditsUrl = "/subreddits/search.json?q={0}";
4040

4141

4242
#endregion
@@ -129,35 +129,35 @@ public Reddit(string accessToken)
129129
WebAgent.AccessToken = accessToken;
130130
InitOrUpdateUser();
131131
}
132-
/// <summary>
133-
/// Creates a Reddit instance with the given WebAgent implementation
134-
/// </summary>
132+
/// <summary>
133+
/// Creates a Reddit instance with the given WebAgent implementation
134+
/// </summary>
135135
/// <param name="agent">Implementation of IWebAgent interface. Used to generate requests.</param>
136-
public Reddit(IWebAgent agent)
137-
{
138-
WebAgent = agent;
139-
JsonSerializerSettings = new JsonSerializerSettings
140-
{
141-
CheckAdditionalContent = false,
142-
DefaultValueHandling = DefaultValueHandling.Ignore
136+
public Reddit(IWebAgent agent)
137+
{
138+
WebAgent = agent;
139+
JsonSerializerSettings = new JsonSerializerSettings
140+
{
141+
CheckAdditionalContent = false,
142+
DefaultValueHandling = DefaultValueHandling.Ignore
143143
};
144-
CaptchaSolver = new ConsoleCaptchaSolver();
144+
CaptchaSolver = new ConsoleCaptchaSolver();
145145
}
146-
/// <summary>
147-
/// Creates a Reddit instance with the given WebAgent implementation
148-
/// </summary>
146+
/// <summary>
147+
/// Creates a Reddit instance with the given WebAgent implementation
148+
/// </summary>
149149
/// <param name="agent">Implementation of IWebAgent interface. Used to generate requests.</param>
150150
/// <param name="initUser">Whether to run InitOrUpdateUser, requires <paramref name="agent"/> to have credentials first.</param>
151-
public Reddit(IWebAgent agent, bool initUser)
152-
{
153-
WebAgent = agent;
154-
JsonSerializerSettings = new JsonSerializerSettings
155-
{
156-
CheckAdditionalContent = false,
157-
DefaultValueHandling = DefaultValueHandling.Ignore
151+
public Reddit(IWebAgent agent, bool initUser)
152+
{
153+
WebAgent = agent;
154+
JsonSerializerSettings = new JsonSerializerSettings
155+
{
156+
CheckAdditionalContent = false,
157+
DefaultValueHandling = DefaultValueHandling.Ignore
158158
};
159-
CaptchaSolver = new ConsoleCaptchaSolver();
160-
if(initUser) InitOrUpdateUser();
159+
CaptchaSolver = new ConsoleCaptchaSolver();
160+
if(initUser) InitOrUpdateUser();
161161
}
162162

163163
/// <summary>
@@ -401,18 +401,18 @@ public Listing<T> Search<T>(string query, Sorting sortE = Sorting.Relevance, Tim
401401
string sort = sortE.ToString().ToLower();
402402
string time = timeE.ToString().ToLower();
403403
return new Listing<T>(this, string.Format(SearchUrl, query, sort, time), WebAgent);
404-
}
405-
406-
public Listing<T> SearchByTimestamp<T>(DateTime from, DateTime to, string query = "", string subreddit = "", Sorting sortE = Sorting.Relevance, TimeSorting timeE = TimeSorting.All) where T : Thing
407-
{
408-
string sort = sortE.ToString().ToLower();
409-
string time = timeE.ToString().ToLower();
410-
411-
var fromUnix = (from - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
412-
var toUnix = (to - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
413-
414-
string searchQuery = "(and+timestamp:" + fromUnix + ".." + toUnix + "+'" + query + "'+" + "subreddit:'" + subreddit + "')&syntax=cloudsearch";
415-
return new Listing<T>(this, string.Format(SearchUrl, searchQuery, sort, time), WebAgent);
404+
}
405+
406+
public Listing<T> SearchByTimestamp<T>(DateTime from, DateTime to, string query = "", string subreddit = "", Sorting sortE = Sorting.Relevance, TimeSorting timeE = TimeSorting.All) where T : Thing
407+
{
408+
string sort = sortE.ToString().ToLower();
409+
string time = timeE.ToString().ToLower();
410+
411+
var fromUnix = (from - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
412+
var toUnix = (to - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
413+
414+
string searchQuery = "(and+timestamp:" + fromUnix + ".." + toUnix + "+'" + query + "'+" + "subreddit:'" + subreddit + "')&syntax=cloudsearch";
415+
return new Listing<T>(this, string.Format(SearchUrl, searchQuery, sort, time), WebAgent);
416416
}
417417

418418
#region SubredditSearching
@@ -451,15 +451,15 @@ public Listing<Subreddit> GetGoldSubreddits()
451451
public Listing<Subreddit> GetDefaultSubreddits()
452452
{
453453
return new Listing<Subreddit>(this, DefaultSubredditsUrl, WebAgent);
454-
}
455-
456-
/// <summary>
457-
/// Returns the Listing of subreddits related to a query.
458-
/// </summary>
459-
/// <returns></returns>
460-
public Listing<Subreddit> SearchSubreddits(string query)
461-
{
462-
return new Listing<Subreddit>(this, string.Format(SearchSubredditsUrl, query), WebAgent);
454+
}
455+
456+
/// <summary>
457+
/// Returns the Listing of subreddits related to a query.
458+
/// </summary>
459+
/// <returns></returns>
460+
public Listing<Subreddit> SearchSubreddits(string query)
461+
{
462+
return new Listing<Subreddit>(this, string.Format(SearchSubredditsUrl, query), WebAgent);
463463
}
464464

465465
#endregion SubredditSearching

RedditSharp/TBUserNote.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
7-
namespace RedditSharp
8-
{
9-
public class TBUserNote
10-
{
11-
public int NoteTypeIndex { get; set; }
12-
public string NoteType { get; set; }
13-
public string SubName { get; set; }
14-
public string Submitter { get; set; }
15-
public int SubmitterIndex { get; set; }
16-
public string Message { get; set; }
17-
public string AppliesToUsername { get; set; }
18-
public string Url { get; set; }
19-
private DateTime _timestamp;
20-
public DateTime Timestamp
21-
{
22-
get { return _timestamp; }
23-
set
24-
{
25-
_timestamp = DateTime.SpecifyKind(value, DateTimeKind.Utc);
26-
}
27-
}
28-
}
29-
}
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace RedditSharp
8+
{
9+
public class TBUserNote
10+
{
11+
public int NoteTypeIndex { get; set; }
12+
public string NoteType { get; set; }
13+
public string SubName { get; set; }
14+
public string Submitter { get; set; }
15+
public int SubmitterIndex { get; set; }
16+
public string Message { get; set; }
17+
public string AppliesToUsername { get; set; }
18+
public string Url { get; set; }
19+
private DateTime _timestamp;
20+
public DateTime Timestamp
21+
{
22+
get { return _timestamp; }
23+
set
24+
{
25+
_timestamp = DateTime.SpecifyKind(value, DateTimeKind.Utc);
26+
}
27+
}
28+
}
29+
}

RedditSharp/Things/Comment.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace RedditSharp.Things
1313
public class Comment : VotableThing
1414
{
1515
private const string CommentUrl = "/api/comment";
16-
private const string EditUserTextUrl = "/api/editusertext";
17-
private const string RemoveUrl = "/api/remove";
16+
private const string EditUserTextUrl = "/api/editusertext";
17+
private const string RemoveUrl = "/api/remove";
1818
private const string DelUrl = "/api/del";
1919
private const string SetAsReadUrl = "/api/read_message";
2020

@@ -119,16 +119,16 @@ public override string Shortlink
119119
{
120120
get
121121
{
122-
// Not really a "short" link, but you can't actually use short links for comments
123-
string linkId = "";
124-
int index = this.LinkId.IndexOf('_');
125-
if (index > -1)
126-
{
127-
linkId = this.LinkId.Substring(index + 1);
128-
}
129-
122+
// Not really a "short" link, but you can't actually use short links for comments
123+
string linkId = "";
124+
int index = this.LinkId.IndexOf('_');
125+
if (index > -1)
126+
{
127+
linkId = this.LinkId.Substring(index + 1);
128+
}
129+
130130
return String.Format("{0}://{1}/r/{2}/comments/{3}/_/{4}",
131-
RedditSharp.WebAgent.Protocol, RedditSharp.WebAgent.RootDomain,
131+
RedditSharp.WebAgent.Protocol, RedditSharp.WebAgent.RootDomain,
132132
this.Subreddit, this.Parent != null ? this.Parent.Id : linkId, this.Id);
133133
}
134134
}
@@ -188,28 +188,28 @@ public void EditText(string newText)
188188
Body = newText;
189189
else
190190
throw new Exception("Error editing text.");
191-
}
192-
193-
private string SimpleAction(string endpoint)
194-
{
195-
if (Reddit.User == null)
196-
throw new AuthenticationException("No user logged in.");
197-
var request = WebAgent.CreatePost(endpoint);
198-
var stream = request.GetRequestStream();
199-
WebAgent.WritePostBody(stream, new
200-
{
201-
id = FullName,
202-
uh = Reddit.User.Modhash
203-
});
204-
stream.Close();
205-
var response = request.GetResponse();
206-
var data = WebAgent.GetResponseString(response.GetResponseStream());
207-
return data;
208-
}
209-
210-
public void Del()
211-
{
212-
var data = SimpleAction(DelUrl);
191+
}
192+
193+
private string SimpleAction(string endpoint)
194+
{
195+
if (Reddit.User == null)
196+
throw new AuthenticationException("No user logged in.");
197+
var request = WebAgent.CreatePost(endpoint);
198+
var stream = request.GetRequestStream();
199+
WebAgent.WritePostBody(stream, new
200+
{
201+
id = FullName,
202+
uh = Reddit.User.Modhash
203+
});
204+
stream.Close();
205+
var response = request.GetResponse();
206+
var data = WebAgent.GetResponseString(response.GetResponseStream());
207+
return data;
208+
}
209+
210+
public void Del()
211+
{
212+
var data = SimpleAction(DelUrl);
213213
}
214214

215215
public void Remove()

0 commit comments

Comments
 (0)