private void Regist(string aAddress, int aPort, int aId, string aPath) { if (Bservers.Count != 0) { foreach (ArrayList list in Bservers) { if (list.Contains(aAddress) && list.Contains(aPort) && list.Contains(aPath) && list.Contains(aId)) { return; } else { ArrayList newList = Server(aAddress, aPort, aId, aPath); Bservers.Add(newList); Host.Logger.WriteLine("Added server with Id {0} on {1}:{2}.", aId, aAddress, aPort); break; } } } else { ArrayList newList = Server(aAddress, aPort, aId, aPath); Bservers.Add(newList); Host.Logger.WriteLine("Added server with Id {0} on {1}:{2}.", aId, aAddress, aPort); } }
private void Unregist(string aAddress, int aPort, int aId, string aPath) { List <ArrayList> temp = Bservers; foreach (ArrayList testList in temp) { ArrayList list = Server(aAddress, aPort, aId, aPath); if (testList.Count != list.Count) { return; } if ((list.ToArray() as IStructuralEquatable).Equals(testList.ToArray(), EqualityComparer <object> .Default)) { Host.Logger.WriteLine( Bservers.Remove(testList) ? "Removed server {0}:{1}." : "The server {0}:{1} is not registered.", aAddress, aPort); break; } } }