public static void Add(LogElem elem) { if (Buffer == null) { Buffer = new List <LogElem>(); } while (Buffer.Count > 40) { Buffer.RemoveAt(0); } //Тут допишем код для удаления Buffer.Add(elem); }
public static void Add(LogElem elem) { if (Buffer == null) { Buffer = new List <LogElem>(); } while (Buffer.Count > 40) { Buffer.RemoveAt(0); } //Тут допишем код для удаления Buffer.Add(elem); //Следим те кто в онлайн AddBufferOnline(elem); }
public static void AddBufferOnline(LogElem t) { //Исключим неверные if (t.MacAdress == null) { return; } if ((t.MacAdress.Trim() == String.Empty) || (t.MacAdress == "-")) { return; } if (BufferOnline == null) { BufferOnline = new List <ElemTsdLog>(); BufferOnline.Add(new ElemTsdLog(t.Login, t.ClientVersion, t.MacAdress, t.DnsNames)); return; } bool find = false; foreach (var e in BufferOnline) { if (e.MacAdress == t.MacAdress) { find = true; //Обновим инфу e.Check(t.Login, t.ClientVersion); } } if (!find) {//Новый элемент BufferOnline.Add(new ElemTsdLog(t.Login, t.ClientVersion, t.MacAdress, t.DnsNames)); } }