開発に使用するリポジトリ
Revisão | 3b03e11b563bf0decdee7bf110f34c3a9ae4c803 (tree) |
---|---|
Hora | 2013-07-07 03:40:55 |
Autor | Kimura Youichi <kim.upsilon@bucy...> |
Commiter | Kimura Youichi |
Nullable<T> 型を積極的に使うように変更
もぅ post.RetweetedId > 0 とかマヂ無理。リファクタリングしよ…
このコミットによる変更で、これまで値が存在しないことを表すために 0 が使用されて
いたフィールドの型が Nullable<T> に変更されています。
具体的には PostStatus.RetweetedId や PostStatus.InReplyToStatusId などが long 型
から long? (Nullable<long>) 型に変更されました。また、HttpTwitter クラスでは、
Twitter API をコールするメソッドで任意とされているパラメータ (since_id や count
など) の型が Nullable<T> に変更されています。
これによって、例えば post.InReplyToStatusId > 0 のようにしてツイートがリプライで
あるか否かを判定していたコードが、これからは post.InReplyToStatusId != null と
記述するようになります。
派生プロジェクトにおいては、派生版のコードをマージする際に InReplyToStatusId や
RetweetedId などを使用したり HttpTwitter クラスのメソッドを使用したりするコード
が存在しないか確認し、もし存在すればそれらのコードの修正が必要か否か注意深く確認
して下さい。
@@ -188,7 +188,7 @@ namespace OpenTween | ||
188 | 188 | public static object[] GetStatusUrlTest1_TestCase = |
189 | 189 | { |
190 | 190 | new object[] { |
191 | - new PostClass { StatusId = 249493863826350080L, ScreenName = "Favstar_LM", RetweetedId = 0L, RetweetedBy = null }, | |
191 | + new PostClass { StatusId = 249493863826350080L, ScreenName = "Favstar_LM", RetweetedId = null, RetweetedBy = null }, | |
192 | 192 | "https://twitter.com/Favstar_LM/status/249493863826350080", |
193 | 193 | }, |
194 | 194 | new object[] { |
@@ -49,7 +49,7 @@ namespace OpenTween | ||
49 | 49 | bool IsOwl = false, |
50 | 50 | bool IsMark = false, |
51 | 51 | string InReplyToUser = null, |
52 | - long InReplyToStatusId = 0L, | |
52 | + long? InReplyToStatusId = null, | |
53 | 53 | string Source = null, |
54 | 54 | string SourceHtml = null, |
55 | 55 | List<string> ReplyToList = null, |
@@ -58,7 +58,7 @@ namespace OpenTween | ||
58 | 58 | long userId = 0L, |
59 | 59 | bool FilterHit = false, |
60 | 60 | string RetweetedBy = null, |
61 | - long RetweetedId = 0L, | |
61 | + long? RetweetedId = null, | |
62 | 62 | StatusGeo Geo = null) : |
63 | 63 | base(Nickname, textFromApi, text, ImageUrl, screenName, createdAt, statusId, IsFav, IsRead, |
64 | 64 | IsReply, IsExcludeReply, IsProtect, IsOwl, IsMark, InReplyToUser, InReplyToStatusId, Source, |
@@ -124,8 +124,8 @@ namespace OpenTween | ||
124 | 124 | post.IsFav = isFav; |
125 | 125 | Assert.That(post.IsFav, Is.EqualTo(isFav)); |
126 | 126 | |
127 | - if (post.RetweetedId != 0) | |
128 | - Assert.That(PostClassTest.TestCases[post.RetweetedId].IsFav, Is.EqualTo(isFav)); | |
127 | + if (post.RetweetedId != null) | |
128 | + Assert.That(PostClassTest.TestCases[post.RetweetedId.Value].IsFav, Is.EqualTo(isFav)); | |
129 | 129 | } |
130 | 130 | |
131 | 131 | [Test, Combinatorial] |
@@ -144,7 +144,7 @@ namespace OpenTween | ||
144 | 144 | post.IsMark = mark; |
145 | 145 | if (mark) except |= 0x02; |
146 | 146 | |
147 | - post.InReplyToStatusId = reply ? 100L : 0L; | |
147 | + post.InReplyToStatusId = reply ? (long?)100L : null; | |
148 | 148 | if (reply) except |= 0x04; |
149 | 149 | |
150 | 150 | post.PostGeo = geo ? new PostClass.StatusGeo { Lat = -47.15, Lng = -126.716667 } : new PostClass.StatusGeo(); |
@@ -169,9 +169,9 @@ namespace OpenTween | ||
169 | 169 | |
170 | 170 | post.IsDeleted = true; |
171 | 171 | |
172 | - Assert.That(post.InReplyToStatusId, Is.EqualTo(0L)); | |
172 | + Assert.That(post.InReplyToStatusId, Is.Null); | |
173 | 173 | Assert.That(post.InReplyToUser, Is.EqualTo("")); |
174 | - Assert.That(post.InReplyToUserId, Is.EqualTo(0L)); | |
174 | + Assert.That(post.InReplyToUserId, Is.Null); | |
175 | 175 | Assert.That(post.IsReply, Is.False); |
176 | 176 | Assert.That(post.ReplyToList, Is.Empty); |
177 | 177 | Assert.That(post.StateIndex, Is.EqualTo(-1)); |
@@ -69,7 +69,7 @@ namespace OpenTween | ||
69 | 69 | { |
70 | 70 | var posts = new Dictionary<long, PostClass> |
71 | 71 | { |
72 | - {950L, new PostClass { StatusId = 950L, InReplyToStatusId = 0L }}, // このツイートが末端 | |
72 | + {950L, new PostClass { StatusId = 950L, InReplyToStatusId = null }}, // このツイートが末端 | |
73 | 73 | {987L, new PostClass { StatusId = 987L, InReplyToStatusId = 950L }}, |
74 | 74 | {999L, new PostClass { StatusId = 999L, InReplyToStatusId = 987L }}, |
75 | 75 | {1000L, new PostClass { StatusId = 1000L, InReplyToStatusId = 999L }}, |
@@ -60,7 +60,7 @@ namespace OpenTween | ||
60 | 60 | public int MapThumbnailZoom; |
61 | 61 | public bool IsListStatusesIncludeRts; |
62 | 62 | public List<UserAccount> UserAccounts; |
63 | - private long InitialUserId; | |
63 | + private long? InitialUserId; | |
64 | 64 | public bool TabMouseLock; |
65 | 65 | public bool IsRemoveSameEvent; |
66 | 66 | public bool IsNotifyUseGrowl; |
@@ -520,7 +520,7 @@ namespace OpenTween | ||
520 | 520 | } |
521 | 521 | //アクティブユーザーを起動時のアカウントに戻す(起動時アカウントなければ何もしない) |
522 | 522 | bool userSet = false; |
523 | - if (this.InitialUserId > 0) | |
523 | + if (this.InitialUserId != null) | |
524 | 524 | { |
525 | 525 | foreach (UserAccount u in this.UserAccounts) |
526 | 526 | { |
@@ -191,11 +191,11 @@ namespace OpenTween | ||
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | - public HttpStatusCode UpdateStatus(string status, long replyToId, ref string content) | |
194 | + public HttpStatusCode UpdateStatus(string status, long? replyToId, ref string content) | |
195 | 195 | { |
196 | 196 | Dictionary<string, string> param = new Dictionary<string, string>(); |
197 | 197 | param.Add("status", status); |
198 | - if (replyToId > 0) param.Add("in_reply_to_status_id", replyToId.ToString()); | |
198 | + if (replyToId != null) param.Add("in_reply_to_status_id", replyToId.ToString()); | |
199 | 199 | param.Add("include_entities", "true"); |
200 | 200 | //if (AppendSettingDialog.Instance.ShortenTco && AppendSettingDialog.Instance.UrlConvertAuto) param.Add("wrap_links", "true") |
201 | 201 |
@@ -207,12 +207,12 @@ namespace OpenTween | ||
207 | 207 | null); |
208 | 208 | } |
209 | 209 | |
210 | - public HttpStatusCode UpdateStatusWithMedia(string status, long replyToId, FileInfo mediaFile, ref string content) | |
210 | + public HttpStatusCode UpdateStatusWithMedia(string status, long? replyToId, FileInfo mediaFile, ref string content) | |
211 | 211 | { |
212 | 212 | //画像投稿用エンドポイント |
213 | 213 | Dictionary<string, string> param = new Dictionary<string, string>(); |
214 | 214 | param.Add("status", status); |
215 | - if (replyToId > 0) param.Add("in_reply_to_status_id", replyToId.ToString()); | |
215 | + if (replyToId != null) param.Add("in_reply_to_status_id", replyToId.ToString()); | |
216 | 216 | param.Add("include_entities", "true"); |
217 | 217 | //if (AppendSettingDialog.Instance.ShortenTco && AppendSettingDialog.Instance.UrlConvertAuto) param.Add("wrap_links", "true") |
218 | 218 |
@@ -416,14 +416,14 @@ namespace OpenTween | ||
416 | 416 | null); |
417 | 417 | } |
418 | 418 | |
419 | - public HttpStatusCode HomeTimeline(int count, long max_id, long since_id, ref string content) | |
419 | + public HttpStatusCode HomeTimeline(int? count, long? max_id, long? since_id, ref string content) | |
420 | 420 | { |
421 | 421 | Dictionary<string, string> param = new Dictionary<string, string>(); |
422 | - if (count > 0) | |
422 | + if (count != null) | |
423 | 423 | param.Add("count", count.ToString()); |
424 | - if (max_id > 0) | |
424 | + if (max_id != null) | |
425 | 425 | param.Add("max_id", max_id.ToString()); |
426 | - if (since_id > 0) | |
426 | + if (since_id != null) | |
427 | 427 | param.Add("since_id", since_id.ToString()); |
428 | 428 | |
429 | 429 | param.Add("include_entities", "true"); |
@@ -436,22 +436,22 @@ namespace OpenTween | ||
436 | 436 | HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/home_timeline") : GetApiCallback); |
437 | 437 | } |
438 | 438 | |
439 | - public HttpStatusCode UserTimeline(long user_id, string screen_name, int count, long max_id, long since_id, ref string content) | |
439 | + public HttpStatusCode UserTimeline(long? user_id, string screen_name, int? count, long? max_id, long? since_id, ref string content) | |
440 | 440 | { |
441 | 441 | Dictionary<string, string> param = new Dictionary<string, string>(); |
442 | 442 | |
443 | - if ((user_id == 0 && string.IsNullOrEmpty(screen_name)) || | |
444 | - (user_id != 0 && !string.IsNullOrEmpty(screen_name))) return HttpStatusCode.BadRequest; | |
443 | + if ((user_id == null && string.IsNullOrEmpty(screen_name)) || | |
444 | + (user_id != null && !string.IsNullOrEmpty(screen_name))) return HttpStatusCode.BadRequest; | |
445 | 445 | |
446 | - if (user_id > 0) | |
446 | + if (user_id != null) | |
447 | 447 | param.Add("user_id", user_id.ToString()); |
448 | 448 | if (!string.IsNullOrEmpty(screen_name)) |
449 | 449 | param.Add("screen_name", screen_name); |
450 | - if (count > 0) | |
450 | + if (count != null) | |
451 | 451 | param.Add("count", count.ToString()); |
452 | - if (max_id > 0) | |
452 | + if (max_id != null) | |
453 | 453 | param.Add("max_id", max_id.ToString()); |
454 | - if (since_id > 0) | |
454 | + if (since_id != null) | |
455 | 455 | param.Add("since_id", since_id.ToString()); |
456 | 456 | |
457 | 457 | param.Add("include_rts", "true"); |
@@ -465,14 +465,14 @@ namespace OpenTween | ||
465 | 465 | HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/user_timeline") : GetApiCallback); |
466 | 466 | } |
467 | 467 | |
468 | - public HttpStatusCode PublicTimeline(int count, long max_id, long since_id, ref string content) | |
468 | + public HttpStatusCode PublicTimeline(int? count, long? max_id, long? since_id, ref string content) | |
469 | 469 | { |
470 | 470 | Dictionary<string, string> param = new Dictionary<string, string>(); |
471 | - if (count > 0) | |
471 | + if (count != null) | |
472 | 472 | param.Add("count", count.ToString()); |
473 | - if (max_id > 0) | |
473 | + if (max_id != null) | |
474 | 474 | param.Add("max_id", max_id.ToString()); |
475 | - if (since_id > 0) | |
475 | + if (since_id != null) | |
476 | 476 | param.Add("since_id", since_id.ToString()); |
477 | 477 | |
478 | 478 | param.Add("include_entities", "true"); |
@@ -487,14 +487,14 @@ namespace OpenTween | ||
487 | 487 | GetApiCallback); |
488 | 488 | } |
489 | 489 | |
490 | - public HttpStatusCode Mentions(int count, long max_id, long since_id, ref string content) | |
490 | + public HttpStatusCode Mentions(int? count, long? max_id, long? since_id, ref string content) | |
491 | 491 | { |
492 | 492 | Dictionary<string, string> param = new Dictionary<string, string>(); |
493 | - if (count > 0) | |
493 | + if (count != null) | |
494 | 494 | param.Add("count", count.ToString()); |
495 | - if (max_id > 0) | |
495 | + if (max_id != null) | |
496 | 496 | param.Add("max_id", max_id.ToString()); |
497 | - if (since_id > 0) | |
497 | + if (since_id != null) | |
498 | 498 | param.Add("since_id", since_id.ToString()); |
499 | 499 | |
500 | 500 | param.Add("include_entities", "true"); |
@@ -507,14 +507,14 @@ namespace OpenTween | ||
507 | 507 | HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/mentions_timeline") : GetApiCallback); |
508 | 508 | } |
509 | 509 | |
510 | - public HttpStatusCode DirectMessages(int count, long max_id, long since_id, ref string content) | |
510 | + public HttpStatusCode DirectMessages(int? count, long? max_id, long? since_id, ref string content) | |
511 | 511 | { |
512 | 512 | Dictionary<string, string> param = new Dictionary<string, string>(); |
513 | - if (count > 0) | |
513 | + if (count != null) | |
514 | 514 | param.Add("count", count.ToString()); |
515 | - if (max_id > 0) | |
515 | + if (max_id != null) | |
516 | 516 | param.Add("max_id", max_id.ToString()); |
517 | - if (since_id > 0) | |
517 | + if (since_id != null) | |
518 | 518 | param.Add("since_id", since_id.ToString()); |
519 | 519 | param.Add("include_entities", "true"); |
520 | 520 |
@@ -526,14 +526,14 @@ namespace OpenTween | ||
526 | 526 | HttpTwitter.API11Enabled ? CreateApi11Calllback("/direct_messages") : GetApiCallback); |
527 | 527 | } |
528 | 528 | |
529 | - public HttpStatusCode DirectMessagesSent(int count, long max_id, long since_id, ref string content) | |
529 | + public HttpStatusCode DirectMessagesSent(int? count, long? max_id, long? since_id, ref string content) | |
530 | 530 | { |
531 | 531 | Dictionary<string, string> param = new Dictionary<string, string>(); |
532 | - if (count > 0) | |
532 | + if (count != null) | |
533 | 533 | param.Add("count", count.ToString()); |
534 | - if (max_id > 0) | |
534 | + if (max_id != null) | |
535 | 535 | param.Add("max_id", max_id.ToString()); |
536 | - if (since_id > 0) | |
536 | + if (since_id != null) | |
537 | 537 | param.Add("since_id", since_id.ToString()); |
538 | 538 | param.Add("include_entities", "true"); |
539 | 539 |
@@ -545,12 +545,12 @@ namespace OpenTween | ||
545 | 545 | HttpTwitter.API11Enabled ? CreateApi11Calllback("/direct_messages/sent") : GetApiCallback); |
546 | 546 | } |
547 | 547 | |
548 | - public HttpStatusCode Favorites(int count, int page, ref string content) | |
548 | + public HttpStatusCode Favorites(int? count, int? page, ref string content) | |
549 | 549 | { |
550 | 550 | Dictionary<string, string> param = new Dictionary<string, string>(); |
551 | - if (count != 20) param.Add("count", count.ToString()); | |
551 | + if (count != null) param.Add("count", count.ToString()); | |
552 | 552 | |
553 | - if (page > 0) | |
553 | + if (page != null) | |
554 | 554 | { |
555 | 555 | param.Add("page", page.ToString()); |
556 | 556 | } |
@@ -587,16 +587,16 @@ namespace OpenTween | ||
587 | 587 | MyCommon.GetAssemblyName()); |
588 | 588 | } |
589 | 589 | |
590 | - public HttpStatusCode PhoenixSearch(string words, string lang, int rpp, int page, long sinceId, ref string content) | |
590 | + public HttpStatusCode PhoenixSearch(string words, string lang, int? rpp, int? page, long? sinceId, ref string content) | |
591 | 591 | { |
592 | 592 | Dictionary<string, string> param = new Dictionary<string, string>(); |
593 | 593 | if (!string.IsNullOrEmpty(words)) param.Add("q", words); |
594 | 594 | param.Add("include_entities", "1"); |
595 | 595 | param.Add("contributor_details", "true"); |
596 | 596 | if (!string.IsNullOrEmpty(lang)) param.Add("lang", lang); |
597 | - if (rpp > 0) param.Add("rpp", rpp.ToString()); | |
598 | - if (page > 0) param.Add("page", page.ToString()); | |
599 | - if (sinceId > 0) param.Add("since_id", sinceId.ToString()); | |
597 | + if (rpp != null) param.Add("rpp", rpp.ToString()); | |
598 | + if (page != null) param.Add("page", page.ToString()); | |
599 | + if (sinceId != null) param.Add("since_id", sinceId.ToString()); | |
600 | 600 | |
601 | 601 | if (param.Count == 0) return HttpStatusCode.BadRequest; |
602 | 602 |
@@ -608,14 +608,14 @@ namespace OpenTween | ||
608 | 608 | MyCommon.GetAssemblyName()); |
609 | 609 | } |
610 | 610 | |
611 | - public HttpStatusCode Search(string words, string lang, int count, long maxId, long sinceId, ref string content) | |
611 | + public HttpStatusCode Search(string words, string lang, int? count, long? maxId, long? sinceId, ref string content) | |
612 | 612 | { |
613 | 613 | Dictionary<string, string> param = new Dictionary<string, string>(); |
614 | 614 | if (!string.IsNullOrEmpty(words)) param.Add("q", words); |
615 | 615 | if (!string.IsNullOrEmpty(lang)) param.Add("lang", lang); |
616 | - if (count > 0) param.Add(HttpTwitter.API11Enabled ? "count" : "rpp", count.ToString()); | |
617 | - if (maxId > 0) param.Add("max_id", maxId.ToString()); | |
618 | - if (sinceId > 0) param.Add("since_id", sinceId.ToString()); | |
616 | + if (count != null) param.Add(HttpTwitter.API11Enabled ? "count" : "rpp", count.ToString()); | |
617 | + if (maxId != null) param.Add("max_id", maxId.ToString()); | |
618 | + if (sinceId != null) param.Add("since_id", sinceId.ToString()); | |
619 | 619 | |
620 | 620 | if (param.Count == 0) return HttpStatusCode.BadRequest; |
621 | 621 |
@@ -743,18 +743,18 @@ namespace OpenTween | ||
743 | 743 | HttpTwitter.API11Enabled ? CreateApi11Calllback("/lists/subscriptions") : GetApiCallback); |
744 | 744 | } |
745 | 745 | |
746 | - public HttpStatusCode GetListsStatuses(long userId, long list_id, int per_page, long max_id, long since_id, Boolean isRTinclude, ref string content) | |
746 | + public HttpStatusCode GetListsStatuses(long userId, long list_id, int? per_page, long? max_id, long? since_id, Boolean isRTinclude, ref string content) | |
747 | 747 | { |
748 | 748 | //認証なくても取得できるが、protectedユーザー分が抜ける |
749 | 749 | Dictionary<string, string> param = new Dictionary<string, string>(); |
750 | 750 | param.Add("user_id", userId.ToString()); |
751 | 751 | param.Add("list_id", list_id.ToString()); |
752 | 752 | param.Add("include_rts", isRTinclude ? "true" : "false"); |
753 | - if (per_page > 0) | |
753 | + if (per_page != null) | |
754 | 754 | param.Add(HttpTwitter.API11Enabled ? "count" : "per_page", per_page.ToString()); |
755 | - if (max_id > 0) | |
755 | + if (max_id != null) | |
756 | 756 | param.Add("max_id", max_id.ToString()); |
757 | - if (since_id > 0) | |
757 | + if (since_id != null) | |
758 | 758 | param.Add("since_id", since_id.ToString()); |
759 | 759 | param.Add("include_entities", "true"); |
760 | 760 |
@@ -888,12 +888,12 @@ namespace OpenTween | ||
888 | 888 | } |
889 | 889 | #endregion |
890 | 890 | |
891 | - public HttpStatusCode Statusid_retweeted_by_ids(long statusid, int count, int page, ref string content) | |
891 | + public HttpStatusCode Statusid_retweeted_by_ids(long statusid, int? count, int? page, ref string content) | |
892 | 892 | { |
893 | 893 | Dictionary<string, string> param = new Dictionary<string, string>(); |
894 | - if (count > 0) | |
894 | + if (count != null) | |
895 | 895 | param.Add("count", count.ToString()); |
896 | - if (page > 0) | |
896 | + if (page != null) | |
897 | 897 | param.Add("page", page.ToString()); |
898 | 898 | |
899 | 899 | if (HttpTwitter.API11Enabled) |
@@ -26,7 +26,7 @@ namespace OpenTween | ||
26 | 26 | { |
27 | 27 | string Upload(ref string filePath, |
28 | 28 | ref string message, |
29 | - long reply_to); | |
29 | + long? reply_to); | |
30 | 30 | bool CheckValidExtension(string ext) ; |
31 | 31 | string GetFileOpenDialogFilter(); |
32 | 32 | MyCommon.UploadFileType GetFileType(string ext); |
@@ -63,7 +63,7 @@ namespace OpenTween.Connection | ||
63 | 63 | |
64 | 64 | #region Upload Methods |
65 | 65 | |
66 | - public string Upload(ref string filePath, ref string message, long reply_to) | |
66 | + public string Upload(ref string filePath, ref string message, long? reply_to) | |
67 | 67 | { |
68 | 68 | if (!File.Exists(filePath)) |
69 | 69 | return "Err:File isn't exists."; |
@@ -51,7 +51,7 @@ namespace OpenTween | ||
51 | 51 | |
52 | 52 | private Twitter tw; |
53 | 53 | |
54 | - public string Upload( ref string filePath, ref string message, long reply_to ) | |
54 | + public string Upload( ref string filePath, ref string message, long? reply_to ) | |
55 | 55 | { |
56 | 56 | if ( string.IsNullOrEmpty( filePath ) ) |
57 | 57 | return "Err:File isn't specified."; |
@@ -103,7 +103,7 @@ namespace OpenTween | ||
103 | 103 | return type.Equals( UploadFileType.Picture ); |
104 | 104 | } |
105 | 105 | |
106 | - public string Upload( ref string filePath, ref string message, long reply_to ) | |
106 | + public string Upload( ref string filePath, ref string message, long? reply_to ) | |
107 | 107 | { |
108 | 108 | if ( string.IsNullOrEmpty( filePath ) ) |
109 | 109 | return "Err:File isn't specified."; |
@@ -48,7 +48,7 @@ namespace OpenTween | ||
48 | 48 | |
49 | 49 | private Twitter tw; |
50 | 50 | |
51 | - public string Upload( ref string filePath, ref string message, long reply_to ) | |
51 | + public string Upload( ref string filePath, ref string message, long? reply_to ) | |
52 | 52 | { |
53 | 53 | if ( string.IsNullOrEmpty( filePath ) ) |
54 | 54 | return "Err:File isn't specified."; |
@@ -48,7 +48,7 @@ namespace OpenTween | ||
48 | 48 | |
49 | 49 | private Twitter tw; |
50 | 50 | |
51 | - public string Upload( ref string filePath, ref string message, long reply_to ) | |
51 | + public string Upload( ref string filePath, ref string message, long? reply_to ) | |
52 | 52 | { |
53 | 53 | if ( string.IsNullOrEmpty( filePath ) ) |
54 | 54 | return "Err:File isn't exists."; |
@@ -134,12 +134,12 @@ namespace OpenTween | ||
134 | 134 | [DataMember(Name = "profile_background_image_url_https")] public string ProfileBackgroundImageUrlHttps; |
135 | 135 | [DataMember(Name = "screen_name")] public string ScreenName; |
136 | 136 | [DataMember(Name = "name")] public string Name; |
137 | - [DataMember(Name = "following")] public string Following; | |
137 | + [DataMember(Name = "following")] public bool? Following; | |
138 | 138 | [DataMember(Name = "profile_link_color")] public string ProfileLinkColor; |
139 | 139 | [DataMember(Name = "id")] public Int64 Id; |
140 | 140 | [DataMember(Name = "listed_count")] public int ListedCount; |
141 | 141 | [DataMember(Name = "profile_background_tile")] public bool ProfileBackgroundTile; |
142 | - [DataMember(Name = "utc_offset")] public string UtcOffset; | |
142 | + [DataMember(Name = "utc_offset")] public int? UtcOffset; | |
143 | 143 | [DataMember(Name = "place", IsRequired = false)] public Place Place; |
144 | 144 | [DataMember(Name = "status", IsRequired = false)] public Status Status; |
145 | 145 | } |
@@ -191,18 +191,18 @@ namespace OpenTween | ||
191 | 191 | { |
192 | 192 | [DataMember(Name = "coordinates", IsRequired = false)] public Coordinates Coordinates; |
193 | 193 | [DataMember(Name = "geo", IsRequired = false)] public Geo Geo; |
194 | - [DataMember(Name = "in_reply_to_user_id")] public string InReplyToUserId; | |
194 | + [DataMember(Name = "in_reply_to_user_id")] public long? InReplyToUserId; | |
195 | 195 | [DataMember(Name = "source")] public string Source; |
196 | 196 | [DataMember(Name = "user")] public User User; |
197 | 197 | [DataMember(Name = "in_reply_to_screen_name")] public string InReplyToScreenName; |
198 | 198 | [DataMember(Name = "created_at")] public string CreatedAt; |
199 | 199 | [DataMember(Name = "contributors")] public int[] Contributors; |
200 | 200 | [DataMember(Name = "favorited")] public bool Favorited; |
201 | - [DataMember(Name = "truncated")] public string Truncated; | |
201 | + [DataMember(Name = "truncated")] public bool? Truncated; | |
202 | 202 | [DataMember(Name = "id")] public Int64 Id; |
203 | 203 | [DataMember(Name = "annotations", IsRequired = false)] public Annotations Annotations; |
204 | 204 | [DataMember(Name = "place", IsRequired = false)] public Place Place; |
205 | - [DataMember(Name = "in_reply_to_status_id")] public string InReplyToStatusId; | |
205 | + [DataMember(Name = "in_reply_to_status_id")] public long? InReplyToStatusId; | |
206 | 206 | [DataMember(Name = "text")] public string Text; |
207 | 207 | [DataMember(Name = "entities", IsRequired = false)] public Entities Entities; |
208 | 208 | } |
@@ -213,13 +213,13 @@ namespace OpenTween | ||
213 | 213 | [DataMember(Name = "in_reply_to_status_id_str")] public string InReplyToStatusIdStr; |
214 | 214 | [DataMember(Name = "contributors", IsRequired = false)] public int[] Contributors; |
215 | 215 | [DataMember(Name = "in_reply_to_screen_name")] public string InReplyToScreenName; |
216 | - [DataMember(Name = "in_reply_to_status_id")] public string InReplyToStatusId; | |
216 | + [DataMember(Name = "in_reply_to_status_id")] public long? InReplyToStatusId; | |
217 | 217 | [DataMember(Name = "in_reply_to_user_id_str")] public string InReplyToUserIdStr; |
218 | - [DataMember(Name = "retweet_count")] public string RetweetCount; | |
218 | + [DataMember(Name = "retweet_count")] public int RetweetCount; | |
219 | 219 | [DataMember(Name = "created_at")] public string CreatedAt; |
220 | 220 | [DataMember(Name = "geo", IsRequired = false)] public Geo Geo; |
221 | 221 | [DataMember(Name = "retweeted")] public bool Retweeted; |
222 | - [DataMember(Name = "in_reply_to_user_id")] public string InReplyToUserId; | |
222 | + [DataMember(Name = "in_reply_to_user_id")] public long? InReplyToUserId; | |
223 | 223 | [DataMember(Name = "source")] public string Source; |
224 | 224 | [DataMember(Name = "id_str")] public string IdStr; |
225 | 225 | [DataMember(Name = "coordinates", IsRequired = false)] public Coordinates Coordinates; |
@@ -901,10 +901,10 @@ namespace OpenTween | ||
901 | 901 | |
902 | 902 | public static string GetStatusUrl(PostClass post) |
903 | 903 | { |
904 | - if (post.RetweetedId == 0) | |
904 | + if (post.RetweetedId == null) | |
905 | 905 | return GetStatusUrl(post.ScreenName, post.StatusId); |
906 | 906 | else |
907 | - return GetStatusUrl(post.ScreenName, post.RetweetedId); | |
907 | + return GetStatusUrl(post.ScreenName, post.RetweetedId.Value); | |
908 | 908 | } |
909 | 909 | |
910 | 910 | public static string GetStatusUrl(string screenName, long statusId) |
@@ -70,7 +70,7 @@ namespace OpenTween | ||
70 | 70 | public bool IsOwl { get; set; } |
71 | 71 | private bool _IsMark; |
72 | 72 | public string InReplyToUser { get; set; } |
73 | - private long _InReplyToStatusId; | |
73 | + private long? _InReplyToStatusId; | |
74 | 74 | public string Source { get; set; } |
75 | 75 | public string SourceHtml { get; set; } |
76 | 76 | public List<string> ReplyToList { get; set; } |
@@ -79,12 +79,12 @@ namespace OpenTween | ||
79 | 79 | public long UserId { get; set; } |
80 | 80 | public bool FilterHit { get; set; } |
81 | 81 | public string RetweetedBy { get; set; } |
82 | - public long RetweetedId { get; set; } | |
82 | + public long? RetweetedId { get; set; } | |
83 | 83 | private bool _IsDeleted = false; |
84 | 84 | private StatusGeo _postGeo = new StatusGeo(); |
85 | 85 | public int RetweetedCount { get; set; } |
86 | - public long RetweetedByUserId { get; set; } | |
87 | - public long InReplyToUserId { get; set; } | |
86 | + public long? RetweetedByUserId { get; set; } | |
87 | + public long? InReplyToUserId { get; set; } | |
88 | 88 | public Dictionary<string, string> Media { get; set; } |
89 | 89 | |
90 | 90 | public string RelTabName { get; set; } |
@@ -117,7 +117,7 @@ namespace OpenTween | ||
117 | 117 | bool IsOwl, |
118 | 118 | bool IsMark, |
119 | 119 | string InReplyToUser, |
120 | - long InReplyToStatusId, | |
120 | + long? InReplyToStatusId, | |
121 | 121 | string Source, |
122 | 122 | string SourceHtml, |
123 | 123 | List<string> ReplyToList, |
@@ -126,7 +126,7 @@ namespace OpenTween | ||
126 | 126 | long userId, |
127 | 127 | bool FilterHit, |
128 | 128 | string RetweetedBy, |
129 | - long RetweetedId, | |
129 | + long? RetweetedId, | |
130 | 130 | StatusGeo Geo) |
131 | 131 | : this() |
132 | 132 | { |
@@ -178,9 +178,9 @@ namespace OpenTween | ||
178 | 178 | { |
179 | 179 | get |
180 | 180 | { |
181 | - if (this.RetweetedId > 0 && this.GetRetweetSource(this.RetweetedId) != null) | |
181 | + if (this.RetweetedId != null && this.GetRetweetSource(this.RetweetedId.Value) != null) | |
182 | 182 | { |
183 | - return this.GetRetweetSource(this.RetweetedId).IsFav; | |
183 | + return this.GetRetweetSource(this.RetweetedId.Value).IsFav; | |
184 | 184 | } |
185 | 185 | else |
186 | 186 | { |
@@ -190,9 +190,9 @@ namespace OpenTween | ||
190 | 190 | set |
191 | 191 | { |
192 | 192 | _IsFav = value; |
193 | - if (this.RetweetedId > 0 && this.GetRetweetSource(this.RetweetedId) != null) | |
193 | + if (this.RetweetedId != null && this.GetRetweetSource(this.RetweetedId.Value) != null) | |
194 | 194 | { |
195 | - this.GetRetweetSource(this.RetweetedId).IsFav = value; | |
195 | + this.GetRetweetSource(this.RetweetedId.Value).IsFav = value; | |
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
@@ -235,7 +235,7 @@ namespace OpenTween | ||
235 | 235 | _IsMark = value; |
236 | 236 | } |
237 | 237 | } |
238 | - public long InReplyToStatusId | |
238 | + public long? InReplyToStatusId | |
239 | 239 | { |
240 | 240 | get |
241 | 241 | { |
@@ -243,7 +243,7 @@ namespace OpenTween | ||
243 | 243 | } |
244 | 244 | set |
245 | 245 | { |
246 | - if (value > 0) | |
246 | + if (value != null) | |
247 | 247 | { |
248 | 248 | _states = _states | States.Reply; |
249 | 249 | } |
@@ -265,9 +265,9 @@ namespace OpenTween | ||
265 | 265 | { |
266 | 266 | if (value) |
267 | 267 | { |
268 | - this.InReplyToStatusId = 0; | |
268 | + this.InReplyToStatusId = null; | |
269 | 269 | this.InReplyToUser = ""; |
270 | - this.InReplyToUserId = 0; | |
270 | + this.InReplyToUserId = null; | |
271 | 271 | this.IsReply = false; |
272 | 272 | this.ReplyToList = new List<string>(); |
273 | 273 | this._states = States.None; |
@@ -652,7 +652,7 @@ namespace OpenTween | ||
652 | 652 | tab.Remove(Id); |
653 | 653 | } |
654 | 654 | //FavタブからRetweet発言を削除する場合は、他の同一参照Retweetも削除 |
655 | - if (tType == MyCommon.TabUsageType.Favorites && post.RetweetedId > 0) | |
655 | + if (tType == MyCommon.TabUsageType.Favorites && post.RetweetedId != null) | |
656 | 656 | { |
657 | 657 | for (int i = 0; i < tab.AllCount; i++) |
658 | 658 | { |
@@ -665,7 +665,7 @@ namespace OpenTween | ||
665 | 665 | { |
666 | 666 | break; |
667 | 667 | } |
668 | - if (rPost.RetweetedId > 0 && rPost.RetweetedId == post.RetweetedId) | |
668 | + if (rPost.RetweetedId != null && rPost.RetweetedId == post.RetweetedId) | |
669 | 669 | { |
670 | 670 | if (tab.UnreadManage && !rPost.IsRead) //未読管理 |
671 | 671 | { |
@@ -1198,7 +1198,7 @@ namespace OpenTween | ||
1198 | 1198 | { |
1199 | 1199 | if (Item.IsFav) |
1200 | 1200 | { |
1201 | - if (Item.RetweetedId == 0) | |
1201 | + if (Item.RetweetedId == null) | |
1202 | 1202 | { |
1203 | 1203 | _statuses[Item.StatusId].IsFav = true; |
1204 | 1204 | } |
@@ -1214,16 +1214,17 @@ namespace OpenTween | ||
1214 | 1214 | } |
1215 | 1215 | else |
1216 | 1216 | { |
1217 | - if (Item.IsFav && Item.RetweetedId > 0) Item.IsFav = false; | |
1217 | + if (Item.IsFav && Item.RetweetedId != null) Item.IsFav = false; | |
1218 | 1218 | //既に持っている公式RTは捨てる |
1219 | 1219 | if (AppendSettingDialog.Instance.HideDuplicatedRetweets && |
1220 | 1220 | !Item.IsMe && |
1221 | - this._retweets.ContainsKey(Item.RetweetedId) && | |
1222 | - this._retweets[Item.RetweetedId].RetweetedCount > 0) return; | |
1221 | + Item.RetweetedId != null && | |
1222 | + this._retweets.ContainsKey(Item.RetweetedId.Value) && | |
1223 | + this._retweets[Item.RetweetedId.Value].RetweetedCount > 0) return; | |
1223 | 1224 | if (BlockIds.Contains(Item.UserId)) return; |
1224 | 1225 | _statuses.Add(Item.StatusId, Item); |
1225 | 1226 | } |
1226 | - if (Item.RetweetedId > 0) | |
1227 | + if (Item.RetweetedId != null) | |
1227 | 1228 | { |
1228 | 1229 | this.AddRetweet(Item); |
1229 | 1230 | } |
@@ -1264,19 +1265,21 @@ namespace OpenTween | ||
1264 | 1265 | |
1265 | 1266 | private void AddRetweet(PostClass item) |
1266 | 1267 | { |
1268 | + var retweetedId = item.RetweetedId.Value; | |
1269 | + | |
1267 | 1270 | //true:追加、False:保持済み |
1268 | - if (_retweets.ContainsKey(item.RetweetedId)) | |
1271 | + if (_retweets.ContainsKey(retweetedId)) | |
1269 | 1272 | { |
1270 | - _retweets[item.RetweetedId].RetweetedCount++; | |
1271 | - if (_retweets[item.RetweetedId].RetweetedCount > 10) | |
1273 | + _retweets[retweetedId].RetweetedCount++; | |
1274 | + if (_retweets[retweetedId].RetweetedCount > 10) | |
1272 | 1275 | { |
1273 | - _retweets[item.RetweetedId].RetweetedCount = 0; | |
1276 | + _retweets[retweetedId].RetweetedCount = 0; | |
1274 | 1277 | } |
1275 | 1278 | return; |
1276 | 1279 | } |
1277 | 1280 | |
1278 | 1281 | _retweets.Add( |
1279 | - item.RetweetedId, | |
1282 | + item.RetweetedId.Value, | |
1280 | 1283 | new PostClass( |
1281 | 1284 | item.Nickname, |
1282 | 1285 | item.TextFromApi, |
@@ -1284,7 +1287,7 @@ namespace OpenTween | ||
1284 | 1287 | item.ImageUrl, |
1285 | 1288 | item.ScreenName, |
1286 | 1289 | item.CreatedAt, |
1287 | - item.RetweetedId, | |
1290 | + item.RetweetedId.Value, | |
1288 | 1291 | item.IsFav, |
1289 | 1292 | item.IsRead, |
1290 | 1293 | item.IsReply, |
@@ -1302,11 +1305,11 @@ namespace OpenTween | ||
1302 | 1305 | item.UserId, |
1303 | 1306 | item.FilterHit, |
1304 | 1307 | "", |
1305 | - 0, | |
1308 | + null, | |
1306 | 1309 | item.PostGeo |
1307 | 1310 | ) |
1308 | 1311 | ); |
1309 | - _retweets[item.RetweetedId].RetweetedCount++; | |
1312 | + _retweets[retweetedId].RetweetedCount++; | |
1310 | 1313 | } |
1311 | 1314 | |
1312 | 1315 | public void SetReadAllTab(bool Read, string TabName, int Index) |
@@ -3198,7 +3201,7 @@ namespace OpenTween | ||
3198 | 3201 | } |
3199 | 3202 | if (_isRt) |
3200 | 3203 | { |
3201 | - if (post.RetweetedId == 0) bHit = false; | |
3204 | + if (post.RetweetedId == null) bHit = false; | |
3202 | 3205 | } |
3203 | 3206 | if (!string.IsNullOrEmpty(_source)) |
3204 | 3207 | { |
@@ -3325,7 +3328,7 @@ namespace OpenTween | ||
3325 | 3328 | } |
3326 | 3329 | if (_isExRt) |
3327 | 3330 | { |
3328 | - if (post.RetweetedId > 0) exFlag = true; | |
3331 | + if (post.RetweetedId != null) exFlag = true; | |
3329 | 3332 | } |
3330 | 3333 | if (!string.IsNullOrEmpty(_exSource)) |
3331 | 3334 | { |
@@ -153,7 +153,7 @@ namespace OpenTween | ||
153 | 153 | private int _hisIdx; //発言履歴カレントインデックス |
154 | 154 | |
155 | 155 | //発言投稿時のAPI引数(発言編集時に設定。手書きreplyでは設定されない) |
156 | - private long _reply_to_id; // リプライ先のステータスID 0の場合はリプライではない 注:複数あてのものはリプライではない | |
156 | + private long? _reply_to_id; // リプライ先のステータスID 0の場合はリプライではない 注:複数あてのものはリプライではない | |
157 | 157 | private string _reply_to_name; // リプライ先ステータスの書き込み者の名前 |
158 | 158 | |
159 | 159 | //時速表示用 |
@@ -291,14 +291,14 @@ namespace OpenTween | ||
291 | 291 | private class PostingStatus |
292 | 292 | { |
293 | 293 | public string status = ""; |
294 | - public long inReplyToId = 0; | |
295 | - public string inReplyToName = ""; | |
294 | + public long? inReplyToId = null; | |
295 | + public string inReplyToName = null; | |
296 | 296 | public string imageService = ""; //画像投稿サービス名 |
297 | 297 | public string imagePath = ""; |
298 | 298 | public PostingStatus() |
299 | 299 | { |
300 | 300 | } |
301 | - public PostingStatus(string status, long replyToId, string replyToName) | |
301 | + public PostingStatus(string status, long? replyToId, string replyToName) | |
302 | 302 | { |
303 | 303 | this.status = status; |
304 | 304 | this.inReplyToId = replyToId; |
@@ -588,8 +588,8 @@ namespace OpenTween | ||
588 | 588 | |
589 | 589 | _history.Add(new PostingStatus()); |
590 | 590 | _hisIdx = 0; |
591 | - _reply_to_id = 0; | |
592 | - _reply_to_name = ""; | |
591 | + _reply_to_id = null; | |
592 | + _reply_to_name = null; | |
593 | 593 | |
594 | 594 | //<<<<<<<<<設定関連>>>>>>>>> |
595 | 595 | //設定コンバージョン |
@@ -2017,7 +2017,7 @@ namespace OpenTween | ||
2017 | 2017 | Color cl; |
2018 | 2018 | if (Post.IsFav) |
2019 | 2019 | cl = _clFav; |
2020 | - else if (Post.RetweetedId > 0) | |
2020 | + else if (Post.RetweetedId != null) | |
2021 | 2021 | cl = _clRetweet; |
2022 | 2022 | else if (Post.IsOwl && (Post.IsDm || SettingDialog.OneWayLove)) |
2023 | 2023 | cl = _clOWL; |
@@ -2244,7 +2244,7 @@ namespace OpenTween | ||
2244 | 2244 | //ハッシュタグ |
2245 | 2245 | if (HashMgr.IsNotAddToAtReply) |
2246 | 2246 | { |
2247 | - if (!string.IsNullOrEmpty(HashMgr.UseHash) && _reply_to_id == 0 && string.IsNullOrEmpty(_reply_to_name)) | |
2247 | + if (!string.IsNullOrEmpty(HashMgr.UseHash) && _reply_to_id == null && string.IsNullOrEmpty(_reply_to_name)) | |
2248 | 2248 | { |
2249 | 2249 | if (HashMgr.IsHead) |
2250 | 2250 | header = HashMgr.UseHash + " "; |
@@ -2363,8 +2363,8 @@ namespace OpenTween | ||
2363 | 2363 | OpenUriAsync(tmp); |
2364 | 2364 | } |
2365 | 2365 | |
2366 | - _reply_to_id = 0; | |
2367 | - _reply_to_name = ""; | |
2366 | + _reply_to_id = null; | |
2367 | + _reply_to_name = null; | |
2368 | 2368 | StatusText.Text = ""; |
2369 | 2369 | _history.Add(new PostingStatus()); |
2370 | 2370 | _hisIdx = _history.Count - 1; |
@@ -2496,10 +2496,10 @@ namespace OpenTween | ||
2496 | 2496 | bw.ReportProgress(50, MakeStatusMessage(args, false)); |
2497 | 2497 | if (!post.IsFav) |
2498 | 2498 | { |
2499 | - if (post.RetweetedId == 0) | |
2499 | + if (post.RetweetedId == null) | |
2500 | 2500 | ret = tw.PostFavAdd(post.StatusId); |
2501 | 2501 | else |
2502 | - ret = tw.PostFavAdd(post.RetweetedId); | |
2502 | + ret = tw.PostFavAdd(post.RetweetedId.Value); | |
2503 | 2503 | |
2504 | 2504 | if (ret.Length == 0) |
2505 | 2505 | { |
@@ -2549,10 +2549,10 @@ namespace OpenTween | ||
2549 | 2549 | bw.ReportProgress(50, MakeStatusMessage(args, false)); |
2550 | 2550 | if (post.IsFav) |
2551 | 2551 | { |
2552 | - if (post.RetweetedId == 0) | |
2552 | + if (post.RetweetedId == null) | |
2553 | 2553 | ret = tw.PostFavRemove(post.StatusId); |
2554 | 2554 | else |
2555 | - ret = tw.PostFavRemove(post.RetweetedId); | |
2555 | + ret = tw.PostFavRemove(post.RetweetedId.Value); | |
2556 | 2556 | |
2557 | 2557 | if (ret.Length == 0) |
2558 | 2558 | { |
@@ -3614,7 +3614,7 @@ namespace OpenTween | ||
3614 | 3614 | //} |
3615 | 3615 | if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch |
3616 | 3616 | || !this.ExistCurrentPost |
3617 | - || !(_curPost.InReplyToStatusId > 0)) | |
3617 | + || _curPost.InReplyToStatusId == null) | |
3618 | 3618 | { |
3619 | 3619 | RepliedStatusOpenMenuItem.Enabled = false; |
3620 | 3620 | } |
@@ -5035,8 +5035,8 @@ namespace OpenTween | ||
5035 | 5035 | } |
5036 | 5036 | if (string.IsNullOrEmpty(StatusText.Text)) |
5037 | 5037 | { |
5038 | - _reply_to_id = 0; | |
5039 | - _reply_to_name = ""; | |
5038 | + _reply_to_id = null; | |
5039 | + _reply_to_name = null; | |
5040 | 5040 | } |
5041 | 5041 | } |
5042 | 5042 |
@@ -5238,10 +5238,10 @@ namespace OpenTween | ||
5238 | 5238 | //if (Post.IsDeleted) mk.Append("×"); |
5239 | 5239 | //if (Post.IsMark) mk.Append("♪"); |
5240 | 5240 | //if (Post.IsProtect) mk.Append("Ю"); |
5241 | - //if (Post.InReplyToStatusId > 0) mk.Append("⇒"); | |
5241 | + //if (Post.InReplyToStatusId != null) mk.Append("⇒"); | |
5242 | 5242 | if (Post.FavoritedCount > 0) mk.Append("+" + Post.FavoritedCount.ToString()); |
5243 | 5243 | ImageListViewItem itm; |
5244 | - if (Post.RetweetedId == 0) | |
5244 | + if (Post.RetweetedId == null) | |
5245 | 5245 | { |
5246 | 5246 | string[] sitem= {"", |
5247 | 5247 | Post.Nickname, |
@@ -6221,7 +6221,7 @@ namespace OpenTween | ||
6221 | 6221 | NameLabel.ForeColor = System.Drawing.SystemColors.ControlText; |
6222 | 6222 | DateTimeLabel.Text = _curPost.CreatedAt.ToString(); |
6223 | 6223 | if (_curPost.IsOwl && (SettingDialog.OneWayLove || _statuses.Tabs[_curTab.Text].TabType == MyCommon.TabUsageType.DirectMessage)) NameLabel.ForeColor = _clOWL; |
6224 | - if (_curPost.RetweetedId > 0) NameLabel.ForeColor = _clRetweet; | |
6224 | + if (_curPost.RetweetedId != null) NameLabel.ForeColor = _clRetweet; | |
6225 | 6225 | if (_curPost.IsFav) NameLabel.ForeColor = _clFav; |
6226 | 6226 | |
6227 | 6227 | if (DumpPostClassToolStripMenuItem.Checked) |
@@ -7054,7 +7054,7 @@ namespace OpenTween | ||
7054 | 7054 | if (post.IsDeleted) continue; |
7055 | 7055 | if (!isDm) |
7056 | 7056 | { |
7057 | - if (post.RetweetedId > 0) | |
7057 | + if (post.RetweetedId != null) | |
7058 | 7058 | sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.ScreenName, post.TextSingleLine, post.RetweetedId, Environment.NewLine); |
7059 | 7059 | else |
7060 | 7060 | sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.ScreenName, post.TextSingleLine, post.StatusId, Environment.NewLine); |
@@ -7240,7 +7240,7 @@ namespace OpenTween | ||
7240 | 7240 | } |
7241 | 7241 | |
7242 | 7242 | string name = ""; |
7243 | - if (_curPost.RetweetedId == 0) | |
7243 | + if (_curPost.RetweetedId == null) | |
7244 | 7244 | { |
7245 | 7245 | name = _curPost.ScreenName; |
7246 | 7246 | } |
@@ -7250,7 +7250,7 @@ namespace OpenTween | ||
7250 | 7250 | } |
7251 | 7251 | for (int idx = fIdx; idx != toIdx; idx += stp) |
7252 | 7252 | { |
7253 | - if (_statuses[_curTab.Text, idx].RetweetedId == 0) | |
7253 | + if (_statuses[_curTab.Text, idx].RetweetedId == null) | |
7254 | 7254 | { |
7255 | 7255 | if (_statuses[_curTab.Text, idx].ScreenName == name) |
7256 | 7256 | { |
@@ -7425,7 +7425,7 @@ namespace OpenTween | ||
7425 | 7425 | |
7426 | 7426 | TabClass curTabClass = _statuses.Tabs[_curTab.Text]; |
7427 | 7427 | |
7428 | - if (curTabClass.TabType == MyCommon.TabUsageType.PublicSearch && _curPost.InReplyToStatusId == 0 && _curPost.TextFromApi.Contains("@")) | |
7428 | + if (curTabClass.TabType == MyCommon.TabUsageType.PublicSearch && _curPost.InReplyToStatusId == null && _curPost.TextFromApi.Contains("@")) | |
7429 | 7429 | { |
7430 | 7430 | PostClass post = null; |
7431 | 7431 | string r = tw.GetStatusApi(false, _curPost.StatusId, ref post); |
@@ -7443,17 +7443,17 @@ namespace OpenTween | ||
7443 | 7443 | } |
7444 | 7444 | } |
7445 | 7445 | |
7446 | - if (!(this.ExistCurrentPost && _curPost.InReplyToUser != null && _curPost.InReplyToStatusId > 0)) return; | |
7446 | + if (!(this.ExistCurrentPost && _curPost.InReplyToUser != null && _curPost.InReplyToStatusId != null)) return; | |
7447 | 7447 | |
7448 | 7448 | if (replyChains == null || (replyChains.Count > 0 && replyChains.Peek().InReplyToId != _curPost.StatusId)) |
7449 | 7449 | { |
7450 | 7450 | replyChains = new Stack<ReplyChain>(); |
7451 | 7451 | } |
7452 | - replyChains.Push(new ReplyChain(_curPost.StatusId, _curPost.InReplyToStatusId, _curTab)); | |
7452 | + replyChains.Push(new ReplyChain(_curPost.StatusId, _curPost.InReplyToStatusId.Value, _curTab)); | |
7453 | 7453 | |
7454 | 7454 | int inReplyToIndex; |
7455 | 7455 | string inReplyToTabName; |
7456 | - long inReplyToId = _curPost.InReplyToStatusId; | |
7456 | + long inReplyToId = _curPost.InReplyToStatusId.Value; | |
7457 | 7457 | string inReplyToUser = _curPost.InReplyToUser; |
7458 | 7458 | Dictionary<long, PostClass> curTabPosts; |
7459 | 7459 |
@@ -7479,7 +7479,7 @@ namespace OpenTween | ||
7479 | 7479 | catch (InvalidOperationException) |
7480 | 7480 | { |
7481 | 7481 | PostClass post = null; |
7482 | - string r = tw.GetStatusApi(false, _curPost.InReplyToStatusId, ref post); | |
7482 | + string r = tw.GetStatusApi(false, _curPost.InReplyToStatusId.Value, ref post); | |
7483 | 7483 | if (string.IsNullOrEmpty(r) && post != null) |
7484 | 7484 | { |
7485 | 7485 | post.IsRead = true; |
@@ -7528,7 +7528,7 @@ namespace OpenTween | ||
7528 | 7528 | |
7529 | 7529 | if (parallel) |
7530 | 7530 | { |
7531 | - if (_curPost.InReplyToStatusId != 0) | |
7531 | + if (_curPost.InReplyToStatusId != null) | |
7532 | 7532 | { |
7533 | 7533 | var posts = from t in _statuses.Tabs |
7534 | 7534 | from p in t.Value.IsInnerStorageTabType ? t.Value.Posts : _statuses.Posts |
@@ -8252,8 +8252,8 @@ namespace OpenTween | ||
8252 | 8252 | StatusText.Text = "D " + _curPost.ScreenName + " " + StatusText.Text; |
8253 | 8253 | StatusText.SelectionStart = StatusText.Text.Length; |
8254 | 8254 | StatusText.Focus(); |
8255 | - _reply_to_id = 0; | |
8256 | - _reply_to_name = ""; | |
8255 | + _reply_to_id = null; | |
8256 | + _reply_to_name = null; | |
8257 | 8257 | return; |
8258 | 8258 | } |
8259 | 8259 | if (string.IsNullOrEmpty(StatusText.Text)) |
@@ -8262,9 +8262,9 @@ namespace OpenTween | ||
8262 | 8262 | |
8263 | 8263 | // ステータステキストが入力されていない場合先頭に@ユーザー名を追加する |
8264 | 8264 | StatusText.Text = "@" + _curPost.ScreenName + " "; |
8265 | - if (_curPost.RetweetedId > 0) | |
8265 | + if (_curPost.RetweetedId != null) | |
8266 | 8266 | { |
8267 | - _reply_to_id = _curPost.RetweetedId; | |
8267 | + _reply_to_id = _curPost.RetweetedId.Value; | |
8268 | 8268 | } |
8269 | 8269 | else |
8270 | 8270 | { |
@@ -8281,12 +8281,12 @@ namespace OpenTween | ||
8281 | 8281 | //1件選んでEnter or DoubleClick |
8282 | 8282 | if (StatusText.Text.Contains("@" + _curPost.ScreenName + " ")) |
8283 | 8283 | { |
8284 | - if (_reply_to_id > 0 && _reply_to_name == _curPost.ScreenName) | |
8284 | + if (_reply_to_id != null && _reply_to_name == _curPost.ScreenName) | |
8285 | 8285 | { |
8286 | 8286 | //返信先書き換え |
8287 | - if (_curPost.RetweetedId > 0) | |
8287 | + if (_curPost.RetweetedId != null) | |
8288 | 8288 | { |
8289 | - _reply_to_id = _curPost.RetweetedId; | |
8289 | + _reply_to_id = _curPost.RetweetedId.Value; | |
8290 | 8290 | } |
8291 | 8291 | else |
8292 | 8292 | { |
@@ -8303,16 +8303,16 @@ namespace OpenTween | ||
8303 | 8303 | { |
8304 | 8304 | // 複数リプライ |
8305 | 8305 | StatusText.Text = StatusText.Text.Insert(2, "@" + _curPost.ScreenName + " "); |
8306 | - _reply_to_id = 0; | |
8307 | - _reply_to_name = ""; | |
8306 | + _reply_to_id = null; | |
8307 | + _reply_to_name = null; | |
8308 | 8308 | } |
8309 | 8309 | else |
8310 | 8310 | { |
8311 | 8311 | // 単独リプライ |
8312 | 8312 | StatusText.Text = "@" + _curPost.ScreenName + " " + StatusText.Text; |
8313 | - if (_curPost.RetweetedId > 0) | |
8313 | + if (_curPost.RetweetedId != null) | |
8314 | 8314 | { |
8315 | - _reply_to_id = _curPost.RetweetedId; | |
8315 | + _reply_to_id = _curPost.RetweetedId.Value; | |
8316 | 8316 | } |
8317 | 8317 | else |
8318 | 8318 | { |
@@ -8327,8 +8327,8 @@ namespace OpenTween | ||
8327 | 8327 | // 複数リプライ |
8328 | 8328 | StatusText.Text = ". @" + _curPost.ScreenName + " " + StatusText.Text; |
8329 | 8329 | //StatusText.Text = "@" + _curPost.ScreenName + " " + StatusText.Text; |
8330 | - _reply_to_id = 0; | |
8331 | - _reply_to_name = ""; | |
8330 | + _reply_to_id = null; | |
8331 | + _reply_to_name = null; | |
8332 | 8332 | } |
8333 | 8333 | } |
8334 | 8334 | else |
@@ -8380,8 +8380,8 @@ namespace OpenTween | ||
8380 | 8380 | if (!sTxt.StartsWith(". ")) |
8381 | 8381 | { |
8382 | 8382 | sTxt = ". " + sTxt; |
8383 | - _reply_to_id = 0; | |
8384 | - _reply_to_name = ""; | |
8383 | + _reply_to_id = null; | |
8384 | + _reply_to_name = null; | |
8385 | 8385 | } |
8386 | 8386 | for (int cnt = 0; cnt < _curList.SelectedIndices.Count; cnt++) |
8387 | 8387 | { |
@@ -8432,8 +8432,8 @@ namespace OpenTween | ||
8432 | 8432 | { |
8433 | 8433 | StatusText.Text = ". " + StatusText.Text; |
8434 | 8434 | sidx += 2; |
8435 | - _reply_to_id = 0; | |
8436 | - _reply_to_name = ""; | |
8435 | + _reply_to_id = null; | |
8436 | + _reply_to_name = null; | |
8437 | 8437 | } |
8438 | 8438 | if (sidx > 0) |
8439 | 8439 | { |
@@ -8497,9 +8497,9 @@ namespace OpenTween | ||
8497 | 8497 | StatusText.Text = ids; |
8498 | 8498 | StatusText.SelectionStart = ids.Length; |
8499 | 8499 | StatusText.Focus(); |
8500 | - if (post.RetweetedId > 0) | |
8500 | + if (post.RetweetedId != null) | |
8501 | 8501 | { |
8502 | - _reply_to_id = post.RetweetedId; | |
8502 | + _reply_to_id = post.RetweetedId.Value; | |
8503 | 8503 | } |
8504 | 8504 | else |
8505 | 8505 | { |
@@ -8904,7 +8904,7 @@ namespace OpenTween | ||
8904 | 8904 | if (!SelectTab(out tabName)) return; |
8905 | 8905 | |
8906 | 8906 | fltDialog.SetCurrent(tabName); |
8907 | - if (_statuses[_curTab.Text, idx].RetweetedId == 0) | |
8907 | + if (_statuses[_curTab.Text, idx].RetweetedId == null) | |
8908 | 8908 | { |
8909 | 8909 | fltDialog.AddNewFilter(_statuses[_curTab.Text, idx].ScreenName, _statuses[_curTab.Text, idx].TextFromApi); |
8910 | 8910 | } |
@@ -9062,7 +9062,7 @@ namespace OpenTween | ||
9062 | 9062 | { |
9063 | 9063 | FiltersClass fc = new FiltersClass(); |
9064 | 9064 | ids.Add(post.ScreenName); |
9065 | - if (post.RetweetedId == 0) | |
9065 | + if (post.RetweetedId == null) | |
9066 | 9066 | { |
9067 | 9067 | fc.NameFilter = post.ScreenName; |
9068 | 9068 | } |
@@ -9597,12 +9597,12 @@ namespace OpenTween | ||
9597 | 9597 | } |
9598 | 9598 | |
9599 | 9599 | // リプライ先ステータスIDの指定がない場合は指定しない |
9600 | - if (_reply_to_id == 0) return; | |
9600 | + if (_reply_to_id == null) return; | |
9601 | 9601 | |
9602 | 9602 | // リプライ先ユーザー名がない場合も指定しない |
9603 | 9603 | if (string.IsNullOrEmpty(_reply_to_name)) |
9604 | 9604 | { |
9605 | - _reply_to_id = 0; | |
9605 | + _reply_to_id = null; | |
9606 | 9606 | return; |
9607 | 9607 | } |
9608 | 9608 |
@@ -9627,8 +9627,8 @@ namespace OpenTween | ||
9627 | 9627 | } |
9628 | 9628 | } |
9629 | 9629 | |
9630 | - _reply_to_id = 0; | |
9631 | - _reply_to_name = ""; | |
9630 | + _reply_to_id = null; | |
9631 | + _reply_to_name = null; | |
9632 | 9632 | |
9633 | 9633 | } |
9634 | 9634 |
@@ -9711,28 +9711,28 @@ namespace OpenTween | ||
9711 | 9711 | |
9712 | 9712 | private void doRepliedStatusOpen() |
9713 | 9713 | { |
9714 | - if (this.ExistCurrentPost && _curPost.InReplyToUser != null && _curPost.InReplyToStatusId > 0) | |
9714 | + if (this.ExistCurrentPost && _curPost.InReplyToUser != null && _curPost.InReplyToStatusId != null) | |
9715 | 9715 | { |
9716 | 9716 | if (MyCommon.IsKeyDown(Keys.Shift)) |
9717 | 9717 | { |
9718 | - OpenUriAsync(MyCommon.GetStatusUrl(_curPost.InReplyToUser, _curPost.InReplyToStatusId)); | |
9718 | + OpenUriAsync(MyCommon.GetStatusUrl(_curPost.InReplyToUser, _curPost.InReplyToStatusId.Value)); | |
9719 | 9719 | return; |
9720 | 9720 | } |
9721 | - if (_statuses.ContainsKey(_curPost.InReplyToStatusId)) | |
9721 | + if (_statuses.ContainsKey(_curPost.InReplyToStatusId.Value)) | |
9722 | 9722 | { |
9723 | - PostClass repPost = _statuses[_curPost.InReplyToStatusId]; | |
9723 | + PostClass repPost = _statuses[_curPost.InReplyToStatusId.Value]; | |
9724 | 9724 | MessageBox.Show(repPost.ScreenName + " / " + repPost.Nickname + " (" + repPost.CreatedAt.ToString() + ")" + Environment.NewLine + repPost.TextFromApi); |
9725 | 9725 | } |
9726 | 9726 | else |
9727 | 9727 | { |
9728 | 9728 | foreach (TabClass tb in _statuses.GetTabsByType(MyCommon.TabUsageType.Lists | MyCommon.TabUsageType.PublicSearch)) |
9729 | 9729 | { |
9730 | - if (tb == null || !tb.Contains(_curPost.InReplyToStatusId)) break; | |
9731 | - PostClass repPost = _statuses[_curPost.InReplyToStatusId]; | |
9730 | + if (tb == null || !tb.Contains(_curPost.InReplyToStatusId.Value)) break; | |
9731 | + PostClass repPost = _statuses[_curPost.InReplyToStatusId.Value]; | |
9732 | 9732 | MessageBox.Show(repPost.ScreenName + " / " + repPost.Nickname + " (" + repPost.CreatedAt.ToString() + ")" + Environment.NewLine + repPost.TextFromApi); |
9733 | 9733 | return; |
9734 | 9734 | } |
9735 | - OpenUriAsync(MyCommon.GetStatusUrl(_curPost.InReplyToUser, _curPost.InReplyToStatusId)); | |
9735 | + OpenUriAsync(MyCommon.GetStatusUrl(_curPost.InReplyToUser, _curPost.InReplyToStatusId.Value)); | |
9736 | 9736 | } |
9737 | 9737 | } |
9738 | 9738 | } |
@@ -10999,8 +10999,8 @@ namespace OpenTween | ||
10999 | 10999 | else |
11000 | 11000 | status = Regex.Replace(status, @"(\r\n|\n|\r)?<br>", " ", RegexOptions.IgnoreCase | RegexOptions.Multiline); |
11001 | 11001 | |
11002 | - _reply_to_id = 0; | |
11003 | - _reply_to_name = ""; | |
11002 | + _reply_to_id = null; | |
11003 | + _reply_to_name = null; | |
11004 | 11004 | status = status.Replace(" ", " "); |
11005 | 11005 | |
11006 | 11006 | return status; |
@@ -11492,13 +11492,13 @@ namespace OpenTween | ||
11492 | 11492 | rtdata = CreateRetweetUnofficial(rtdata); |
11493 | 11493 | |
11494 | 11494 | StatusText.Text = " QT @" + _curPost.ScreenName + ": " + WebUtility.HtmlDecode(rtdata); |
11495 | - if (_curPost.RetweetedId == 0) | |
11495 | + if (_curPost.RetweetedId == null) | |
11496 | 11496 | { |
11497 | 11497 | _reply_to_id = _curPost.StatusId; |
11498 | 11498 | } |
11499 | 11499 | else |
11500 | 11500 | { |
11501 | - _reply_to_id = _curPost.RetweetedId; | |
11501 | + _reply_to_id = _curPost.RetweetedId.Value; | |
11502 | 11502 | } |
11503 | 11503 | _reply_to_name = _curPost.ScreenName; |
11504 | 11504 |
@@ -11612,7 +11612,7 @@ namespace OpenTween | ||
11612 | 11612 | if (_curList.SelectedIndices.Count > 0) |
11613 | 11613 | { |
11614 | 11614 | PostClass post = GetCurTabPost(_curList.SelectedIndices[0]); |
11615 | - if (post.RetweetedId > 0) | |
11615 | + if (post.RetweetedId != null) | |
11616 | 11616 | { |
11617 | 11617 | OpenUriAsync("http://twitter.com/" + GetCurTabPost(_curList.SelectedIndices[0]).RetweetedBy); |
11618 | 11618 | } |
@@ -11924,7 +11924,7 @@ namespace OpenTween | ||
11924 | 11924 | } |
11925 | 11925 | if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch |
11926 | 11926 | || !this.ExistCurrentPost |
11927 | - || !(_curPost.InReplyToStatusId > 0)) | |
11927 | + || _curPost.InReplyToStatusId == null) | |
11928 | 11928 | { |
11929 | 11929 | OpenRepSourceOpMenuItem.Enabled = false; |
11930 | 11930 | } |
@@ -12181,9 +12181,9 @@ namespace OpenTween | ||
12181 | 12181 | int counter = 0; |
12182 | 12182 | |
12183 | 12183 | long statusid; |
12184 | - if (_curPost.RetweetedId > 0) | |
12184 | + if (_curPost.RetweetedId != null) | |
12185 | 12185 | { |
12186 | - statusid = _curPost.RetweetedId; | |
12186 | + statusid = _curPost.RetweetedId.Value; | |
12187 | 12187 | } |
12188 | 12188 | else |
12189 | 12189 | { |
@@ -13184,7 +13184,7 @@ namespace OpenTween | ||
13184 | 13184 | { |
13185 | 13185 | string xUrl = SettingDialog.UserAppointUrl; |
13186 | 13186 | xUrl = xUrl.Replace("{ID}", _curPost.ScreenName); |
13187 | - if (_curPost.RetweetedId != 0) | |
13187 | + if (_curPost.RetweetedId != null) | |
13188 | 13188 | { |
13189 | 13189 | xUrl = xUrl.Replace("{STATUS}", _curPost.RetweetedId.ToString()); |
13190 | 13190 | } |
@@ -554,7 +554,7 @@ namespace OpenTween | ||
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | |
557 | - public string PostStatus(string postStr, long reply_to) | |
557 | + public string PostStatus(string postStr, long? reply_to) | |
558 | 558 | { |
559 | 559 | |
560 | 560 | if (MyCommon._endingFlag) return ""; |
@@ -663,7 +663,7 @@ namespace OpenTween | ||
663 | 663 | } |
664 | 664 | } |
665 | 665 | |
666 | - public string PostStatusWithMedia(string postStr, long reply_to, FileInfo mediaFile) | |
666 | + public string PostStatusWithMedia(string postStr, long? reply_to, FileInfo mediaFile) | |
667 | 667 | { |
668 | 668 | if (MyCommon._endingFlag) return ""; |
669 | 669 |
@@ -916,9 +916,9 @@ namespace OpenTween | ||
916 | 916 | { |
917 | 917 | return "Err:Target isn't found."; |
918 | 918 | } |
919 | - if (TabInformations.GetInstance()[id].RetweetedId > 0) | |
919 | + if (TabInformations.GetInstance()[id].RetweetedId != null) | |
920 | 920 | { |
921 | - target = TabInformations.GetInstance()[id].RetweetedId; //再RTの場合は元発言をRT | |
921 | + target = TabInformations.GetInstance()[id].RetweetedId.Value; //再RTの場合は元発言をRT | |
922 | 922 | } |
923 | 923 | |
924 | 924 | HttpStatusCode res = HttpStatusCode.BadRequest; |
@@ -971,7 +971,7 @@ namespace OpenTween | ||
971 | 971 | if (TabInformations.GetInstance().ContainsKey(post.StatusId)) return ""; |
972 | 972 | } |
973 | 973 | //Retweet判定 |
974 | - if (post.RetweetedId == 0) return "Invalid Json!"; | |
974 | + if (post.RetweetedId == null) return "Invalid Json!"; | |
975 | 975 | //ユーザー情報 |
976 | 976 | post.IsMe = true; |
977 | 977 |
@@ -1380,9 +1380,7 @@ namespace OpenTween | ||
1380 | 1380 | MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content); |
1381 | 1381 | return "Invalid Json!"; |
1382 | 1382 | } |
1383 | - int tmp; | |
1384 | - if (int.TryParse(status.RetweetCount, out tmp)) | |
1385 | - retweeted_count = tmp; | |
1383 | + retweeted_count = status.RetweetCount; | |
1386 | 1384 | return ""; |
1387 | 1385 | } |
1388 | 1386 |
@@ -1898,22 +1896,22 @@ namespace OpenTween | ||
1898 | 1896 | { |
1899 | 1897 | if (more) |
1900 | 1898 | { |
1901 | - res = twCon.HomeTimeline(count, this.minHomeTimeline, 0, ref content); | |
1899 | + res = twCon.HomeTimeline(count, this.minHomeTimeline, null, ref content); | |
1902 | 1900 | } |
1903 | 1901 | else |
1904 | 1902 | { |
1905 | - res = twCon.HomeTimeline(count, 0, 0, ref content); | |
1903 | + res = twCon.HomeTimeline(count, null, null, ref content); | |
1906 | 1904 | } |
1907 | 1905 | } |
1908 | 1906 | else |
1909 | 1907 | { |
1910 | 1908 | if (more) |
1911 | 1909 | { |
1912 | - res = twCon.Mentions(count, this.minMentions, 0, ref content); | |
1910 | + res = twCon.Mentions(count, this.minMentions, null, ref content); | |
1913 | 1911 | } |
1914 | 1912 | else |
1915 | 1913 | { |
1916 | - res = twCon.Mentions(count, 0, 0, ref content); | |
1914 | + res = twCon.Mentions(count, null, null, ref content); | |
1917 | 1915 | } |
1918 | 1916 | } |
1919 | 1917 | } |
@@ -1966,17 +1964,17 @@ namespace OpenTween | ||
1966 | 1964 | var target = tab.User; |
1967 | 1965 | if (string.IsNullOrEmpty(target)) return ""; |
1968 | 1966 | userName = target; |
1969 | - res = twCon.UserTimeline(0, target, count, 0, 0, ref content); | |
1967 | + res = twCon.UserTimeline(null, target, count, null, null, ref content); | |
1970 | 1968 | } |
1971 | 1969 | else |
1972 | 1970 | { |
1973 | 1971 | if (more) |
1974 | 1972 | { |
1975 | - res = twCon.UserTimeline(0, userName, count, tab.OldestId, 0, ref content); | |
1973 | + res = twCon.UserTimeline(null, userName, count, tab.OldestId, null, ref content); | |
1976 | 1974 | } |
1977 | 1975 | else |
1978 | 1976 | { |
1979 | - res = twCon.UserTimeline(0, userName, count, 0, 0, ref content); | |
1977 | + res = twCon.UserTimeline(null, userName, count, null, null, ref content); | |
1980 | 1978 | } |
1981 | 1979 | } |
1982 | 1980 | } |
@@ -2126,17 +2124,13 @@ namespace OpenTween | ||
2126 | 2124 | //Source取得(htmlの場合は、中身を取り出し) |
2127 | 2125 | post.Source = retweeted.Source; |
2128 | 2126 | //Reply先 |
2129 | - long inReplyToStatusId; | |
2130 | - long.TryParse(retweeted.InReplyToStatusId, out inReplyToStatusId); | |
2131 | - post.InReplyToStatusId = inReplyToStatusId; | |
2127 | + post.InReplyToStatusId = retweeted.InReplyToStatusId; | |
2132 | 2128 | post.InReplyToUser = retweeted.InReplyToScreenName; |
2133 | - long inReplyToUserId; | |
2134 | - long.TryParse(status.InReplyToUserId, out inReplyToUserId); | |
2135 | - post.InReplyToUserId = inReplyToUserId; | |
2129 | + post.InReplyToUserId = status.InReplyToUserId; | |
2136 | 2130 | |
2137 | 2131 | //幻覚fav対策 |
2138 | 2132 | var tc = TabInformations.GetInstance().GetTabByType(MyCommon.TabUsageType.Favorites); |
2139 | - post.IsFav = tc.Contains(post.RetweetedId); | |
2133 | + post.IsFav = tc.Contains(retweeted.Id); | |
2140 | 2134 | |
2141 | 2135 | if (retweeted.Geo != null) post.PostGeo = new PostClass.StatusGeo {Lat = retweeted.Geo.Coordinates[0], Lng = retweeted.Geo.Coordinates[1]}; |
2142 | 2136 |
@@ -2164,13 +2158,9 @@ namespace OpenTween | ||
2164 | 2158 | entities = status.Entities; |
2165 | 2159 | //Source取得(htmlの場合は、中身を取り出し) |
2166 | 2160 | post.Source = status.Source; |
2167 | - long inReplyToStatusId; | |
2168 | - long.TryParse(status.InReplyToStatusId, out inReplyToStatusId); | |
2169 | - post.InReplyToStatusId = inReplyToStatusId; | |
2161 | + post.InReplyToStatusId = status.InReplyToStatusId; | |
2170 | 2162 | post.InReplyToUser = status.InReplyToScreenName; |
2171 | - long inReplyToUserId; | |
2172 | - long.TryParse(status.InReplyToUserId, out inReplyToUserId); | |
2173 | - post.InReplyToUserId = inReplyToUserId; | |
2163 | + post.InReplyToUserId = status.InReplyToUserId; | |
2174 | 2164 | |
2175 | 2165 | if (status.Geo != null) post.PostGeo = new PostClass.StatusGeo {Lat = status.Geo.Coordinates[0], Lng = status.Geo.Coordinates[1]}; |
2176 | 2166 |
@@ -2256,7 +2246,7 @@ namespace OpenTween | ||
2256 | 2246 | } |
2257 | 2247 | |
2258 | 2248 | //RT禁止ユーザーによるもの |
2259 | - if (post.RetweetedId > 0 && this.noRTId.Contains(post.RetweetedByUserId)) continue; | |
2249 | + if (post.RetweetedByUserId != null && this.noRTId.Contains(post.RetweetedByUserId.Value)) continue; | |
2260 | 2250 | |
2261 | 2251 | post.IsRead = read; |
2262 | 2252 | if (post.IsMe && !read && _readOwnPost) post.IsRead = true; |
@@ -2385,7 +2375,7 @@ namespace OpenTween | ||
2385 | 2375 | post.Source = WebUtility.HtmlDecode(status.Source); |
2386 | 2376 | post.InReplyToStatusId = status.InReplyToStatusId; |
2387 | 2377 | post.InReplyToUser = status.ToUser; |
2388 | - post.InReplyToUserId = !status.ToUserId.HasValue ? 0 : (long)status.ToUserId; | |
2378 | + post.InReplyToUserId = status.ToUserId; | |
2389 | 2379 | |
2390 | 2380 | if (status.Geo != null) post.PostGeo = new PostClass.StatusGeo { Lat = status.Geo.Coordinates[0], Lng = status.Geo.Coordinates[1] }; |
2391 | 2381 |
@@ -2508,11 +2498,11 @@ namespace OpenTween | ||
2508 | 2498 | { |
2509 | 2499 | if (more) |
2510 | 2500 | { |
2511 | - res = twCon.GetListsStatuses(tab.ListInfo.UserId, tab.ListInfo.Id, count, tab.OldestId, 0, AppendSettingDialog.Instance.IsListStatusesIncludeRts, ref content); | |
2501 | + res = twCon.GetListsStatuses(tab.ListInfo.UserId, tab.ListInfo.Id, count, tab.OldestId, null, AppendSettingDialog.Instance.IsListStatusesIncludeRts, ref content); | |
2512 | 2502 | } |
2513 | 2503 | else |
2514 | 2504 | { |
2515 | - res = twCon.GetListsStatuses(tab.ListInfo.UserId, tab.ListInfo.Id, count, 0, 0, AppendSettingDialog.Instance.IsListStatusesIncludeRts, ref content); | |
2505 | + res = twCon.GetListsStatuses(tab.ListInfo.UserId, tab.ListInfo.Id, count, null, null, AppendSettingDialog.Instance.IsListStatusesIncludeRts, ref content); | |
2516 | 2506 | } |
2517 | 2507 | } |
2518 | 2508 | catch(Exception ex) |
@@ -2546,11 +2536,11 @@ namespace OpenTween | ||
2546 | 2536 | throw new ArgumentException("startStatusId (" + startStatusId + ") が posts の中から見つかりませんでした。"); |
2547 | 2537 | |
2548 | 2538 | var nextPost = posts[startStatusId]; |
2549 | - while (nextPost.InReplyToStatusId != 0) | |
2539 | + while (nextPost.InReplyToStatusId != null) | |
2550 | 2540 | { |
2551 | - if (!posts.ContainsKey(nextPost.InReplyToStatusId)) | |
2541 | + if (!posts.ContainsKey(nextPost.InReplyToStatusId.Value)) | |
2552 | 2542 | break; |
2553 | - nextPost = posts[nextPost.InReplyToStatusId]; | |
2543 | + nextPost = posts[nextPost.InReplyToStatusId.Value]; | |
2554 | 2544 | } |
2555 | 2545 | |
2556 | 2546 | return nextPost; |
@@ -2560,11 +2550,11 @@ namespace OpenTween | ||
2560 | 2550 | { |
2561 | 2551 | var rslt = ""; |
2562 | 2552 | var relPosts = new Dictionary<Int64, PostClass>(); |
2563 | - if (tab.RelationTargetPost.TextFromApi.Contains("@") && tab.RelationTargetPost.InReplyToStatusId == 0) | |
2553 | + if (tab.RelationTargetPost.TextFromApi.Contains("@") && tab.RelationTargetPost.InReplyToStatusId == null) | |
2564 | 2554 | { |
2565 | 2555 | //検索結果対応 |
2566 | 2556 | var p = TabInformations.GetInstance()[tab.RelationTargetPost.StatusId]; |
2567 | - if (p != null && p.InReplyToStatusId > 0) | |
2557 | + if (p != null && p.InReplyToStatusId != null) | |
2568 | 2558 | { |
2569 | 2559 | tab.RelationTargetPost = p; |
2570 | 2560 | } |
@@ -2590,15 +2580,15 @@ namespace OpenTween | ||
2590 | 2580 | rslt = this.GetRelatedResultsApi(nextPost, relPosts); |
2591 | 2581 | if (!string.IsNullOrEmpty(rslt)) break; |
2592 | 2582 | nextPost = FindTopOfReplyChain(relPosts, nextPost.StatusId); |
2593 | - } while (nextPost.InReplyToStatusId != 0 && loopCount++ <= 5); | |
2583 | + } while (nextPost.InReplyToStatusId != null && loopCount++ <= 5); | |
2594 | 2584 | } |
2595 | 2585 | |
2596 | 2586 | // 二周目: in_reply_to_status_id を使用してリプライチェインを辿る |
2597 | 2587 | nextPost = FindTopOfReplyChain(relPosts, tab.RelationTargetPost.StatusId); |
2598 | 2588 | loopCount = 1; |
2599 | - while (nextPost.InReplyToStatusId != 0 && loopCount++ <= 20) | |
2589 | + while (nextPost.InReplyToStatusId != null && loopCount++ <= 20) | |
2600 | 2590 | { |
2601 | - var inReplyToId = nextPost.InReplyToStatusId; | |
2591 | + var inReplyToId = nextPost.InReplyToStatusId.Value; | |
2602 | 2592 | |
2603 | 2593 | var inReplyToPost = TabInformations.GetInstance()[inReplyToId]; |
2604 | 2594 | if (inReplyToPost != null) |
@@ -2673,9 +2663,9 @@ namespace OpenTween | ||
2673 | 2663 | var content = ""; |
2674 | 2664 | try |
2675 | 2665 | { |
2676 | - if (post.RetweetedId > 0) | |
2666 | + if (post.RetweetedId != null) | |
2677 | 2667 | { |
2678 | - res = twCon.GetRelatedResults(post.RetweetedId, ref content); | |
2668 | + res = twCon.GetRelatedResults(post.RetweetedId.Value, ref content); | |
2679 | 2669 | } |
2680 | 2670 | else |
2681 | 2671 | { |
@@ -2739,8 +2729,8 @@ namespace OpenTween | ||
2739 | 2729 | |
2740 | 2730 | HttpStatusCode res; |
2741 | 2731 | var content = ""; |
2742 | - var maxId = 0L; | |
2743 | - var sinceId = 0L; | |
2732 | + long? maxId = null; | |
2733 | + long? sinceId = null; | |
2744 | 2734 | var count = 100; |
2745 | 2735 | if (AppendSettingDialog.Instance.UseAdditionalCount && |
2746 | 2736 | AppendSettingDialog.Instance.SearchCountApi != 0) |
@@ -2799,8 +2789,8 @@ namespace OpenTween | ||
2799 | 2789 | |
2800 | 2790 | HttpStatusCode res; |
2801 | 2791 | var content = ""; |
2802 | - var page = 0; | |
2803 | - var sinceId = 0L; | |
2792 | + int? page = null; | |
2793 | + long? sinceId = null; | |
2804 | 2794 | var count = 100; |
2805 | 2795 | var querystr = ""; |
2806 | 2796 | if (AppendSettingDialog.Instance.UseAdditionalCount && |
@@ -3006,22 +2996,22 @@ namespace OpenTween | ||
3006 | 2996 | { |
3007 | 2997 | if (more) |
3008 | 2998 | { |
3009 | - res = twCon.DirectMessages(20, minDirectmessage, 0, ref content); | |
2999 | + res = twCon.DirectMessages(20, minDirectmessage, null, ref content); | |
3010 | 3000 | } |
3011 | 3001 | else |
3012 | 3002 | { |
3013 | - res = twCon.DirectMessages(20, 0, 0, ref content); | |
3003 | + res = twCon.DirectMessages(20, null, null, ref content); | |
3014 | 3004 | } |
3015 | 3005 | } |
3016 | 3006 | else |
3017 | 3007 | { |
3018 | 3008 | if (more) |
3019 | 3009 | { |
3020 | - res = twCon.DirectMessagesSent(20, minDirectmessageSent, 0, ref content); | |
3010 | + res = twCon.DirectMessagesSent(20, minDirectmessageSent, null, ref content); | |
3021 | 3011 | } |
3022 | 3012 | else |
3023 | 3013 | { |
3024 | - res = twCon.DirectMessagesSent(20, 0, 0, ref content); | |
3014 | + res = twCon.DirectMessagesSent(20, null, null, ref content); | |
3025 | 3015 | } |
3026 | 3016 | } |
3027 | 3017 | } |
@@ -3143,13 +3133,9 @@ namespace OpenTween | ||
3143 | 3133 | //Source取得(htmlの場合は、中身を取り出し) |
3144 | 3134 | post.Source = retweeted.Source; |
3145 | 3135 | //Reply先 |
3146 | - long inReplyToStatusId; | |
3147 | - long.TryParse(retweeted.InReplyToStatusId, out inReplyToStatusId); | |
3148 | - post.InReplyToStatusId = inReplyToStatusId; | |
3136 | + post.InReplyToStatusId = retweeted.InReplyToStatusId; | |
3149 | 3137 | post.InReplyToUser = retweeted.InReplyToScreenName; |
3150 | - long inReplyToUserId; | |
3151 | - long.TryParse(retweeted.InReplyToUserId, out inReplyToUserId); | |
3152 | - post.InReplyToUserId = inReplyToUserId; | |
3138 | + post.InReplyToUserId = retweeted.InReplyToUserId; | |
3153 | 3139 | post.IsFav = true; |
3154 | 3140 | |
3155 | 3141 | //以下、ユーザー情報 |
@@ -3173,13 +3159,9 @@ namespace OpenTween | ||
3173 | 3159 | entities = status.Entities; |
3174 | 3160 | //Source取得(htmlの場合は、中身を取り出し) |
3175 | 3161 | post.Source = status.Source; |
3176 | - long inReplyToStatusId; | |
3177 | - long.TryParse(status.InReplyToStatusId, out inReplyToStatusId); | |
3178 | - post.InReplyToStatusId = inReplyToStatusId; | |
3162 | + post.InReplyToStatusId = status.InReplyToStatusId; | |
3179 | 3163 | post.InReplyToUser = status.InReplyToScreenName; |
3180 | - long inReplyToUserId; | |
3181 | - long.TryParse(status.InReplyToUserId, out inReplyToUserId); | |
3182 | - post.InReplyToUserId = inReplyToUserId; | |
3164 | + post.InReplyToUserId = status.InReplyToUserId; | |
3183 | 3165 | |
3184 | 3166 | post.IsFav = true; |
3185 | 3167 |