Skip to content

Commit dfd2a15

Browse files
Added extra random 10 character check duplication protection.
1 parent c2c6da4 commit dfd2a15

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Pocsag.Plugin/PocsagControl.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,19 @@ private void MessageReceived(Pocsag.PocsagMessage message)
159159
int lastVisible = (firstDisplayed + displayed) - 1;
160160
int lastIndex = this.dataGridView1.RowCount - 1;
161161

162+
if (message.Payload.Length < 50) return;
163+
164+
for (int i = 0; i < bindingList.Count; i++)
165+
{
166+
// Check to see if a random 10 characters exist in the messages currently stored in the list (another duplication protection)
167+
if (bindingList[i].Payload.Contains(message.Payload.Substring(30, 10)))
168+
{
169+
// If it does, don't add it to our list.
170+
return;
171+
}
172+
}
173+
174+
162175
this.bindingList.Add(message);
163176

164177
// Create a datetime named file and record messages as they come in.

0 commit comments

Comments
 (0)