開発に使用するリポジトリ
Revisión | ee331fec437a21e0ec3eee636d6e818fd9ce2c99 (tree) |
---|---|
Tiempo | 2012-12-21 16:03:14 |
Autor | Kimura Youichi <kim.upsilon@bucy...> |
Commiter | Kimura Youichi |
PostClassのクローンが不完全である問題を修正
@@ -5,6 +5,7 @@ | ||
5 | 5 | // (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/> |
6 | 6 | // (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow> |
7 | 7 | // (c) 2011 Egtra (@egtra) <http://dev.activebasic.com/egtra/> |
8 | +// (c) 2012 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/> | |
8 | 9 | // All rights reserved. |
9 | 10 | // |
10 | 11 | // This file is part of OpenTween. |
@@ -42,6 +43,17 @@ namespace OpenTween | ||
42 | 43 | { |
43 | 44 | public double Lng { get; set; } |
44 | 45 | public double Lat { get; set; } |
46 | + | |
47 | + public override bool Equals(object obj) | |
48 | + { | |
49 | + var geo = obj as StatusGeo; | |
50 | + return geo != null && geo.Lng == this.Lng && geo.Lat == this.Lng; | |
51 | + } | |
52 | + | |
53 | + public override int GetHashCode() | |
54 | + { | |
55 | + return this.Lng.GetHashCode() ^ this.Lat.GetHashCode(); | |
56 | + } | |
45 | 57 | } |
46 | 58 | private string _Nick; |
47 | 59 | private string _textFromApi; |
@@ -587,7 +599,7 @@ namespace OpenTween | ||
587 | 599 | (this.InReplyToStatusId == other.InReplyToStatusId) && |
588 | 600 | (this.Source == other.Source) && |
589 | 601 | (this.SourceHtml == other.SourceHtml) && |
590 | - (this.ReplyToList.Equals(other.ReplyToList)) && | |
602 | + (this.ReplyToList.SequenceEqual(other.ReplyToList)) && | |
591 | 603 | (this.IsMe == other.IsMe) && |
592 | 604 | (this.IsDm == other.IsDm) && |
593 | 605 | (this.UserId == other.UserId) && |
@@ -608,7 +620,12 @@ namespace OpenTween | ||
608 | 620 | #region "IClonable.Clone" |
609 | 621 | object ICloneable.Clone() |
610 | 622 | { |
611 | - return this.MemberwiseClone(); | |
623 | + var clone = (PostClass)this.MemberwiseClone(); | |
624 | + clone.ReplyToList = new List<string>(this.ReplyToList); | |
625 | + clone.PostGeo = new StatusGeo { Lng = this.PostGeo.Lng, Lat = this.PostGeo.Lat }; | |
626 | + clone.Media = new Dictionary<string, string>(this.Media); | |
627 | + | |
628 | + return clone; | |
612 | 629 | } |
613 | 630 | #endregion |
614 | 631 | } |