New Parser Completed. Verification next.
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ShooterGameModeBase.h"
|
||||
|
||||
#include "ShooterGameMode.generated.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogShooterGameMode, Log, All);
|
||||
@@ -12,47 +11,27 @@ DECLARE_LOG_CATEGORY_EXTERN(LogShooterGameMode, Log, All);
|
||||
struct FProcessParameters;
|
||||
struct FServerParameters;
|
||||
|
||||
struct FGameLiftCliConfig
|
||||
struct FGameLiftConfig
|
||||
{
|
||||
bool bDebugMode = false;
|
||||
bool bIsAnywhereFleet = false;
|
||||
bool bIsCriticalError = false;
|
||||
|
||||
int32 ServerPort = 0;
|
||||
|
||||
int32 ServerPort;
|
||||
|
||||
FString AuthToken;
|
||||
FString FleetId;
|
||||
FString HostId;
|
||||
FString WebSocketUrl;
|
||||
FString ServerRegion;
|
||||
|
||||
};
|
||||
|
||||
namespace GameLiftValidators
|
||||
enum ETokenStatus : uint8
|
||||
{
|
||||
extern const FRegexPattern FleetIdPattern;
|
||||
extern const int32 FleetIdLengthMin;
|
||||
extern const int32 FleetIdLengthMax;
|
||||
extern const FString ServerRegionPattern;
|
||||
extern const int32 ServerRegionLengthMin;
|
||||
extern const int32 ServerRegionLengthMax;
|
||||
extern const FString WebSocketUrlPattern;
|
||||
extern const int32 WebSocketUrlLengthMin;
|
||||
extern const int32 WebSocketUrlLengthMax;
|
||||
extern const FString AuthTokenPattern;
|
||||
extern const int32 AuthTokenLengthMin;
|
||||
extern const int32 AuthTokenLengthMax;
|
||||
extern const FString HostIdPattern;
|
||||
extern const int32 HostIdLengthMin;
|
||||
extern const int32 HostIdLengthMax;
|
||||
extern const int32 ServerPortMin;
|
||||
extern const int32 ServerPortMax;
|
||||
extern const int32 WebSocketPortMin;
|
||||
extern const int32 WebSocketPortMax;
|
||||
|
||||
bool IsStringValid(const FString& Value, const FRegexPattern& OptionalPattern, int32 Min, int32 Max);
|
||||
bool IsNumberValid(int32 Value, int32 Min, int32 Max);
|
||||
}
|
||||
Found,
|
||||
NotFoundRequired,
|
||||
NotFoundNotRequired
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -61,55 +40,21 @@ UCLASS()
|
||||
class FPSTEMPLATE_API AShooterGameMode : public AShooterGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
AShooterGameMode();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
UPROPERTY(Config, BlueprintReadOnly)
|
||||
bool bIsAnywhereFleet = false;
|
||||
|
||||
UPROPERTY(Config, BlueprintReadOnly)
|
||||
FString FleetId;
|
||||
|
||||
UPROPERTY(Config, BlueprintReadOnly)
|
||||
FString AuthToken;
|
||||
|
||||
UPROPERTY(Config, BlueprintReadOnly)
|
||||
FString HostId;
|
||||
|
||||
UPROPERTY(Config, BlueprintReadOnly)
|
||||
FString WebSocketUrl;
|
||||
|
||||
UPROPERTY(Config)
|
||||
FString ServerRegion;
|
||||
|
||||
UPROPERTY(Config, BlueprintReadOnly)
|
||||
int32 ServerPort;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bDebugMode = false;
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
|
||||
void InitGame_original(const FString& MapName, const FString& Options, FString& ErrorMessage);
|
||||
|
||||
private:
|
||||
|
||||
FGameLiftCliConfig GameLiftConfig;
|
||||
|
||||
FString CachedCommandLine;
|
||||
TSharedPtr<FProcessParameters> ProcessParameters;
|
||||
TSharedPtr<FServerParameters> ServerParameters;
|
||||
|
||||
int32 GetConfiguredOrDefaultPort() const;
|
||||
static FString GetSHA256Hash(const FString& Input);
|
||||
|
||||
bool ParseAndOutputResult(const FString& InString, FString& OutValue, bool bRequired = false);
|
||||
bool ParseAndValidate(const FString& InArguments, FGameLiftCliConfig& Config);
|
||||
static bool ValidateFleetId(const FString& InFleetId);
|
||||
|
||||
void InitGameLift();
|
||||
};
|
||||
|
||||
private:
|
||||
FGameLiftConfig GameLiftConfig;
|
||||
FString CachedCommandLine;
|
||||
|
||||
static FString GetSHA256Hash(const FString& CommandLineString);
|
||||
void InitGameLift();
|
||||
|
||||
bool GetAnywhereFleetParameters(FString CommandLineString);
|
||||
void LogAnywhereFleetParameters();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user