public virtual ProxyEntity Active(bool active, int port) { if (active) { ProxyEntity result = _proxy_creator.Handle(_exe_path, port); result = _proxy_activator.Handle(result, active, new DofusProxyAcceptCallback(result)); return(result); } else { if (_proxy_repository.Remove(x => x.Port == port)) { return(null); } throw new ArgumentNullException($"cannot disable proxy with port : {port}"); } }
public ProxyEntity Active <Callback>(bool active, int port, string folder_path) where Callback : ProxyAcceptCallback { if (active) { ProxyEntity result = _proxy_creator.Handle(folder_path, port); result = _proxy_activator.Handle(result, active, Activator.CreateInstance(typeof(Callback), new object[] { result }) as Callback); return(result); } else { if (_proxy_repository.Remove(x => x.Port == port)) { return(null); } throw new ArgumentNullException($"cannot disable proxy with port : {port}"); } }