protected virtual void OnSend(SendEventArgs <T> e) { var handler = this.Send; if (handler != null) { handler(this, e); } }
internal bool SendMessage(T msg, IConnection connection) { var e = new SendingEventArgs <T>(msg); this.OnSending(e); if (!e.Cancelled) { var e2 = new SendEventArgs <T>(msg); this.OnSend(e2); e.Message.Send(connection); return(true); } return(false); }
private void OnSendPlace(object sender, SendEventArgs <PlaceSendMessage> e) { var b = e.Message; var p = b.GetPoint3D(); lock (this._sentBlocks) { this._timeoutResetEvent.Set(); this._finishResetEvent.Reset(); var overwrritenSends = 0; CheckHandle oldHandle; if (this._sentLocations.TryGetValue(p, out oldHandle)) { this._sentBlocks.Remove(oldHandle); overwrritenSends = oldHandle.OverwrittenSends + 1; } var newHandle = new CheckHandle(b, overwrritenSends); this._sentBlocks.AddToBack(newHandle); this._sentLocations[p] = newHandle; } }