//メインコントロールへのデータ追加 public override void AddItem(string line) { var oneLease = new OneLease(line); ListViewItem item = _listView.Items.Add(oneLease.DbStatus.ToString()); item.SubItems.Add(oneLease.Ip.ToString()); item.SubItems.Add(oneLease.MacAppointment.ToString()); item.SubItems.Add(oneLease.Mac.ToString()); item.SubItems.Add(oneLease.Dt.ToString()); }
//メインコントロールへのデータ追加 override public void AddItem(string line) { var oneLease = new OneLease(line); ListViewItem item = _listView.Items.Add(oneLease.DbStatus.ToString()); item.SubItems.Add(oneLease.Ip.ToString()); item.SubItems.Add(oneLease.MacAppointment.ToString()); item.SubItems.Add(oneLease.Mac.ToString()); item.SubItems.Add(oneLease.Dt.ToString()); }
//public Lease(Logger logger, string fileName, Ip startIp, Ip endIp, int leaseTime, Dat2 macAcl) { public Lease(string fileName, Ip startIp, Ip endIp, int leaseTime, Dat macAcl) { //this.logger = logger; this.fileName = fileName; this.leaseTime = leaseTime; uint start = startIp.AddrV4; uint end = endIp.AddrV4; int count = 2048;//�ő�ێ��� for (uint i = start; i <= end && count > 0; i++) { Ip ip = new Ip(i); ar.Add(new OneLease(ip));//MAC�w��Ȃ� count--; } foreach (var o in macAcl) { if (o.Enable) //�L���ȃf�[�^������Ώۂɂ��� { string macStr = o.StrList[0]; //MAC�A�h���X(99-99-99-99-99-99) Mac mac = new Mac(macStr); Ip ip = new Ip(o.StrList[1]); //IP�A�h���X if (ip.ToString() == "255.255.255.255") { ar.Add(new OneLease(ip, mac));//MAC�w�肠��őS���lj� } else { // ��{�ݒ�͈̔͂̃e�[�u������� bool find = false; for (int i = 0; i < ar.Count; i++) { if (ar[i].Ip == ip) { ar[i] = new OneLease(ip, mac);//MAC�w�肠��ɕύX find = true; break; } } if (!find) // ��{�ݒ�͈̔͊O�̏ꍇ { ar.Add(new OneLease(ip, mac)); //MAC�w�肠��Ƃ��Ēlj� } } } } // ���[�X���f�[�^�̓ǂݍ��� Read(); }
//public Lease(Logger logger, string fileName, Ip startIp, Ip endIp, int leaseTime, Dat2 macAcl) { public Lease(string fileName, Ip startIp, Ip endIp, int leaseTime, Dat macAcl) { //this.logger = logger; this.fileName = fileName; this.leaseTime = leaseTime; uint start = startIp.AddrV4; uint end = endIp.AddrV4; int count = 2048;//�ő�ێ��� for (uint i = start; i <= end && count > 0; i++) { Ip ip = new Ip(i); ar.Add(new OneLease(ip));//MAC�w��Ȃ� count--; } foreach (var o in macAcl) { if (o.Enable) {//�L���ȃf�[�^������Ώۂɂ��� string macStr = o.StrList[0];//MAC�A�h���X(99-99-99-99-99-99) Mac mac = new Mac(macStr); Ip ip = new Ip(o.StrList[1]);//IP�A�h���X if (ip.ToString() == "255.255.255.255") { ar.Add(new OneLease(ip, mac));//MAC�w�肠��őS���lj� } else { // ��{�ݒ�͈̔͂̃e�[�u������� bool find = false; for (int i = 0; i < ar.Count; i++) { if (ar[i].Ip == ip) { ar[i] = new OneLease(ip, mac);//MAC�w�肠��ɕύX find = true; break; } } if (!find) { // ��{�ݒ�͈̔͊O�̏ꍇ ar.Add(new OneLease(ip, mac));//MAC�w�肠��Ƃ��Ēlj� } } } } // ���[�X���f�[�^�̓ǂݍ��� Read(); }