9#include "Engine/World.h"
10#include "GenericPlatform/GenericPlatformHttp.h"
11#include "Interfaces/IPluginManager.h"
12#include "Misc/Base64.h"
21 return FGenericPlatformHttp::UrlEncode(Source);
26 TArray<uint8> ByteArray;
27 const FTCHARToUTF8 StringSrc = FTCHARToUTF8(Source.GetCharArray().GetData());
28 ByteArray.Append((uint8*)StringSrc.Get(), StringSrc.Length());
30 return FBase64::Encode(ByteArray);
35 TArray<uint8> ByteArray;
36 const bool Success = FBase64::Decode(Source, ByteArray);
38 const FUTF8ToTCHAR StringSrc = FUTF8ToTCHAR((
const ANSICHAR*)ByteArray.GetData(), ByteArray.Num());
40 Dest.AppendChars(StringSrc.Get(), StringSrc.Length());
49 Dest = FBase64::Encode(Data);
59 return FBase64::Decode(Source, Dest);
64 return FMD5::HashAnsiString(*StringToHash);
71 Sha1Gen.Update((
unsigned char*)TCHAR_TO_ANSI(*StringToHash), FCString::Strlen(*StringToHash));
75 for (int32 i = 0; i < 20; i++)
77 Sha1String += FString::Printf(TEXT(
"%02x"), Sha1Gen.m_digest[i]);
85 const auto PluginRef = IPluginManager::Get().FindPlugin(
"VaRest");
87 return !PluginRef.IsValid() ? FString(
"invalid") : PluginRef->GetDescriptor().VersionName;
92 if (WorldContextObject)
94 if (UWorld* World = WorldContextObject->GetWorld())
static FVaRestModule & Get()
UVaRestSettings * GetSettings() const
static FString GetVaRestVersion()
UFUNCTION(BlueprintPure, Category = "VaRest|Utility", meta = (DisplayName = "Get VaRest Version"))
static FVaRestURL GetWorldURL(UObject *WorldContextObject)
UFUNCTION(BlueprintPure, Category = "VaRest|Utility", meta = (WorldContext = "WorldContextObject"))
static UVaRestSettings * GetVaRestSettings()
UFUNCTION(BlueprintPure, Category = "VaRest|Common")
static FString Base64Encode(const FString &Source)
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility", meta = (DisplayName = "Base64 Encode"))
static bool Base64DecodeData(const FString &Source, TArray< uint8 > &Dest)
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility", meta = (DisplayName = "Base64 Decode Data")...
static bool Base64EncodeData(const TArray< uint8 > &Data, FString &Dest)
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility", meta = (DisplayName = "Base64 Encode Data")...
static FString StringToMd5(const FString &StringToHash)
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility", meta = (DisplayName = "String to MD5"))
static FString StringToSha1(const FString &StringToHash)
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility", meta = (DisplayName = "String to SHA1"))
static FString PercentEncode(const FString &Source)
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility")
static bool Base64Decode(const FString &Source, FString &Dest)
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility", meta = (DisplayName = "Base64 Decode"))
UCLASS(config = Engine, defaultconfig)