2014-03-14 14:13:41 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "NetworkFileSystemPrivatePCH.h"
|
2014-04-23 18:35:08 -04:00
|
|
|
#include "TargetDeviceId.h"
|
|
|
|
|
#include "ITargetDevice.h"
|
|
|
|
|
#include "ITargetPlatformManagerModule.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "ModuleManager.h"
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
DEFINE_LOG_CATEGORY(LogFileServer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements the NetworkFileSystem module.
|
|
|
|
|
*/
|
|
|
|
|
class FNetworkFileSystemModule
|
|
|
|
|
: public INetworkFileSystemModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// INetworkFileSystemModule interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-07-07 15:39:19 -04:00
|
|
|
virtual INetworkFileServer* CreateNetworkFileServer( int32 Port, const FFileRequestDelegate* InFileRequestDelegate, const FRecompileShadersDelegate* InRecompileShadersDelegate, const ENetworkFileServerProtocol Protocol ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-23 18:33:50 -04:00
|
|
|
TArray<ITargetPlatform*> ActiveTargetPlatforms;
|
|
|
|
|
|
|
|
|
|
// only bother getting the target platforms if there was "-targetplatform" on the commandline, otherwise UnrealFileServer will
|
|
|
|
|
// log out some scary sounding, but innocuous logs
|
|
|
|
|
FString Platforms;
|
|
|
|
|
if (FParse::Value(FCommandLine::Get(), TEXT("TARGETPLATFORM="), Platforms))
|
|
|
|
|
{
|
|
|
|
|
ITargetPlatformManagerModule& TPM = GetTargetPlatformManagerRef();
|
|
|
|
|
ActiveTargetPlatforms = TPM.GetActiveTargetPlatforms();
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-07 15:39:19 -04:00
|
|
|
switch ( Protocol )
|
|
|
|
|
{
|
|
|
|
|
#if ENABLE_HTTP_FOR_NFS
|
|
|
|
|
case NFSP_Http:
|
|
|
|
|
return new FNetworkFileServerHttp(Port, InFileRequestDelegate, InRecompileShadersDelegate, ActiveTargetPlatforms);
|
|
|
|
|
#endif
|
|
|
|
|
case NFSP_Tcp:
|
|
|
|
|
return new FNetworkFileServer(Port, InFileRequestDelegate, InRecompileShadersDelegate, ActiveTargetPlatforms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
IMPLEMENT_MODULE(FNetworkFileSystemModule, NetworkFileSystem);
|