Skip to content

Commit 4241105

Browse files
committed
Support CoreTweet 0.3.3
1 parent 3a8990f commit 4241105

File tree

6 files changed

+28
-22
lines changed

6 files changed

+28
-22
lines changed

CoreTweetSupplement.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<copyright>(c) 2014 azyobuzin</copyright>
1313
<tags>Twitter</tags>
1414
<dependencies>
15-
<dependency id="CoreTweet" version="(, 0.3.2]" />
15+
<dependency id="CoreTweet" version="0.3.3" />
1616
<dependency id="Newtonsoft.Json" version="4.5.11" />
1717
</dependencies>
1818
</metadata>

CoreTweetSupplement/CoreTweetSupplement.cs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Globalization;
44
using System.Linq;
55
using System.Text.RegularExpressions;
6-
using CoreTweet.Core;
76

87
namespace CoreTweet
98
{
@@ -98,16 +97,16 @@ private class TextPart : ITextPart
9897
internal int End { get; set; }
9998
public string RawText { get; set; }
10099
public string Text { get; set; }
101-
public CoreBase Entity { get; set; }
100+
public Entity Entity { get; set; }
102101
}
103102

104103
/// <summary>
105104
/// Enumerates parts split into Tweet Entities.
106105
/// </summary>
107106
/// <param name="text">The text such as <see cref="CoreTweet.Status.Text"/>, <see cref="CoreTweet.DirectMessage.Text"/> and <see cref="CoreTweet.User.Description"/>.</param>
108-
/// <param name="entities">The <see cref="CoreTweet.Entity"/> instance.</param>
107+
/// <param name="entities">The <see cref="CoreTweet.Entities"/> instance.</param>
109108
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable{CoreTweet.ITextPart}"/> whose elements are parts of <paramref name="text"/>.</returns>
110-
public static IEnumerable<ITextPart> EnumerateTextParts(string text, Entity entities)
109+
public static IEnumerable<ITextPart> EnumerateTextParts(string text, Entities entities)
111110
{
112111
if (entities == null)
113112
{
@@ -120,7 +119,7 @@ public static IEnumerable<ITextPart> EnumerateTextParts(string text, Entity enti
120119
}
121120

122121
var list = new LinkedList<TextPart>(
123-
(entities.HashTags ?? Enumerable.Empty<HashTag>())
122+
(entities.HashTags ?? Enumerable.Empty<SymbolEntity>())
124123
.Select(e => new TextPart()
125124
{
126125
Type = TextPartType.Hashtag,
@@ -131,31 +130,32 @@ public static IEnumerable<ITextPart> EnumerateTextParts(string text, Entity enti
131130
Entity = e
132131
})
133132
.Concat(
134-
(entities.Media ?? Enumerable.Empty<Media>())
133+
(entities.Symbols ?? Enumerable.Empty<SymbolEntity>())
135134
.Select(e => new TextPart()
136135
{
137-
Type = TextPartType.Url,
136+
Type = TextPartType.Cashtag,
138137
Start = e.Indices[0],
139138
End = e.Indices[1],
140-
RawText = e.Url.ToString(),
141-
Text = e.DisplayUrl,
139+
RawText = "$" + e.Text,
140+
Text = "$" + e.Text,
142141
Entity = e
143142
})
144143
)
145144
.Concat(
146-
(entities.Urls ?? Enumerable.Empty<Url>())
145+
(entities.Urls ?? Enumerable.Empty<UrlEntity>())
146+
.Concat(entities.Media ?? Enumerable.Empty<UrlEntity>())
147147
.Select(e => new TextPart()
148148
{
149149
Type = TextPartType.Url,
150150
Start = e.Indices[0],
151151
End = e.Indices[1],
152-
RawText = e.Uri.ToString(),
152+
RawText = e.Url.ToString(),
153153
Text = e.DisplayUrl,
154154
Entity = e
155155
})
156156
)
157157
.Concat(
158-
(entities.UserMentions ?? Enumerable.Empty<UserMention>())
158+
(entities.UserMentions ?? Enumerable.Empty<UserMentionEntity>())
159159
.Select(e => new TextPart()
160160
{
161161
Type = TextPartType.UserMention,
@@ -264,19 +264,25 @@ public enum TextPartType
264264

265265
/// <summary>
266266
/// Hashtag.
267-
/// <see cref="CoreTweet.ITextPart.Entity"/> will be a <see cref="CoreTweet.HashTag" /> instance.
267+
/// <see cref="CoreTweet.ITextPart.Entity"/> will be a <see cref="CoreTweet.SymbolEntity" /> instance.
268268
/// </summary>
269269
Hashtag,
270270

271+
/// <summary>
272+
/// Cashtag.
273+
/// <see cref="CoreTweet.ITextPart.Entity"/> will be a <see cref="CoreTweet.SymbolEntity" /> instance.
274+
/// </summary>
275+
Cashtag,
276+
271277
/// <summary>
272278
/// URL.
273-
/// <see cref="CoreTweet.ITextPart.Entity"/> will be a <see cref="CoreTweet.Url" /> instance.
279+
/// <see cref="CoreTweet.ITextPart.Entity"/> will be a <see cref="CoreTweet.UrlEntity" /> instance.
274280
/// </summary>
275281
Url,
276282

277283
/// <summary>
278284
/// User mention.
279-
/// <see cref="CoreTweet.ITextPart.Entity"/> will be a <see cref="CoreTweet.UserMention" /> instance.
285+
/// <see cref="CoreTweet.ITextPart.Entity"/> will be a <see cref="CoreTweet.UserMentionEntity" /> instance.
280286
/// </summary>
281287
UserMention
282288
}
@@ -304,6 +310,6 @@ public interface ITextPart
304310
/// <summary>
305311
/// The base entity information.
306312
/// </summary>
307-
CoreBase Entity { get; }
313+
Entity Entity { get; }
308314
}
309315
}

CoreTweetSupplement/CoreTweetSupplement.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</ItemGroup>
4848
<ItemGroup>
4949
<Reference Include="CoreTweet">
50-
<HintPath>..\packages\CoreTweet.0.3.2\lib\portable-net4+sl5+wp8+win8+MonoAndroid+MonoTouch\CoreTweet.dll</HintPath>
50+
<HintPath>..\packages\CoreTweet.0.3.3\lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid+MonoTouch\CoreTweet.dll</HintPath>
5151
</Reference>
5252
<Reference Include="Newtonsoft.Json">
5353
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll</HintPath>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="CoreTweet" version="0.3.3" targetFramework="portable-net40+sl50+win+wpa81+wp80+MonoAndroid10+MonoTouch10" />
34
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="portable-net40+sl4+wp7+win8" />
4-
<package id="CoreTweet" version="0.3.2" targetFramework="portable-net4+sl5+wp8+win8+MonoAndroid+MonoTouch" />
55
</packages>

CoreTweetSupplementTest/CoreTweetSupplementTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</PropertyGroup>
4343
<ItemGroup>
4444
<Reference Include="CoreTweet">
45-
<HintPath>..\packages\CoreTweet.0.3.2\lib\net45\CoreTweet.dll</HintPath>
45+
<HintPath>..\packages\CoreTweet.0.3.3\lib\net45\CoreTweet.dll</HintPath>
4646
</Reference>
4747
<Reference Include="Microsoft.CSharp" />
4848
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="ChainingAssertion" version="1.7.1.0" targetFramework="net45" />
4-
<package id="CoreTweet" version="0.3.2" targetFramework="net45" />
4+
<package id="CoreTweet" version="0.3.3" targetFramework="net45" />
55
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" />
66
</packages>

0 commit comments

Comments
 (0)