//リソースの追加 public bool Add(OneRR oneRR) { var ret = true; // 排他制御 lock (this) { foreach (var t in _db) { if (t.DnsType != oneRR.DnsType) { continue; } if (t.Name != oneRR.Name) { continue; } //TTL=0のデータは普遍であるため、書き換えはしない if (t.Ttl2 == 0) { ret = false; goto end; } //まったく同じデータが既に有る場合、書き換えはしない if (t.Name != oneRR.Name) { continue; } if (t.DnsType != oneRR.DnsType) { continue; } bool flg = !oneRR.Data.Where((t1, n) => t.Data[n] != t1).Any(); if (!flg) { continue; } ret = false; goto end; } _db.Add(oneRR); end: ; } return(ret); }
//リソースの追加 public bool Add(OneRR oneRR) { var ret = true; // 排他制御 lock (this) { foreach (var t in _db){ if (t.DnsType != oneRR.DnsType) continue; if (t.Name != oneRR.Name) continue; //TTL=0のデータは普遍であるため、書き換えはしない if (t.Ttl2 == 0) { ret = false; goto end; } //まったく同じデータが既に有る場合、書き換えはしない if (t.Name != oneRR.Name) continue; if (t.DnsType != oneRR.DnsType) continue; bool flg = !oneRR.Data.Where((t1, n) => t.Data[n] != t1).Any(); if (!flg) continue; ret = false; goto end; } _db.Add(oneRR); end: ; } return ret; }