Files
UnrealEngineUWP/Engine/Source/Runtime/NetworkFileSystem/Private/NetworkFileSystemModule.cpp
ryan durand 0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00

61 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "Misc/CommandLine.h"
#include "Modules/ModuleManager.h"
#include "INetworkFileSystemModule.h"
#include "NetworkFileSystemLog.h"
#include "NetworkFileServer.h"
#include "NetworkFileServerHttp.h"
#include "Interfaces/ITargetPlatformManagerModule.h"
DEFINE_LOG_CATEGORY(LogFileServer);
/**
* Implements the NetworkFileSystem module.
*/
class FNetworkFileSystemModule
: public INetworkFileSystemModule
{
public:
// INetworkFileSystemModule interface
virtual INetworkFileServer* CreateNetworkFileServer( bool bLoadTargetPlatforms, int32 Port, FNetworkFileDelegateContainer NetworkFileDelegateContainer, const ENetworkFileServerProtocol Protocol ) const override
{
TArray<ITargetPlatform*> ActiveTargetPlatforms;
if (bLoadTargetPlatforms)
{
ITargetPlatformManagerModule& TPM = GetTargetPlatformManagerRef();
// if we didn't specify a target platform then use the entire target platform list (they could all be possible!)
FString Platforms;
if (FParse::Value(FCommandLine::Get(), TEXT("TARGETPLATFORM="), Platforms))
{
ActiveTargetPlatforms = TPM.GetActiveTargetPlatforms();
}
else
{
ActiveTargetPlatforms = TPM.GetTargetPlatforms();
}
}
switch ( Protocol )
{
#if ENABLE_HTTP_FOR_NFS
case NFSP_Http:
return new FNetworkFileServerHttp(Port, NetworkFileDelegateContainer, ActiveTargetPlatforms);
#endif
case NFSP_Tcp:
return new FNetworkFileServer(Port, NetworkFileDelegateContainer, ActiveTargetPlatforms);
}
return NULL;
}
};
IMPLEMENT_MODULE(FNetworkFileSystemModule, NetworkFileSystem);