Ejemplo n.º 1
0
//****************************************************************************************
BOOL CBCGPGridSerializeManager::SerializeFrom (CFile& file)
{
	ASSERT (m_pOwnerGrid != NULL);
	
	CArchive archive (&file, CArchive::load | CArchive::bNoFlushOnDelete);
	BOOL bResult = ReadFromArchive (archive);
	archive.Close ();

	return bResult;
}
Ejemplo n.º 2
0
bool FTextLocalizationManager::FLocalizationEntryTracker::ReadFromFile(const FString& FilePath)
{
	FArchive* Reader = IFileManager::Get().CreateFileReader( *FilePath );
	if( !Reader )
	{
		return false;
	}

	Reader->SetForceUnicode(true);

	ReadFromArchive(*Reader, FilePath);

	bool Success = Reader->Close();
	delete Reader;

	return Success;
}
Ejemplo n.º 3
0
void CEditView::Serialize(CArchive& ar)
	// Read and write CEditView object to archive, with length prefix.
{
	ASSERT_VALID(this);
	ASSERT(m_hWnd != NULL);
	if (ar.IsStoring())
	{
		UINT nLen = GetBufferLength();
		ar << (DWORD)nLen;
		WriteToArchive(ar);
	}
	else
	{
		DWORD dwLen;
		ar >> dwLen;
		if (dwLen > nMaxSize)
			AfxThrowArchiveException(CArchiveException::badIndex);
		UINT nLen = (UINT)dwLen;
		ReadFromArchive(ar, nLen);
	}
	ASSERT_VALID(this);
}
Ejemplo n.º 4
0
void CEditView::SerializeRaw(CArchive& ar)
	// Read/Write object as stand-alone file.
{
	ASSERT_VALID(this);
	if (ar.IsStoring())
	{
		WriteToArchive(ar);
	}
	else
	{
		CFile* pFile = ar.GetFile();
		ASSERT(pFile->GetPosition() == 0);
		DWORD nFileSize = pFile->GetLength();
		if (nFileSize/sizeof(TCHAR) > nMaxSize)
		{
			AfxMessageBox(AFX_IDP_FILE_TOO_LARGE);
			AfxThrowUserException();
		}
		// ReadFromArchive takes the number of characters as argument
		ReadFromArchive(ar, (UINT)nFileSize/sizeof(TCHAR));
	}
	ASSERT_VALID(this);
}