@@ -63,6 +63,11 @@ public struct Chat : IEquatable<Chat>
6363 /// <value></value>
6464 public int Score { get ; private set ; }
6565
66+ /// <summary>
67+ /// コメント投稿者の名前
68+ /// </summary>
69+ public string Name { get ; private set ; }
70+
6671 public Chat ( string thread ,
6772 long vpos ,
6873 long date ,
@@ -73,7 +78,8 @@ public Chat(string thread,
7378 string content ,
7479 int no ,
7580 int roomId ,
76- int score ) : this ( )
81+ int score ,
82+ string name )
7783 {
7884 Thread = thread ;
7985 Vpos = vpos ;
@@ -86,29 +92,15 @@ public Chat(string thread,
8692 No = no ;
8793 RoomId = roomId ;
8894 Score = score ;
89- }
90-
91- /// <summary>
92- /// プレミアム会員であるか
93- /// </summary>
94- public bool IsPremium
95- {
96- get { return ( Premium & 1 ) != 0 ; }
97- }
98-
99- /// <summary>
100- /// 運営コメント または /から始まる特殊なメッセージであるか
101- /// </summary>
102- public bool IsStaff
103- {
104- get { return ( Premium & 2 ) != 0 ; }
95+ Name = name ;
10596 }
10697
10798 public bool Equals ( Chat other )
10899 {
109100 return Thread == other . Thread && Vpos == other . Vpos && Date == other . Date && Mail == other . Mail &&
110101 UserId == other . UserId && Premium == other . Premium && Anonymity == other . Anonymity &&
111- Content == other . Content && No == other . No && RoomId == other . RoomId && Score == other . Score ;
102+ Content == other . Content && No == other . No && RoomId == other . RoomId && Score == other . Score &&
103+ Name == other . Name ;
112104 }
113105
114106 public override bool Equals ( object obj )
@@ -130,8 +122,15 @@ public override int GetHashCode()
130122 hashCode . Add ( No ) ;
131123 hashCode . Add ( RoomId ) ;
132124 hashCode . Add ( Score ) ;
125+ hashCode . Add ( Name ) ;
133126 return hashCode . ToHashCode ( ) ;
134127 }
128+
129+ public override string ToString ( )
130+ {
131+ return
132+ $ "{ nameof ( Thread ) } : { Thread } , { nameof ( Vpos ) } : { Vpos } , { nameof ( Date ) } : { Date } , { nameof ( Mail ) } : { Mail } , { nameof ( UserId ) } : { UserId } , { nameof ( Premium ) } : { Premium } , { nameof ( Anonymity ) } : { Anonymity } , { nameof ( Content ) } : { Content } , { nameof ( No ) } : { No } , { nameof ( RoomId ) } : { RoomId } , { nameof ( Score ) } : { Score } , { nameof ( Name ) } : { Name } ";
133+ }
135134 }
136135
137136 [ Serializable ]
@@ -147,6 +146,7 @@ internal struct ChatDto : IEquatable<ChatDto>
147146 public string content ;
148147 public int no ;
149148 public int score ;
149+ public string name ;
150150
151151 public bool IsSuccess ( )
152152 {
@@ -166,15 +166,16 @@ public Chat ToChat(int roomId)
166166 content ,
167167 no ,
168168 roomId ,
169- score
169+ score ,
170+ name
170171 ) ;
171172 }
172173
173174 public bool Equals ( ChatDto other )
174175 {
175176 return thread == other . thread && vpos == other . vpos && date == other . date && mail == other . mail &&
176177 user_id == other . user_id && premium == other . premium && anonymity == other . anonymity &&
177- content == other . content && no == other . no && score == other . score ;
178+ content == other . content && no == other . no && score == other . score && name == other . name ;
178179 }
179180
180181 public override bool Equals ( object obj )
@@ -195,6 +196,7 @@ public override int GetHashCode()
195196 hashCode . Add ( content ) ;
196197 hashCode . Add ( no ) ;
197198 hashCode . Add ( score ) ;
199+ hashCode . Add ( name ) ;
198200 return hashCode . ToHashCode ( ) ;
199201 }
200202 }
0 commit comments