Exemple #1
0
void CXYChart::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		ar.Write( m_PlotColor, kMaxDataSets * sizeof( COLORREF ) );
		ar.Write( m_MarkerSize, kMaxDataSets * sizeof( int ) );
		ar.Write( m_MarkerType, kMaxDataSets * sizeof( int ) );
		ar.Write( m_MarkerFrequency, kMaxDataSets * sizeof( int ) );
		ar.Write( m_ChartType, kMaxDataSets * sizeof( int ) );
		ar.Write( m_XDataMin, kMaxDataSets * sizeof( double ) );
		ar.Write( m_XDataMax, kMaxDataSets * sizeof( double ) );
		ar.Write( m_YDataMin, kMaxDataSets * sizeof( double ) );
		ar.Write( m_YDataMax, kMaxDataSets * sizeof( double ) );
		ar.Write( m_DataRangesSet, kMaxDataSets * sizeof( BOOL ) );
		ar.Write( m_DataLineSize, kMaxDataSets * sizeof( int ) );
		ar.Write( m_MarkerFill, kMaxDataSets * sizeof( BOOL ) );
		ar.Write( m_DataLineStyle, kMaxDataSets * sizeof( int ) );
	}
	else
	{
		ar.Read( m_PlotColor, kMaxDataSets * sizeof( COLORREF ) );
		ar.Read( m_MarkerSize, kMaxDataSets * sizeof( int ) );
		ar.Read( m_MarkerType, kMaxDataSets * sizeof( int ) );
		ar.Read( m_MarkerFrequency, kMaxDataSets * sizeof( int ) );
		ar.Read( m_ChartType, kMaxDataSets * sizeof( int ) );
		ar.Read( m_XDataMin, kMaxDataSets * sizeof( double ) );
		ar.Read( m_XDataMax, kMaxDataSets * sizeof( double ) );
		ar.Read( m_YDataMin, kMaxDataSets * sizeof( double ) );
		ar.Read( m_YDataMax, kMaxDataSets * sizeof( double ) );
		ar.Read( m_DataRangesSet, kMaxDataSets * sizeof( BOOL ) );
		ar.Read( m_DataLineSize, kMaxDataSets * sizeof( int ) );
		ar.Read( m_MarkerFill, kMaxDataSets * sizeof( BOOL ) );
		ar.Read( m_DataLineStyle, kMaxDataSets * sizeof( int ) );
	}
}
Exemple #2
0
void CTyHMProxy::Ty_Serialize(CArchive &ar)
{
	if (ar.IsStoring())
	{
		ar<<m_x0<<m_y0<<m_x1<<m_y1;
		ar.Write((unsigned char *)m_hmname,sizeof(char)*33);
		ar<<m_display;
		ar.Write((unsigned char *)m_str1,sizeof(char)*33);
		ar.Write((unsigned char *)m_str2,sizeof(char)*33);
		ar<<m_color1<<m_color2<<m_bFlash<<m_FangXiang<<m_TextHeight<<m_TextWidth<<m_JqWidth;
		ar.Write((unsigned char *)m_TextFont,sizeof(char)*16);
		ar<<m_bTranslate1<<m_bTranslate2;
	} 
	else 
	{
		UnRegister();
		ar>>m_x0>>m_y0>>m_x1>>m_y1;
		ar.Read((unsigned char *)m_hmname,sizeof(char)*33);
		ar>>m_display;
		ar.Read((unsigned char *)m_str1,sizeof(char)*33);
		ar.Read((unsigned char *)m_str2,sizeof(char)*33);
		ar>>m_color1>>m_color2>>m_bFlash>>m_FangXiang>>m_TextHeight>>m_TextWidth>>m_JqWidth;
		ar.Read((unsigned char *)m_TextFont,sizeof(char)*16);
		ar>>m_bTranslate1>>m_bTranslate2;
		Register();
	}
}
void CSZ_SgbwLink::Serialize_Ty(CArchive &ar)
{
	int i;
	SZ_S_SGBWLINEBASE LineInfo;

	if (ar.IsStoring())
	{
		ar.Write((unsigned char *)&m_sMainInfo,sizeof(SZ_S_SGBWMAININFO));
		ar.Write((unsigned char *)&m_nLineCount,sizeof(m_nLineCount));
		for(i=0;i<m_nLineCount;i++)
		{
			LineInfo=m_sLineInfo[i];
			ar.Write((unsigned char *)&LineInfo,sizeof(SZ_S_SGBWLINEBASE));
		}
	}
	else
	{
		ar.Read((unsigned char *)&m_sMainInfo,sizeof(SZ_S_SGBWMAININFO));
		ar.Read((unsigned char *)&m_nLineCount,sizeof(m_nLineCount));
		for(i=0;i<m_nLineCount;i++)
		{
			ar.Read((unsigned char *)&LineInfo,sizeof(SZ_S_SGBWLINEBASE));
			m_sLineInfo[i]=LineInfo;
		}
	}
}
Exemple #4
0
void CMetaparm::Serialize(CArchive& ar)
{
	if (ar.IsStoring()) {
#ifdef METAFFREND	// MetaFFRend DLL never stores, so save space
		ASSERT(0);
#else
		ar << m_Name;
		METAPARM_BASE_INFO&	mpbi = *this;
		ar.Write(&mpbi, sizeof(mpbi));	// write base struct
		m_Slave.Serialize(ar);
		ar << m_Master;
#endif
	} else {
		ar >> m_Name;
		if (m_Version < 5) {
			METAPARM_BASE_INFO_V1&	mpbi = *this;
			ar.Read(&mpbi, sizeof(mpbi));	// read version 1 base struct
		} else {
			METAPARM_BASE_INFO&	mpbi = *this;
			ar.Read(&mpbi, sizeof(mpbi));	// read base struct
			m_Slave.Serialize(ar);
			ar >> m_Master;
		}
	}
}
Exemple #5
0
void CDrawObj::Serialize(CArchive& ar)
{
	CObject::Serialize(ar);
	if (ar.IsStoring())
	{
		ar << m_position;
		ar << (WORD)m_bPen;
		ar.Write(&m_logpen, sizeof(LOGPEN));
		ar << (WORD)m_bBrush;
		ar.Write(&m_logbrush, sizeof(LOGBRUSH));
	}
	else
	{
		// get the document back pointer from the archive
		m_pDocument = (CDrawDoc*)ar.m_pDocument;
		ASSERT_VALID(m_pDocument);
		ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDrawDoc)));

		WORD wTemp;
		ar >> m_position;
		ar >> wTemp; m_bPen = (BOOL)wTemp;
		ar.Read(&m_logpen,sizeof(LOGPEN));
		ar >> wTemp; m_bBrush = (BOOL)wTemp;
		ar.Read(&m_logbrush, sizeof(LOGBRUSH));
	}
}
Exemple #6
0
void CDrawWarn::Serialize(CArchive& ar)
{
	ASSERT_VALID(this);

	CDrawObj::Serialize(ar);
	if (ar.IsStoring())
	{
	}
	else
	{
		WORD wTemp;
		ar.Read(&m_ctlBackColor,sizeof(COLORREF));
		ar.Read(&m_ctlLineColor,sizeof(COLORREF));
		ar.Read(&m_ctlTextColor,sizeof(COLORREF));
		ar.Read(&m_ctlTitleColor,sizeof(COLORREF));
		ar >> m_nColCount;
		ar >> m_nRowCount;
		ar >> m_nCellWidth;
		ar >> m_nCellHeight;
		ar >> wTemp;		m_bIsAutoSize = (BOOL)wTemp;
		m_nPercent = new UINT[m_nRowCount];
		for(int i=0;i<m_nRowCount;i++)
			ar >> m_nPercent[i];

		m_fontStyle			= FontStyleRegular;
		m_fontSize			= 9;
		m_fontName			= "Arial";
		m_trimmingSyle		= StringTrimmingNone;
	}
}
void CDownloadWithTiger::Serialize(CArchive& ar, int nVersion)
{
	CDownloadWithTorrent::Serialize( ar, nVersion );

	m_pTigerTree.Serialize( ar );

	if ( m_pTigerTree.IsAvailable() )
	{
		if ( ar.IsStoring() )
		{
			ar << m_nTigerBlock;
			ar << m_nTigerSize;
			ar << m_nTigerSuccess;
			ar.Write( m_pTigerBlock, sizeof(BYTE) * m_nTigerBlock );
		}
		else
		{
			m_pTigerTree.SetupParameters( m_nSize );

			ar >> m_nTigerBlock;
			ar >> m_nTigerSize;
			ar >> m_nTigerSuccess;

			m_pTigerBlock = new BYTE[ m_nTigerBlock ];
			ar.Read( m_pTigerBlock, sizeof(BYTE) * m_nTigerBlock );
		}
	}

	if ( nVersion >= 19 )
	{
		m_pHashset.Serialize( ar );

		if ( m_pHashset.IsAvailable() )
		{
			if ( ar.IsStoring() )
			{
				ar << m_nHashsetBlock;
				ar << m_nHashsetSuccess;
				ar.Write( m_pHashsetBlock, sizeof(BYTE) * m_nHashsetBlock );
			}
			else
			{
				ar >> m_nHashsetBlock;
				ar >> m_nHashsetSuccess;

				m_pHashsetBlock = new BYTE[ m_nHashsetBlock ];
				ar.Read( m_pHashsetBlock, sizeof(BYTE) * m_nHashsetBlock );
			}
		}
	}
Exemple #8
0
void CMNP_SHXG::Serialize_Ty(CArchive &ar)
{
	if(ar.IsStoring())  
	{
		ar.Write((unsigned char *)&Node,sizeof(Node));
		ar.Write((unsigned char *)&Line,sizeof(Line));
		ar.Write((unsigned char *)&Unit,sizeof(Unit));
	}
	else
	{
		ar.Read((unsigned char *)&Node,sizeof(Node));
		ar.Read((unsigned char *)&Line,sizeof(Line));
		ar.Read((unsigned char *)&Unit,sizeof(Unit));
	}
}
void CTyStationAssistPng::Ty_Serialize(CArchive &ar)
{
	try
	{
		if(ar.IsStoring())  
		{
			ar<<m_x0<<m_y0<<m_x1<<m_y1;
			ar.Write(m_szPngName,sizeof(m_szPngName));
			ar<<m_bHScale<<m_bVScale;
			ar<<m_fRotateAngle;
		}
		else
		{
			ar>>m_x0>>m_y0>>m_x1>>m_y1;
			ar.Read(m_szPngName,sizeof(m_szPngName));
			ar>>m_bHScale>>m_bVScale;
			ar>>m_fRotateAngle;

			g_ImagePngMapX.RegisterImagePng(m_szPngName);
		}
	}
	catch(...)
	{

	}
}
void CMyFirstDocWindowDoc::Serialize(CArchive& ar)
{
	// CEditView contains an edit control which handles all serialization
	if (!m_viewList.IsEmpty())
	{
		reinterpret_cast<CEditView*>(m_viewList.GetHead())->SerializeRaw(ar);
	}
#ifdef SHARED_HANDLERS

	if (m_viewList.IsEmpty() && ar.IsLoading())
	{
		CFile* pFile = ar.GetFile();
		pFile->Seek(0, FILE_BEGIN);
		ULONGLONG nFileSizeBytes = pFile->GetLength();
		ULONGLONG nFileSizeChars = nFileSizeBytes/sizeof(TCHAR);
		LPTSTR lpszText = (LPTSTR)malloc(((size_t)nFileSizeChars + 1) * sizeof(TCHAR));
		if (lpszText != NULL)
		{
			ar.Read(lpszText, (UINT)nFileSizeBytes);
			lpszText[nFileSizeChars] = '\0';
			m_strThumbnailContent = lpszText;
			m_strSearchContent = lpszText;
		}
	}
#endif
}
Exemple #11
0
void CEditView::SerializeRaw( CArchive &ar )
/******************************************/
{
    if( ar.IsStoring() ) {
        int     nLength = ::GetWindowTextLength( m_hWnd );
        LPCTSTR lpszBuffer = LockBuffer();
        if( lpszBuffer != NULL ) {
            ar.Write( lpszBuffer, nLength );
        }
    } else {
        CFile *pFile = ar.GetFile();
        ASSERT( pFile != NULL );

        ULONGLONG   nLength = pFile->GetLength();
        LRESULT     lLimit = ::SendMessage( m_hWnd, EM_GETLIMITTEXT, 0, 0L );
        if( nLength > lLimit ) {
            throw new CArchiveException( CArchiveException::badIndex );
        } else if( nLength == 0LL ) {
            ::SetWindowText( m_hWnd, NULL );
        } else {
            LPTSTR lpszBuffer = new TCHAR[nLength + 1];
            ar.Read( lpszBuffer, (UINT)nLength * sizeof( TCHAR ) );
            lpszBuffer[nLength] = _T('\0');
            ::SetWindowText( m_hWnd, lpszBuffer );
        }
    }
}
void CMarkdownEditorDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		ar.WriteString(Util::ANSIToUTF8(_strText.c_str()).c_str());
		// TODO: 在此添加存储代码
	}
	else
	{
		CString str;
		const int BUF_SIZE = 64*1024;
		unsigned char buf[BUF_SIZE + 1];
		while(true){
			UINT uRead = ar.Read(buf, BUF_SIZE);
			buf[uRead] = '\0';
			str += (const char*)buf;
			if(uRead < BUF_SIZE)
				break;
		}

		_strText = Util::UTF8ToANSI(str);
		this->UpdateAllViews(NULL);
		// TODO: 在此添加加载代码
	}
}
Exemple #13
0
void CChartData::Serialize(CArchive& ar)
{
	DWORD		size = 1;
	int			i;

	if (ar.IsStoring())
	{
		ar << m_NDimensions;
		ar.Write( m_Dimensions, kMaxDims * sizeof( int ) );

		for( i = 0; i < m_NDimensions; i++ )
			size *= m_Dimensions[i];

		ar << size;
		ar.Write( m_Data, size * sizeof( double ) );
	}
	else
	{
		ar << m_NDimensions;
		ar.Write( m_Dimensions, kMaxDims * sizeof( int ) );

		ar >> size;

		m_Data = (double *) VirtualAlloc( NULL, size, 
			MEM_COMMIT, PAGE_READWRITE );

		ar.Read( m_Data, size * sizeof( double ) );
	}
}
Exemple #14
0
void CTestCBotDoc::Serialize(CArchive& ar)
{
    if (ar.IsStoring())
    {
        m_pEdit->GetWindowText(m_DocText);
        int     w = m_DocText.GetLength();
        ar.Write((LPCTSTR)m_DocText, w);
    }
    else
    {
        int     r;
        char    buf[10001];

        r = ar.Read(buf, 10000);
        buf[r] = 0;
        m_DocText = buf;

        if ( m_pProg == NULL ) m_pProg = new CBotProgram();

        if (!m_pProg->Compile(m_DocText, m_Liste, NULL))
        {
            delete m_pProg;
            m_pProg = NULL;
        }
    }
}
void CWinProfDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		ar << m_ExeFileName << m_Frequency;
		symbol_manager.Serialize(ar);
		filter_manager.Serialize(ar);
		ar << m_ActiveFilter;
		ar << (unsigned int)call_info.size();
		for (list<CALL_INFO>::const_iterator iter = call_info.begin(); iter != call_info.end(); ++iter)
			ar.Write(&*iter, sizeof(CALL_INFO));
	}
	else
	{
		ar >> m_ExeFileName >> m_Frequency;
		symbol_manager.Serialize(ar);
		filter_manager.Serialize(ar);
		ar >> m_ActiveFilter;
		unsigned int size;
		CALL_INFO ci;
		ar >> size;
		call_info.clear();
		while (size--)
		{
			ar.Read(&ci, sizeof(CALL_INFO));
			call_info.push_back(ci);
		}
	}
}
Exemple #16
0
void		AsfParser::Serialize(CArchive& ar)
{
	if ( ar.IsStoring() )
	{
		ar << numOfIndex;

		//ar << streamCount;
		ar << audioNumber;
		ar << videoNumber;

		ar << Bitrate;
		ar << PacketSize;

		ar << duration;

		

		ar << Title;
		ar << Copyright;
		ar << Author;

		ar << sdp;

		ar.Write(index,(numOfIndex + 1)*sizeof(INDEX));

	}
	else
	{
		ar >> numOfIndex;

		//ar >> streamCount;
		ar >> audioNumber;
		ar >> videoNumber;

		ar >> Bitrate;
		ar >> PacketSize;

		ar >> duration;

		

		ar >> Title;
		ar >> Copyright;
		ar >> Author;

		ar >> sdp;

		
		index = new INDEX[numOfIndex + 1];

		ar.Read(index,(numOfIndex + 1)*sizeof(INDEX));

		pTimeSlotLenTable	= new DWORD[numOfIndex];

		for(DWORD i = 0; i < numOfIndex; i++)
			pTimeSlotLenTable[i] = (index[i+1]-index[i])*(PacketSize + sizeof(DATAPACKET_HEADER) + RtpPacket::RTP_HEAD_LEN + 4 );

	}
}
Exemple #17
0
void CdSqlQuery::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		CfSqlQueryFrame* pFrame = GetFrameWindow();
		if (!pFrame)
			return;
		ar << m_strNode;
		ar << m_strServer;
		ar << m_strUser;
		ar << m_strDatabase;
		ar << m_nDbFlag;

		ar << m_SeqNum;
		ar << m_nNodeHandle;
		ar << GetTitle();
		ar << m_IngresVersion;

		BOOL bToolBarVisible = FALSE;
		CToolBar* pTbar = GetToolBar();
		if (pTbar && IsWindowVisible(pTbar->m_hWnd))
			bToolBarVisible = TRUE;
		ar << bToolBarVisible;
		//
		// Full state of all toolbars in the frame
		pFrame->GetDockState(m_toolbarState);
		m_toolbarState.Serialize(ar);
		//
		// Frame window placement
		memset(&m_wplj, 0, sizeof(m_wplj));
		BOOL bResult = pFrame->GetWindowPlacement(&m_wplj);
		ASSERT (bResult);
		ar.Write(&m_wplj, sizeof(m_wplj));
	}
	else
	{
		CString strTitle;
		m_bLoaded = TRUE;
		ar >> m_strNode;
		ar >> m_strServer;
		ar >> m_strUser;
		ar >> m_strDatabase;
		ar >> m_nDbFlag;

		ar >> m_SeqNum;
		ar >> m_nNodeHandle;
		ar >> strTitle; SetTitle(strTitle);
		ar >> m_IngresVersion;

		ar >> m_bToolbarVisible;
		//
		// Full state of all toolbars in the frame
		m_toolbarState.Serialize(ar);
		//
		// Frame window placement
		ar.Read(&m_wplj, sizeof(m_wplj));
	}
	SerializeSqlControl(ar);
}
void CLibraryHistory::Serialize(CArchive& ar, int nVersion)
{
	if ( nVersion < 7 ) return;

	int nCount = 0;
	POSITION pos;

	if ( ar.IsStoring() )
	{
		for ( pos = GetIterator() ; pos ; )
		{
			if ( GetNext( pos )->m_pFile != NULL ) nCount ++;
		}

		ar.WriteCount( nCount );

		for ( pos = GetIterator() ; pos ; )
		{
			CLibraryRecent* pRecent = GetNext( pos );
			if ( pRecent->m_pFile != NULL ) pRecent->Serialize( ar, nVersion );
		}

		ar << LastSeededTorrent.m_sPath;
		if ( LastSeededTorrent.m_sPath.GetLength() )
		{
			ar << LastSeededTorrent.m_sName;
			ar << LastSeededTorrent.m_tLastSeeded;
			ar.Write( &LastSeededTorrent.m_pBTH, sizeof(SHA1) );
		}
	}
	else
	{
		Clear();

		for ( nCount = ar.ReadCount() ; nCount > 0 ; nCount-- )
		{
			CLibraryRecent* pRecent = new CLibraryRecent();
			pRecent->Serialize( ar, nVersion );

			if ( pRecent->m_pFile != NULL )
			{
				m_pList.AddTail( pRecent );
			}
			else
			{
				delete pRecent;
			}
		}

		if ( nVersion > 22 )
		{
			ar >> LastSeededTorrent.m_sPath;
			if ( LastSeededTorrent.m_sPath.GetLength() )
			{
				ar >> LastSeededTorrent.m_sName;
				ar >> LastSeededTorrent.m_tLastSeeded;
				ar.Read( &LastSeededTorrent.m_pBTH, sizeof(SHA1) );
			}
		}
Exemple #19
0
/////////////////////////////////////////////////////////////////////////////
// serialization
void CGXGridCellData::SerializeEx(CArchive& ar, CString& strProperty )
{
	ASSERT_VALID(this);
	DWORD dwDataLen;
	if (ar.IsStoring())		// Write
	{
		CMemFile  memFile;
		CArchive  arMem(&memFile, CArchive::store );
		Serialize ( arMem );
		arMem.Flush();

		dwDataLen = memFile.GetLength();
		if ( dwDataLen > 0 )
		{
			BYTE *pTemp = new BYTE [dwDataLen+1];
			memFile.Seek(0, CFile::begin);
			memFile.Read(pTemp, dwDataLen );
		
			ar.Write(&dwDataLen, sizeof(DWORD));
			ar.Write(pTemp, dwDataLen);

			// Property Save CString
			strProperty = BinaryToStringEx ( pTemp, dwDataLen );

			if ( pTemp )
				delete []pTemp;
		}
	}
	else					// Read
	{
		ar >> dwDataLen;
		if ( dwDataLen > 0 )
		{
			BYTE *pTemp = new BYTE[dwDataLen+1];
			ar.Read(pTemp, dwDataLen );
			
			CMemFile memFile;
			memFile.Attach ( (BYTE*)pTemp, dwDataLen );

			CArchive arMem(&memFile, CArchive::load );
			Serialize ( arMem );

			// Property Save CString
			DWORD dwTotLen = 	dwDataLen + sizeof(DWORD);
			BYTE *pvData = new BYTE[dwTotLen];
			*(DWORD*)pvData = dwTotLen;
			memcpy ( pvData + sizeof(DWORD), pTemp, dwDataLen );
			
			if ( pTemp )
				delete[] pTemp;

			strProperty = BinaryToStringEx ( pvData, dwTotLen );
			if ( pvData )
				delete[] pvData;
		}
	}
}
Exemple #20
0
void CTextureConfig::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		
	}
	else
	{
		m_vecTextures.clear();
		int textureCount = 0;
		ar.Read(&textureCount, sizeof(int));
		for (int i = 0; i < textureCount; i++)
		{
			TextureProtocol tp;
			ar.Read(&tp, sizeof(tp));
			m_vecTextures.push_back(tp);
		}
	}
}
Exemple #21
0
void CDiasAPIChannels::Serialize (CArchive& ar) {
	CaImAPICollection<CChannel>::Serialize (ar);
	uvar32_64 n, size;
	if (ar.IsLoading ()) {
		ar.Read (&size, sizeof (uvar32_64));
		Add (size);
		for (n = 0; n < size; ++n)
			(*this)[n].Serialize (ar);
	}
}
void CLinkLineGzTj::Serialize_Ty(CArchive &ar)
{
	if(ar.IsStoring())
	{
		ar.Write((unsigned char *)m_lineName,sizeof(char)*33);
	}
	else
	{
		ar.Read((unsigned char *)m_lineName,sizeof(char)*33);
	}
}
Exemple #23
0
void CuIpmPropertyDataPageLocationUsage::Serialize (CArchive& ar)
{
	if (ar.IsStoring())
	{
		ar.Write (&m_dlgData, sizeof (m_dlgData)); 
	}
	else
	{
		ar.Read (&m_dlgData, sizeof (m_dlgData)); 
	}
}
Exemple #24
0
void CBitmapInfo::Serialize(CArchive& ar)
{
	if (ar.IsStoring()) {
		ar.Write(&m_Bmp, sizeof(m_Bmp));
		m_Bits.Serialize(ar);
	} else {
		ar.Read(&m_Bmp, sizeof(m_Bmp));
		m_Bits.Serialize(ar);
		m_Bmp.bmBits = m_Bits.GetData();
	}
}
void CDiasAPIDensScales::Serialize (CArchive& ar) {
	CaImAPICollection<CDensScale>::Serialize (ar);
	uvar32_64 n, size;
	if (ar.IsLoading ()) {
		ar.Read (&size, sizeof (uvar32_64));
		for (n = 0; n < size; ++n) {
			CDensScale* scale = new CDensScale;
			scale->Serialize (ar);
			Add (*scale);
		}
		ar >> m_nActive;
	} else
Exemple #26
0
void CTeslaAPIVariables::Serialize (CArchive& ar) {
	CaImAPICollection<CVariable>::Serialize (ar);
	uvar32_64 n, size;
	if (ar.IsLoading ()) {
		ar.Read (&size, sizeof (uvar32_64));
		CVariable *var = new CVariable (m_pTesla, "", "");
		for (n = 0; n < size; ++n) {
			var->Serialize (ar);
			Add (*var);
		}
		delete var;
	}
}
void CLinkWebShot::Serialize_Ty(CArchive &ar)
{
	if(ar.IsStoring())  
	{
		ar<<m_webIP<<m_ServerIP<<m_ServerPort<<m_GroupIP<<m_GroupPort<<m_unitID;
		ar.Write((unsigned char *)m_unitID,sizeof(char)*33);
	}
	else
	{
		ar>>m_webIP>>m_ServerIP>>m_ServerPort>>m_GroupIP>>m_GroupPort>>m_unitID;
		ar.Read((unsigned char *)m_unitID,sizeof(char)*33);
	}
}
Exemple #28
0
void CEditView::ReadFromArchive(CArchive& ar, UINT nLen)
	// Read certain amount of text from the file, assume at least nLen
	// characters (not bytes) are in the file.
{
	ASSERT_VALID(this);

	LPVOID hText = LocalAlloc(LMEM_MOVEABLE, (nLen+1)*sizeof(TCHAR));
	if (hText == NULL)
		AfxThrowMemoryException();

	LPTSTR lpszText = (LPTSTR)LocalLock(hText);
	ASSERT(lpszText != NULL);
	if (ar.Read(lpszText, nLen*sizeof(TCHAR)) != nLen*sizeof(TCHAR))
	{
		LocalUnlock(hText);
		LocalFree(hText);
		AfxThrowArchiveException(CArchiveException::endOfFile);
	}
	// Replace the editing edit buffer with the newly loaded data
	lpszText[nLen] = '\0';
#ifndef _UNICODE
	if (afxData.bWin32s)
	{
		// set the text with SetWindowText, then free
		BOOL bResult = ::SetWindowText(m_hWnd, lpszText);
		LocalUnlock(hText);
		LocalFree(hText);

		// make sure that SetWindowText was successful
		if (!bResult || ::GetWindowTextLength(m_hWnd) < (int)nLen)
			AfxThrowMemoryException();

		// remove old shadow buffer
		delete[] m_pShadowBuffer;
		m_pShadowBuffer = NULL;
		m_nShadowSize = 0;

		ASSERT_VALID(this);
		return;
	}
#endif
	LocalUnlock(hText);
	HLOCAL hOldText = GetEditCtrl().GetHandle();
	ASSERT(hOldText != NULL);
	LocalFree(hOldText);
	GetEditCtrl().SetHandle((HLOCAL)(UINT)(DWORD)hText);
	Invalidate();
	ASSERT_VALID(this);
}
Exemple #29
0
void CaReadFlag::Serialize (CArchive& ar)
{
	TCHAR tchszMsg[] = _T("CaReadFlag::Serialize: Failed to serialize the read/unread event flags");
	try
	{
		int i;
		if (ar.IsStoring())
		{
			ar << m_nCurrentSize;
			ar << m_nBaseGrow;
			ar << m_nBase;
			ar << m_nSndArraySize;
			ar << m_nCount;
			for (i=0; i<=m_nBase; i++)
			{
				ar.Write (m_nArray[i], m_nSndArraySize*sizeof(short));
			}
		}
		else
		{
			for (i=0; i<=m_nBase; i++)
			{
				short* pSndArray = (short*)m_nArray[i];
				if (pSndArray)
					delete []pSndArray;
			}
			delete []m_nArray;

			ar >> m_nCurrentSize;
			ar >> m_nBaseGrow;
			ar >> m_nBase;
			ar >> m_nSndArraySize;
			ar >> m_nCount;
			m_nArray = new shortptr[m_nCurrentSize*sizeof (short*)];

			for (i=0; i<=m_nBase; i++)
			{
				short* pArray = new short [m_nSndArraySize];
				m_nArray[i] = pArray;
				ar.Read (m_nArray[i], m_nSndArraySize*sizeof(short));
			}
		}
	}
	catch (...)
	{
		MessageBeep (MB_ICONEXCLAMATION);
		AfxMessageBox (tchszMsg);
	}
}
Exemple #30
0
	void CBeginGame::Serialize(CArchive &ar)
	{
		if (ar.IsStoring())
		{
			ar << m_nSize;
			ar.Write(m_pData, m_nSize);
		}
		else
		{
			ar >> m_nSize;
			if (m_pData) delete[] m_pData;
			m_pData = new BYTE[m_nSize];
			ar.Read(m_pData, m_nSize);
		}
	}