4#include "HeadMountedDisplayFunctionLibrary.h"
5#include "Kismet/GameplayStatics.h"
7#include "HAL/PlatformFilemanager.h"
8#include "GenericPlatform/GenericPlatformFile.h"
9#include "Misc/CString.h"
10#include "Misc/FileHelper.h"
12#include "Misc/CString.h"
14#include "Kismet/GameplayStatics.h"
17#include "Android/AndroidPlatformMisc.h"
21#include "Editor/EditorEngine.h"
28bool ExportToCSV(FString ThePath, FString textbody, FString fileName, FString folderName,
bool OverwriteFile);
31 const FTransform& ComponentRelativeTransform)
33 if (Class !=
nullptr && Outer !=
nullptr)
36 if (Component !=
nullptr)
40 Component->SetupAttachment(ParentComp);
43 Component->RegisterComponent();
44 Component->SetRelativeTransform(ComponentRelativeTransform);
60 FString FolderName,
bool OverwriteFile)
62 FString ThePath = FilePath;
63 return ExportToCSV(ThePath, Textbody, FileName, FolderName, OverwriteFile);
68 FString deviceName = TEXT(
"None");
71 deviceName = FAndroidMisc::GetDeviceModel();
73 deviceName = UHeadMountedDisplayFunctionLibrary::GetHMDDeviceName().ToString();
81 FString ValueReceived1;
83 TEXT(
"/Script/EngineSettings.GeneralProjectSettings"),
86 TEXT(
"ProjectVersion"),
94 FString ValueReceived1;
95 bool bEnabled =
false;
99 TEXT(
"/Script/Pixo.TerminateValues"),
105 TEXT(
"/Script/Pixo.TerminateValues"),
106 TEXT(
"MonthDayYear"),
119 const ANSICHAR* password = TCHAR_TO_ANSI(*Password);
128 FCString::Sprintf(Buffer + 2 * i, TEXT(
"%02x"), Digest[i]);
130 FString Signature(Buffer);
155 bool Result = UGameplayStatics::SaveGameToSlot(SaveGame,
CacheFileName, 0);
164 return (LoginInfo == LoginCache->
LoginInfo);
172 bool Result = UGameplayStatics::DeleteGameInSlot(
CacheFileName, 0);
179 return UGameplayStatics::DoesSaveGameExist(
CacheFileName, 0);
185 FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::RootDir());
186 return ExportToCSV(ThePath, Textbody, FileName, FolderName, OverwriteFile);
189bool ExportToCSV(FString ThePath, FString Textbody, FString FileName, FString FolderName,
bool OverwriteFile)
191 ThePath += TEXT(
"/") + FolderName;
192 FileName += TEXT(
".csv");
193 IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
195 if (!PlatformFile.DirectoryExists(*ThePath))
197 PlatformFile.CreateDirectory(*ThePath);
199 FString AbsoluteFilePath = ThePath + TEXT(
"/") + FileName;
203 FFileHelper::SaveStringToFile(Textbody, *AbsoluteFilePath);
206 FFileHelper::SaveStringToFile(Textbody, *AbsoluteFilePath, FFileHelper::EEncodingOptions::AutoDetect,
207 &IFileManager::Get(),
216 return GetDefault<UPixoCoreSettings>()->OfflineMode;
221 return GetDefault<UPixoCoreSettings>()->OfflineTime;
226 return GetDefault<UPixoCoreSettings>()->MapAfterLogin;
231 return GetDefault<UPixoCoreSettings>()->MapAfterIntro;
236 return GetDefault<UPixoCoreSettings>()->TestServerIP;
241 FInternationalization::Get().SetCurrentCulture(Culture);
246 if (Culture.Equals(
"en"))
248 else if (Culture.Equals(
"de"))
251 return "Undefined Language";
257 if (!FParse::Bool(FCommandLine::Get(), TEXT(
"-PIXOVR_LS_USE_SSL="), UseSSL))
259 if (GConfig && !GConfig->GetBool(TEXT(
"OnlineSubsystemPixoVR"), TEXT(
"UseSSL"), UseSSL, GEngineIni))
267 Protocol = TEXT(
"https://");
271 Protocol = TEXT(
"http://");
274 FString IP =
"127.0.0.1";
275 if (!FParse::Value(FCommandLine::Get(), TEXT(
"-PIXOVR_MS_IP="), IP))
277 if (GConfig && !GConfig->GetString(TEXT(
"OnlineSubsystemPixoVR"), TEXT(
"IP"), IP, GEngineIni))
283 if (!FParse::Value(FCommandLine::Get(), TEXT(
"-PIXOVR_MS_PORT="), Port))
285 if (GConfig && !GConfig->GetInt(TEXT(
"OnlineSubsystemPixoVR"), TEXT(
"Port"), Port, GEngineIni))
290 FString MasterServiceURL = Protocol + IP +
":" + FString::FromInt(Port);
292 return MasterServiceURL;
void sha256_final(SHA256_CTX *ctx, PIXOVR_BYTE hash[])
void sha256_update(SHA256_CTX *ctx, const PIXOVR_BYTE data[], size_t len)
void sha256_init(SHA256_CTX *ctx)
#define SHA256_BLOCK_SIZE
bool ExportToCSV(FString ThePath, FString textbody, FString fileName, FString folderName, bool OverwriteFile)
const FString CacheFileName
DEFINE_LOG_CATEGORY(PixoVRFunctionLibrary)
static float GetOfflineTime()
Retrieves the time in seconds for offline mode.
static bool DeleteAuthJSON()
Deletes the authentication cache file from the disk.
static FPixoLoginInfo EncryptLoginInfo(const FPixoLoginInfo &LoginInfo, const FString &Password)
Encrypts the login information using the specified password.
static bool CompareAuthJSON(const FPixoLoginInfo &LoginInfo)
Compares the credentials of the authentication.
static bool GetKillSwitchValues(FString &MonthDayYear)
Retrieves the kill switch values from the configuration file.
static bool ExportToCSVToSpecifiedPath(FString FilePath, FString Textbody, FString FileName, FString OptionalFolderName, bool OverwriteFile)
Exports the specified text as a CSV file to the specified file path.
static bool CheckAuthJSON()
Checks if the authentication cache file exists.
static bool LoadAuthFromJSON(FPixoLoginInfo &LoginInfo)
Loads the cached authentication from a JSON file and fills the necessary UMG fields.
static USceneComponent * AddSceneComponentByClass(UObject *Outer, TSubclassOf< USceneComponent > Class, const FTransform &ComponentRelativeTransform)
Adds a scene component based on the specified class to the given outer object.
static FName GetMapAfterIntro()
Retrieves the map name to load after the introduction.
static bool ExportToCSVToProjectRootDirectory(FString Textbody, FString FileName, FString OptionalFolderName, bool OverwriteFile)
Exports the specified text as a CSV file to the project root directory.
static bool SaveAuthToJSON(const FPixoLoginInfo &LoginInfo)
Caches the authentication fields from the UMG widget to a JSON file.
static FString GetMasterServiceIP()
Retrieves the IP address of the master service. Probably not used.
static FName GetMapAfterLogin()
Retrieves the map name to load after login.
static FString GetHMDFullDeviceName()
Retrieves the full device name of the HMD (Head-Mounted Display).
static void GetVersionName(FString &Version)
Retrieves the version name.
static FString GetTestServerIP()
Retrieves the IP address of the test server.
static bool GetIsOfflineModeEnabled()
Retrieves the flag indicating whether offline mode is enabled.
static void SetLocalizationCulture(FString Culture)
Sets the localization culture.
static FName GetFullCultureName(FString Culture)
Retrieves the full culture name based on the specified culture.
static FString NewLineCharacter()
Retrieves the newline character used in the current platform.
Cache class for storing login information. It allows to save password of user, so the next time user ...
FPixoLoginInfo LoginInfo
UPROPERTY(VisibleAnywhere, Category = "Pixo HTTP")
Structure representing login information.
bool Encrypted
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pixo HTTP")
FString Password
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pixo HTTP")