public object SendPackage(IPackage package) { if (!package.IsValid) { return(null); } SendingPackage?.Invoke(this, new PackageEventArgs(package)); if (!package.IsValid) { return(null); } if (package.Sender != this) { package.Sender.SendPackage(package); return(null); } return(package.Receiver.ReceivePackage(package)); }
public T SendPackage <T>(Package <T> package) { if (!package.IsValid) { return(default(T)); } SendingPackage?.Invoke(this, new PackageEventArgs(package)); if (!package.IsValid) { return(default(T)); } if (package.Sender != this) { package.Sender.SendPackage(package); return(default(T)); } return(package.Receiver.ReceivePackage(package)); }