private void PackageActions(User user, BasePackage package) { PackageProcessor.ProcessPackage(user, package).ContinueWith(t => { if (t.IsFaulted) { Console.WriteLine("Error while processing pacage: \r\n" + t.Exception); } }); }
public async Task Send(User user, BasePackage package) { var builder = new StringBuilder(); mSerializer.Serialize(new StringWriter(builder), package ); var bytes = Encoding.UTF8.GetBytes(builder.ToString()); using (await user.Lock.LockAsync()) { await SendBytes(user.Socket, BitConverter.GetBytes(bytes.Length)); await SendBytes(user.Socket, bytes); } }
public async Task ProcessPackage(User user, BasePackage pack) { dynamic p = pack; ProcessPackage(user, p); }