public static bool AcceptsAutoCommand(this IConnection @this, IConnectionAutoCommand c) { if (c != null && @this.enabledAutoCommands != null && @this.enabledAutoCommands.Contains(c.GetType())) { return(true); } var glued = c as ConnectionGluedAutoCommand; return(glued != null && glued.commands.All(@this.AcceptsAutoCommand)); }
public static object Recieve(this IConnection c, out EndPoint from, int buffersize = 1024) { object r = serialize.Deserialize(c.RecieveBytes(out from, buffersize)); IConnectionAutoCommand a = r as IConnectionAutoCommand; if (a != null && c.enabledAutoCommands != null && c.AcceptsAutoCommand(a)) { a.OnRecieve(c); } return(r); }