void UKismetMathLibrary::BreakTimespan(FTimespan InTimespan, int32& Days, int32& Hours, int32& Minutes, int32& Seconds, int32& Milliseconds) { Days = InTimespan.GetDays(); Hours = InTimespan.GetHours(); Minutes = InTimespan.GetMinutes(); Seconds = InTimespan.GetSeconds(); Milliseconds = InTimespan.GetMilliseconds(); }
int32 UKismetMathLibrary::GetSeconds( FTimespan A ) { return A.GetSeconds(); }
bool FHTTPTransport::SendPayloadAndReceiveResponse(TArray<uint8>& In, TArray<uint8>& Out) { RecieveBuffer.Empty(); ReadPtr = 0; #if !PLATFORM_HTML5 if (GIsRequestingExit) // We have already lost HTTP Module. return false; class HTTPRequestHandler { public: HTTPRequestHandler(TArray<uint8>& InOut) :Out(InOut) {} void HttpRequestComplete( FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded) { if (HttpResponse.IsValid()) Out.Append(HttpResponse->GetContent()); } private: TArray<uint8>& Out; }; HTTPRequestHandler Handler(RecieveBuffer); HttpRequest->OnProcessRequestComplete().BindRaw(&Handler,&HTTPRequestHandler::HttpRequestComplete ); if ( In.Num() ) { HttpRequest->SetVerb("POST"); FBufferArchive Ar; Ar << Guid; Ar.Append(In); HttpRequest->SetContent(Ar); } else { HttpRequest->SetVerb("GET"); } HttpRequest->ProcessRequest(); FDateTime StartTime; FTimespan Span = FDateTime::UtcNow() - StartTime; while( HttpRequest->GetStatus() != EHttpRequestStatus::Failed && HttpRequest->GetStatus() != EHttpRequestStatus::Succeeded && Span.GetSeconds() < 10 ) { HttpRequest->Tick(0); Span = FDateTime::UtcNow() - StartTime; } if (HttpRequest->GetStatus() == EHttpRequestStatus::Succeeded) return true; HttpRequest->CancelRequest(); return false; #else // PLATFORM_HTML5 FBufferArchive Ar; if ( In.Num() ) { Ar << Guid; } Ar.Append(In); unsigned char *OutData = NULL; unsigned int OutSize= 0; bool RetVal = true; #if PLATFORM_HTML5_WIN32 RetVal = HTML5Win32::NFSHttp::SendPayLoadAndRecieve(Ar.GetData(), Ar.Num(), &OutData, OutSize); #endif #if PLATFORM_HTML5_BROWSER UE_SendAndRecievePayLoad(TCHAR_TO_ANSI(Url),(char*)Ar.GetData(),Ar.Num(),(char**)&OutData,(int*)&OutSize); #endif if (!Ar.Num()) { uint32 Size = OutSize; uint32 Marker = 0xDeadBeef; RecieveBuffer.Append((uint8*)&Marker,sizeof(uint32)); RecieveBuffer.Append((uint8*)&Size,sizeof(uint32)); } if (OutSize) { RecieveBuffer.Append(OutData,OutSize); #if PLATFORM_HTML5_WIN32 free (OutData); #endif #if PLATFORM_HTML5_BROWSER // don't go through the Unreal Memory system. ::free(OutData); #endif } return RetVal & ReceiveResponse(Out); #endif }