Skip to content
Snippets Groups Projects
Commit d1f00a25 authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

send last modification time of files to check for changed files

parent bcf588c3
No related branches found
No related tags found
1 merge request!9VAServerLauncher Improvement (now also sending reproduction type and ini)
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "VAUtils.h" #include "VAUtils.h"
#include "VASettings.h" #include "VASettings.h"
#include "VAPlugin.h" #include "VAPlugin.h"
#include "HAL/FileManagerGeneric.h"
bool FVAServerLauncher::RemoteStartVAServer(const FString& Host, const int Port, const FString& VersionName, const FString& VARendererIniFile, const EReproductionInput ReproductionInputType) bool FVAServerLauncher::RemoteStartVAServer(const FString& Host, const int Port, const FString& VersionName, const FString& VARendererIniFile, const EReproductionInput ReproductionInputType)
...@@ -213,15 +214,23 @@ bool FVAServerLauncher::SendFileToVAServer(const FString& RelativeFilename) ...@@ -213,15 +214,23 @@ bool FVAServerLauncher::SendFileToVAServer(const FString& RelativeFilename)
TArray<uint8> FileBinaryArray; TArray<uint8> FileBinaryArray;
FFileHelper::LoadFileToArray(FileBinaryArray, *FPaths::Combine(FPaths::ProjectContentDir(),RelativeFilename)); FFileHelper::LoadFileToArray(FileBinaryArray, *FPaths::Combine(FPaths::ProjectContentDir(),RelativeFilename));
FString FullPath = FPaths::Combine(FPaths::ProjectContentDir(), RelativeFilename);
const TCHAR* charFilePath = *FullPath;
FFileManagerGeneric fm;
FDateTime LastModification = fm.GetTimeStamp(charFilePath);
const FString ProjectName = GetDefault<UGeneralProjectSettings>()->ProjectName; const FString ProjectName = GetDefault<UGeneralProjectSettings>()->ProjectName;
FString MetaInfo = "file:"+RelativeFilename+":"+FString::FromInt(FileBinaryArray.Num())+":"+ProjectName; FString MetaInfo = "file:"
+RelativeFilename+":"
+FString::FromInt(FileBinaryArray.Num())+":"
+ProjectName+":"
+FString::FromInt(LastModification.ToUnixTimestamp());
TArray<uint8> MetaInfoBinary = ConvertString(MetaInfo); TArray<uint8> MetaInfoBinary = ConvertString(MetaInfo);
int32 BytesSend; int32 BytesSend;
VAServerLauncherSocket->Send(MetaInfoBinary.GetData(), MetaInfoBinary.Num(), BytesSend); VAServerLauncherSocket->Send(MetaInfoBinary.GetData(), MetaInfoBinary.Num(), BytesSend);
//Receive response //Receive response
const int32 BufferSize = 16; const int32 BufferSize = 128;
int32 BytesRead = 0; int32 BytesRead = 0;
uint8 Response[16]; uint8 Response[16];
if (VAServerLauncherSocket->Recv(Response, BufferSize, BytesRead)) if (VAServerLauncherSocket->Recv(Response, BufferSize, BytesRead))
...@@ -239,7 +248,8 @@ bool FVAServerLauncher::SendFileToVAServer(const FString& RelativeFilename) ...@@ -239,7 +248,8 @@ bool FVAServerLauncher::SendFileToVAServer(const FString& RelativeFilename)
} }
FVAUtils::LogStuff("[FVAServerLauncher::SendFileToVAServer()]: Entire file ("+RelativeFilename+") send!", false); FVAUtils::LogStuff("[FVAServerLauncher::SendFileToVAServer()]: Entire file ("+RelativeFilename+") send!", false);
VAServerLauncherSocket->Recv(Response, BufferSize, BytesRead); VAServerLauncherSocket->Recv(Response, BufferSize, BytesRead);
if(BytesRead==3 && Response[0]=='a' && Response[1]=='c' && Response[2]=='k') ResponseString = ByteArrayToString(Response, BytesRead);
if(ResponseString == "ack")
{ {
FVAUtils::LogStuff("[FVAServerLauncher::SendFileToVAServer()]: File was received by VAServerLauncher successfully!", false); FVAUtils::LogStuff("[FVAServerLauncher::SendFileToVAServer()]: File was received by VAServerLauncher successfully!", false);
//the search path is added potenitally multiple times, but can only be added once the folder is created (which the above guarantees) //the search path is added potenitally multiple times, but can only be added once the folder is created (which the above guarantees)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment