You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#include "pch.h"
|
|
#include "DrawerIO.h"
|
|
#include "DrawModel\BaseLib.h"
|
|
#include "DrawOperator\DrawLib.h"
|
|
|
|
bool CDrawerIO::OpenFile(LPCTSTR lpszFileName, CXy * pXy)
|
|
{
|
|
if (pXy->ReadOtherWithExtension(lpszFileName))
|
|
{
|
|
return true;
|
|
}
|
|
CFile file;
|
|
if (file.Open(lpszFileName, CFile::modeRead))
|
|
{
|
|
// m_FileName = lpszFileName;
|
|
CArchive ar(&file, CArchive::load);
|
|
Serialize(ar, pXy);
|
|
ar.Close();
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
file.Close();
|
|
return true;
|
|
}
|
|
|
|
void CDrawerIO::Serialize(CArchive & ar, CXy * pXy)
|
|
{
|
|
if (ar.IsStoring()) {}
|
|
else
|
|
{
|
|
if (pXy == nullptr) pXy = new CXy;
|
|
pXy->m_bRealTimeDraw = false;
|
|
CString name = ar.GetFile()->GetFileName();
|
|
name.MakeLower();
|
|
CSplitPath sp(name);
|
|
|
|
CString ext = sp.GetExtension();
|
|
//ar.m_pDocument = this; // set back-pointer in archive
|
|
if (ext == _T(".dfb") || ext == _T(".dft"))
|
|
{
|
|
pXy->m_version = pXy->DFB_ReadVersion(ar);
|
|
pXy->DFB_ReadEncrypt(ar, pXy->m_version);
|
|
if (pXy->IsEncrypted()) {
|
|
}
|
|
pXy->DFB_Serialize(ar, pXy->m_version);
|
|
}
|
|
else if (ext == ".dml" || ext == ".xml")
|
|
pXy->DML_Read2(*(ar.GetFile()));
|
|
else if (ext == ".pcg")
|
|
pXy->PCG_Read2(*(ar.GetFile()));
|
|
else
|
|
pXy->DFD_Read2(*(ar.GetFile()));
|
|
}
|
|
}
|