Skip to content

Commit e272575

Browse files
committed
tabs vs spaces
reformatting to spaces. updating rebracer to force spaces.
1 parent f6050c2 commit e272575

File tree

5 files changed

+245
-244
lines changed

5 files changed

+245
-244
lines changed

Rebracer.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
</ToolsOptionsSubCategory>
2222
</ToolsOptionsCategory>
2323
<ToolsOptionsCategory name="TextEditor">
24-
<ToolsOptionsSubCategory name="CSharp-Specific">
24+
<ToolsOptionsSubCategory name="CSharp">
25+
<PropertyValue name="InsertTabs">false</PropertyValue>
26+
</ToolsOptionsSubCategory>
27+
<ToolsOptionsSubCategory name="CSharp-Specific">
28+
<PropertyValue name="InsertTabs">false</PropertyValue>
2529
<PropertyValue name="AddImport_SuggestForTypesInNuGetPackages">0</PropertyValue>
2630
<PropertyValue name="AddImport_SuggestForTypesInReferenceAssemblies">0</PropertyValue>
2731
<PropertyValue name="AutoComment">1</PropertyValue>

RedditSharp/Things/Comment.cs

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -43,56 +43,56 @@ public Comment Init(Reddit reddit, JToken json, IWebAgent webAgent, Thing sender
4343
return this;
4444
}
4545

46-
public Comment PopulateComments(IEnumerator<Thing> things)
47-
{
48-
Thing first = things.Current;
49-
Dictionary<string, Tuple<Comment, List<Comment>>> comments = new Dictionary<string, Tuple<Comment, List<Comment>>>();
50-
comments[this.FullName] = Tuple.Create<Comment, List<Comment>>(this, new List<Comment>());
51-
52-
while (things.MoveNext() && (first is Comment || first is More) )
53-
{
54-
first = things.Current;
55-
if (first is Comment)
56-
{
57-
Comment comment = (Comment)first;
58-
comments[comment.FullName] = Tuple.Create<Comment, List<Comment>>(comment, new List<Comment>());
59-
if (comments.ContainsKey(comment.ParentId))
60-
{
61-
comments[comment.ParentId].Item2.Add(comment);
62-
}
63-
else if (comment.ParentId == this.ParentId)
64-
{
65-
//only want sub comments.
66-
break;
67-
}
68-
}
69-
else if (first is More)
70-
{
71-
More more = (More)first;
72-
if (comments.ContainsKey(more.ParentId))
73-
{
74-
comments[more.ParentId].Item1.More = more;
75-
}
76-
else if (more.ParentId == this.ParentId)
77-
{
78-
// This is more for parent.
79-
// Need to process the comments dictionary.
80-
break;
81-
}
82-
}
83-
//things.MoveNext();
84-
85-
}
86-
87-
foreach (KeyValuePair<string, Tuple<Comment, List<Comment>>> kvp in comments)
88-
{
89-
kvp.Value.Item1.Comments = kvp.Value.Item2.ToArray();
90-
}
91-
92-
return this;
93-
}
94-
95-
private JToken CommonInit(Reddit reddit, JToken json, IWebAgent webAgent, Thing sender)
46+
public Comment PopulateComments(IEnumerator<Thing> things)
47+
{
48+
Thing first = things.Current;
49+
Dictionary<string, Tuple<Comment, List<Comment>>> comments = new Dictionary<string, Tuple<Comment, List<Comment>>>();
50+
comments[this.FullName] = Tuple.Create<Comment, List<Comment>>(this, new List<Comment>());
51+
52+
while (things.MoveNext() && (first is Comment || first is More))
53+
{
54+
first = things.Current;
55+
if (first is Comment)
56+
{
57+
Comment comment = (Comment)first;
58+
comments[comment.FullName] = Tuple.Create<Comment, List<Comment>>(comment, new List<Comment>());
59+
if (comments.ContainsKey(comment.ParentId))
60+
{
61+
comments[comment.ParentId].Item2.Add(comment);
62+
}
63+
else if (comment.ParentId == this.ParentId)
64+
{
65+
//only want sub comments.
66+
break;
67+
}
68+
}
69+
else if (first is More)
70+
{
71+
More more = (More)first;
72+
if (comments.ContainsKey(more.ParentId))
73+
{
74+
comments[more.ParentId].Item1.More = more;
75+
}
76+
else if (more.ParentId == this.ParentId)
77+
{
78+
// This is more for parent.
79+
// Need to process the comments dictionary.
80+
break;
81+
}
82+
}
83+
//things.MoveNext();
84+
85+
}
86+
87+
foreach (KeyValuePair<string, Tuple<Comment, List<Comment>>> kvp in comments)
88+
{
89+
kvp.Value.Item1.Comments = kvp.Value.Item2.ToArray();
90+
}
91+
92+
return this;
93+
}
94+
95+
private JToken CommonInit(Reddit reddit, JToken json, IWebAgent webAgent, Thing sender)
9696
{
9797
Init(reddit, webAgent, json);
9898
var data = json["data"];
@@ -106,7 +106,7 @@ private JToken CommonInit(Reddit reddit, JToken json, IWebAgent webAgent, Thing
106106
var context = data["context"].Value<string>();
107107
LinkId = context.Split('/')[4];
108108
}
109-
109+
110110
return data;
111111
}
112112
private async Task<JToken> CommonInitAsync(Reddit reddit, JToken json, IWebAgent webAgent, Thing sender)
@@ -135,7 +135,7 @@ private void ParseComments(Reddit reddit, JToken data, IWebAgent webAgent, Thing
135135
if (replies != null && replies.Count() > 0)
136136
{
137137
foreach (var comment in replies["data"]["children"])
138-
subComments.Add( new Comment().Init(reddit, comment, webAgent, sender));
138+
subComments.Add(new Comment().Init(reddit, comment, webAgent, sender));
139139
}
140140
Comments = subComments.ToArray();
141141
}
@@ -182,10 +182,10 @@ private async Task ParseCommentsAsync(Reddit reddit, JToken data, IWebAgent webA
182182
[JsonProperty("stickied")]
183183
public bool IsStickied { get; set; }
184184

185-
[JsonIgnore]
186-
public More More { get; set; }
185+
[JsonIgnore]
186+
public More More { get; set; }
187187

188-
[JsonIgnore]
188+
[JsonIgnore]
189189
public IList<Comment> Comments { get; private set; }
190190

191191
[JsonIgnore]
@@ -332,11 +332,11 @@ public void SetAsRead()
332332
{
333333
var request = WebAgent.CreatePost(SetAsReadUrl);
334334
WebAgent.WritePostBody(request.GetRequestStream(), new
335-
{
336-
id = FullName,
337-
uh = Reddit.User.Modhash,
338-
api_type = "json"
339-
});
335+
{
336+
id = FullName,
337+
uh = Reddit.User.Modhash,
338+
api_type = "json"
339+
});
340340
var response = request.GetResponse();
341341
var data = WebAgent.GetResponseString(response.GetResponseStream());
342342
}

RedditSharp/Things/Post.cs

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ public Comment Comment(string message)
164164
var request = WebAgent.CreatePost(CommentUrl);
165165
var stream = request.GetRequestStream();
166166
WebAgent.WritePostBody(stream, new
167-
{
168-
text = message,
169-
thing_id = FullName,
170-
uh = Reddit.User.Modhash,
171-
api_type = "json"
172-
});
167+
{
168+
text = message,
169+
thing_id = FullName,
170+
uh = Reddit.User.Modhash,
171+
api_type = "json"
172+
});
173173
stream.Close();
174174
var response = request.GetResponse();
175175
var data = WebAgent.GetResponseString(response.GetResponseStream());
@@ -206,7 +206,7 @@ private string SimpleActionToggle(string endpoint, bool value, bool requiresModA
206206
if (requiresModAction && !modNameList.Contains(Reddit.User.Name))
207207
throw new AuthenticationException(
208208
string.Format(
209-
@"User {0} is not a moderator of subreddit {1}.",
209+
@"User {0} is not a moderator of subreddit {1}.",
210210
Reddit.User.Name,
211211
this.Subreddit.Name));
212212

@@ -351,7 +351,7 @@ public void SetFlair(string flairText, string flairClass)
351351
if (Reddit.User == null)
352352
throw new Exception("No user logged in.");
353353

354-
var request = WebAgent.CreatePost(string.Format(SetFlairUrl,SubredditName));
354+
var request = WebAgent.CreatePost(string.Format(SetFlairUrl, SubredditName));
355355
WebAgent.WritePostBody(request.GetRequestStream(), new
356356
{
357357
api_type = "json",
@@ -385,66 +385,66 @@ public List<Comment> ListComments(int? limit = null)
385385
var postJson = json.Last()["data"]["children"];
386386

387387
var comments = new List<Comment>();
388-
foreach (var comment in postJson)
389-
{
390-
Comment newComment = new Comment().Init(Reddit, comment, WebAgent, this);
391-
if (newComment.Kind == "more")
392-
{
393-
}
394-
else
395-
{
396-
comments.Add(newComment);
397-
}
398-
}
399-
400-
return comments;
388+
foreach (var comment in postJson)
389+
{
390+
Comment newComment = new Comment().Init(Reddit, comment, WebAgent, this);
391+
if (newComment.Kind == "more")
392+
{
393+
}
394+
else
395+
{
396+
comments.Add(newComment);
397+
}
398+
}
399+
400+
return comments;
401401
}
402402

403-
public IEnumerable<Comment> EnumerateComments()
404-
{
405-
var url = string.Format(GetCommentsUrl, Id);
406-
var request = WebAgent.CreateGet(url);
407-
var response = request.GetResponse();
408-
var data = WebAgent.GetResponseString(response.GetResponseStream());
409-
var json = JArray.Parse(data);
410-
var postJson = json.Last()["data"]["children"];
411-
More moreComments = null;
412-
foreach (var comment in postJson)
413-
{
414-
Comment newComment = new Comment().Init(Reddit, comment, WebAgent, this);
415-
if (newComment.Kind == "more")
416-
{
417-
moreComments = new More().Init(Reddit, comment, WebAgent);
418-
}
419-
else
420-
{
421-
yield return newComment;
422-
}
423-
}
424-
425-
426-
if (moreComments != null)
427-
{
428-
IEnumerator<Thing> things = moreComments.Things().GetEnumerator();
429-
things.MoveNext();
430-
Thing currentThing = null;
431-
while (currentThing != things.Current)
432-
{
433-
currentThing = things.Current;
434-
if (things.Current is Comment)
435-
{
436-
Comment next = ((Comment)things.Current).PopulateComments(things);
437-
yield return next;
438-
}
439-
if (things.Current is More)
440-
{
441-
More more = (More)things.Current;
442-
if(more.ParentId != FullName) break;
443-
things = more.Things().GetEnumerator();
444-
things.MoveNext();
445-
}
446-
}
447-
}
448-
}
449-
}
403+
public IEnumerable<Comment> EnumerateComments()
404+
{
405+
var url = string.Format(GetCommentsUrl, Id);
406+
var request = WebAgent.CreateGet(url);
407+
var response = request.GetResponse();
408+
var data = WebAgent.GetResponseString(response.GetResponseStream());
409+
var json = JArray.Parse(data);
410+
var postJson = json.Last()["data"]["children"];
411+
More moreComments = null;
412+
foreach (var comment in postJson)
413+
{
414+
Comment newComment = new Comment().Init(Reddit, comment, WebAgent, this);
415+
if (newComment.Kind == "more")
416+
{
417+
moreComments = new More().Init(Reddit, comment, WebAgent);
418+
}
419+
else
420+
{
421+
yield return newComment;
422+
}
423+
}
424+
425+
426+
if (moreComments != null)
427+
{
428+
IEnumerator<Thing> things = moreComments.Things().GetEnumerator();
429+
things.MoveNext();
430+
Thing currentThing = null;
431+
while (currentThing != things.Current)
432+
{
433+
currentThing = things.Current;
434+
if (things.Current is Comment)
435+
{
436+
Comment next = ((Comment)things.Current).PopulateComments(things);
437+
yield return next;
438+
}
439+
if (things.Current is More)
440+
{
441+
More more = (More)things.Current;
442+
if (more.ParentId != FullName) break;
443+
things = more.Things().GetEnumerator();
444+
things.MoveNext();
445+
}
446+
}
447+
}
448+
}
449+
}
450450
}

RedditSharp/Things/Thing.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public static async Task<Thing> ParseAsync(Reddit reddit, JToken json, IWebAgent
6969
return await new Subreddit().InitAsync(reddit, json, webAgent);
7070
case "modaction":
7171
return await new ModAction().InitAsync(reddit, json, webAgent);
72-
case "more":
73-
return await new More().InitAsync(reddit, json, webAgent);
72+
case "more":
73+
return await new More().InitAsync(reddit, json, webAgent);
7474
default:
7575
return null;
7676
}
@@ -134,10 +134,10 @@ public static async Task<Thing> ParseAsync<T>(Reddit reddit, JToken json, IWebAg
134134
{
135135
return await new BannedUser().InitAsync(reddit, json, webAgent);
136136
}
137-
else if(typeof(T) == typeof(More))
138-
{
139-
return await new More().InitAsync(reddit, json, webAgent);
140-
}
137+
else if (typeof(T) == typeof(More))
138+
{
139+
return await new More().InitAsync(reddit, json, webAgent);
140+
}
141141
}
142142
return result;
143143
}
@@ -162,10 +162,10 @@ public static Thing Parse<T>(Reddit reddit, JToken json, IWebAgent webAgent) whe
162162
{
163163
return new BannedUser().Init(reddit, json, webAgent);
164164
}
165-
else if(typeof(T) == typeof(More))
166-
{
167-
return new More().Init(reddit, json, webAgent);
168-
}
165+
else if (typeof(T) == typeof(More))
166+
{
167+
return new More().Init(reddit, json, webAgent);
168+
}
169169
}
170170
return result;
171171
}

0 commit comments

Comments
 (0)