本文整理汇总了C++中FArchive::AtEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ FArchive::AtEnd方法的具体用法?C++ FArchive::AtEnd怎么用?C++ FArchive::AtEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArchive
的用法示例。
在下文中一共展示了FArchive::AtEnd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
// Have a similar process function for the normal tcp connection.
void FNetworkFileServerHttp::Process(FArchive& In, TArray<uint8>&Out, FNetworkFileServerHttp* Server)
{
int loops = 0;
while(!In.AtEnd())
{
UE_LOG(LogFileServer, Log, TEXT("In %d "), loops++);
// Every Request has a Guid attached to it - similar to Web session IDs.
FGuid ClientGuid;
In << ClientGuid;
UE_LOG(LogFileServer, Log, TEXT("Recieved GUID %s"), *ClientGuid.ToString());
FNetworkFileServerClientConnectionHTTP* Connection = NULL;
if (Server->RequestHandlers.Contains(ClientGuid))
{
UE_LOG(LogFileServer, Log, TEXT("Picking up an existing handler" ));
Connection = Server->RequestHandlers[ClientGuid];
}
else
{
UE_LOG(LogFileServer, Log, TEXT("Creating a handler" ));
Connection = Server->CreateNewConnection();
Server->RequestHandlers.Add(ClientGuid,Connection);
}
Connection->ProcessPayload(In);
Out.Append(Connection->GetOutBuffer());
Connection->ResetBuffer();
}
}
示例2: VerifyFile
uint8 FBuildPatchUtils::VerifyFile(const FString& FileToVerify, const FSHAHashData& Hash1, const FSHAHashData& Hash2, FBuildPatchFloatDelegate ProgressDelegate, FBuildPatchBoolRetDelegate ShouldPauseDelegate, double& TimeSpentPaused)
{
uint8 ReturnValue = 0;
FArchive* FileReader = IFileManager::Get().CreateFileReader(*FileToVerify);
ProgressDelegate.ExecuteIfBound(0.0f);
if (FileReader != NULL)
{
FSHA1 HashState;
FSHAHashData HashValue;
const int64 FileSize = FileReader->TotalSize();
uint8* FileReadBuffer = new uint8[FileBufferSize];
while (!FileReader->AtEnd() && !FBuildPatchInstallError::HasFatalError())
{
// Pause if necessary
const double PrePauseTime = FPlatformTime::Seconds();
double PostPauseTime = PrePauseTime;
bool bShouldPause = ShouldPauseDelegate.IsBound() && ShouldPauseDelegate.Execute();
while (bShouldPause && !FBuildPatchInstallError::HasFatalError())
{
FPlatformProcess::Sleep(0.1f);
bShouldPause = ShouldPauseDelegate.Execute();
PostPauseTime = FPlatformTime::Seconds();
}
// Count up pause time
TimeSpentPaused += PostPauseTime - PrePauseTime;
// Read file and update hash state
const int64 SizeLeft = FileSize - FileReader->Tell();
const uint32 ReadLen = FMath::Min< int64 >(FileBufferSize, SizeLeft);
FileReader->Serialize(FileReadBuffer, ReadLen);
HashState.Update(FileReadBuffer, ReadLen);
const double FileSizeTemp = FileSize;
const float Progress = 1.0f - ((SizeLeft - ReadLen) / FileSizeTemp);
ProgressDelegate.ExecuteIfBound(Progress);
}
delete[] FileReadBuffer;
HashState.Final();
HashState.GetHash(HashValue.Hash);
ReturnValue = (HashValue == Hash1) ? 1 : (HashValue == Hash2) ? 2 : 0;
if (ReturnValue == 0)
{
GLog->Logf(TEXT("BuildDataGenerator: Verify failed on %s"), *FPaths::GetCleanFilename(FileToVerify));
}
FileReader->Close();
delete FileReader;
}
else
{
GLog->Logf(TEXT("BuildDataGenerator: ERROR VerifyFile cannot open %s"), *FileToVerify);
}
ProgressDelegate.ExecuteIfBound(1.0f);
return ReturnValue;
}
示例3: VerifyChunkFile
bool FBuildPatchUtils::VerifyChunkFile( FArchive& ChunkFileData, bool bQuickCheck )
{
const int64 FileSize = ChunkFileData.TotalSize();
bool bSuccess = ChunkFileData.IsLoading();
if ( !bSuccess )
{
GLog->Logf( TEXT( "BuildPatchServices: ERROR: VerifyChunkFile expected readonly archive" ) );
}
else
{
// Read the header
FChunkHeader Header;
ChunkFileData << Header;
// Check header magic
if ( !Header.IsValidMagic() )
{
bSuccess = false;
GLog->Logf( TEXT( "BuildPatchServices: ERROR: VerifyChunkFile corrupt header" ) );
}
// Check Header and data size
if ( bSuccess && ( Header.HeaderSize + Header.DataSize ) != FileSize )
{
bSuccess = false;
GLog->Logf( TEXT( "BuildPatchServices: ERROR: VerifyChunkFile header info does not match file size" ) );
}
if( bSuccess && !bQuickCheck )
{
// Hashes for checking data
FSHA1 SHAHasher;
FSHAHashData SHAHash;
uint64 CycPoly64Hash = 0;
// Load the data to check
uint8* FileReadBuffer = new uint8[ FileBufferSize ];
int64 DataOffset = 0;
switch ( Header.StoredAs )
{
case FChunkHeader::STORED_RAW:
while( !ChunkFileData.AtEnd() )
{
const int64 SizeLeft = FileSize - ChunkFileData.Tell();
const uint32 ReadLen = FMath::Min< int64 >( FileBufferSize, SizeLeft );
ChunkFileData.Serialize( FileReadBuffer, ReadLen );
switch ( Header.HashType )
{
case FChunkHeader::HASH_ROLLING:
CycPoly64Hash = FCycPoly64Hash::GetHashForDataSet(FileReadBuffer, ReadLen, CycPoly64Hash);
break;
case FChunkHeader::HASH_SHA1:
SHAHasher.Update( FileReadBuffer, ReadLen );
break;
default:
check( false ); // @TODO LSwift: Implement other storage methods!
bSuccess = false;
break;
}
DataOffset += ReadLen;
}
if( bSuccess )
{
switch ( Header.HashType )
{
case FChunkHeader::HASH_ROLLING:
bSuccess = Header.RollingHash == CycPoly64Hash;
break;
case FChunkHeader::HASH_SHA1:
SHAHasher.Final();
SHAHasher.GetHash( SHAHash.Hash );
bSuccess = SHAHash == Header.SHAHash;
break;
}
if (!bSuccess)
{
GLog->Logf(TEXT("BuildPatchServices: ERROR: VerifyChunkFile file hashcheck failed"));
}
}
break;
default:
GLog->Logf( TEXT( "BuildPatchServices: ERROR: VerifyChunkFile failed, unknown storage type" ) );
bSuccess = false;
break;
}
delete[] FileReadBuffer;
}
}
return bSuccess;
}