Example #1
0
 public HeartbeatRequestState( HttpWebRequest request, HeartbeatData data, bool getServerUri )
 {
     Request = request;
     Data = data;
     GetServerUri = getServerUri;
 }
Example #2
0
        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 );
        }
Example #3
0
 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 ) );
     }
 }
Example #4
0
 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 );
 }
Example #5
0
 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;
 }