public HeartbeatRequestState( HttpWebRequest request, HeartbeatData data, bool getServerUri ) { Request = request; Data = data; GetServerUri = getServerUri; }
static void SendWoMDirectBeat() { HeartbeatData data = new HeartbeatData( WoMDirectUri ); // we dont want WoM redirecting back to minecraft.net data.CustomData["noforward"] = "1"; if( !RaiseHeartbeatSendingEvent( data, WoMDirectUri, false ) ) { return; } womDirectRequest = CreateRequest( data.CreateUri() ); var state = new HeartbeatRequestState( womDirectRequest, data, false ); womDirectRequest.BeginGetResponse( ResponseCallback, state ); }
static void RaiseHeartbeatSentEvent( HeartbeatData heartbeatData, HttpWebResponse response, string text ) { var h = Sent; if( h != null ) { h(null, new hb2.Events.HeartbeatSentEventArgs(heartbeatData, response.Headers, response.StatusCode, text ) ); } }
static void SendMinecraftNetBeat() { HeartbeatData data = new HeartbeatData( MinecraftNetUri ); if( !RaiseHeartbeatSendingEvent( data, MinecraftNetUri, true ) ) { return; } minecraftNetRequest = CreateRequest( data.CreateUri() ); var state = new HeartbeatRequestState( minecraftNetRequest, data, true ); minecraftNetRequest.BeginGetResponse( ResponseCallback, state ); }
static bool RaiseHeartbeatSendingEvent(HeartbeatData data, Uri uri, bool getServerUri) { var h = Sending; if( h == null ) return true; var e = new hb2.Events.HeartbeatSendingEventArgs( data, uri, getServerUri ); h( null, e ); return !e.Cancel; }