예제 #1
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();
	}
}
예제 #2
0
파일: drawobj.cpp 프로젝트: mingpen/OpenNT
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));
	}
}
예제 #3
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 ) );
	}
}
예제 #4
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 ) );
	}
}
예제 #5
0
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;
		}
	}
}
예제 #6
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;
		}
	}
}
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 );
			}
		}
	}
예제 #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));
	}
}
예제 #9
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;
        }
    }
}
예제 #10
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;
		}
	}
}
예제 #11
0
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);
		}
	}
}
예제 #12
0
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(...)
	{

	}
}
예제 #13
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 );
        }
    }
}
예제 #14
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 );

	}
}
예제 #15
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);
}
예제 #16
0
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) );
			}
		}
예제 #17
0
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);
	}
}
예제 #18
0
CArchive& AFXAPI operator<<(CArchive& ar, const CString& string)
{
	USES_CONVERSION;

	// All CStrings are serialized as wide strings
	PCWSTR pWide = T2CW(string.data());
	int nChars = wcslen(pWide);
	ar << nChars;
	ar.Write(pWide, nChars*sizeof(wchar_t));
	return ar;
}
예제 #19
0
void CuIpmPropertyDataPageLocationUsage::Serialize (CArchive& ar)
{
	if (ar.IsStoring())
	{
		ar.Write (&m_dlgData, sizeof (m_dlgData)); 
	}
	else
	{
		ar.Read (&m_dlgData, sizeof (m_dlgData)); 
	}
}
예제 #20
0
파일: project.cpp 프로젝트: AmziLS/apls
void CProjectDoc::Serialize(CArchive& ar)
{
   CProjectView* pview = GetProjectView();
   int i, l;

   if (ar.IsStoring())
   {  // Output
#ifdef _UNICODE
      _TCHAR uniflag = 0xfeff;  // written as fffe, which is right for PC unicode
      ar.Write(&uniflag, 2);
#endif
      pview->UpdateData(TRUE);
      ar.WriteString(_T("amzirel=4"));  // so we can check for valid ppj files
      ar.WriteString(CRLF);
      ar.WriteString(_T("xplfile="));
      ar.WriteString(pview->m_xplfile);
      ar.WriteString(CRLF);
      ar.WriteString(_T("directory="));
      ar.WriteString(pview->m_directory);
      ar.WriteString(CRLF);
      ar.WriteString(_T("opdefs="));
      ar.WriteString(pview->m_opdefs);
      ar.WriteString(CRLF);

      CListBox* pLB;
      CString s;

      pLB = (CListBox*)(pview->GetDlgItem(IDP_FILELIST));
      l = pLB->GetCount();
      for (i=0; i<l; i++)
      {
         pLB->GetText(i, s);
         ar.WriteString(_T("file="));
         ar.WriteString(s);
         ar.WriteString(CRLF);
      }

      pLB = (CListBox*)(pview->GetDlgItem(IDP_LIBLIST));
      l = pLB->GetCount();
      for (i=0; i<l; i++)
      {
         pLB->GetText(i, s);
         ar.WriteString(_T("library="));
         ar.WriteString(s);
         ar.WriteString(CRLF);
      }

      SaveOpenFiles(ar);
   }
   else
   {  // Input
      ReadArchive(ar);
   }
}
예제 #21
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();
	}
}
예제 #22
0
void CDrawWarn::Serialize(CArchive& ar)
{
	ASSERT_VALID(this);

	CDrawObj::Serialize(ar);
	if (ar.IsStoring())
	{
		ar.Write(&m_ctlBackColor,sizeof(COLORREF));
		ar.Write(&m_ctlLineColor,sizeof(COLORREF));
		ar.Write(&m_ctlTextColor,sizeof(COLORREF));
		ar.Write(&m_ctlTitleColor,sizeof(COLORREF));
		ar << m_nColCount;
		ar << m_nRowCount;
		ar << m_nCellWidth;
		ar << m_nCellHeight;
		ar << (WORD)m_bIsAutoSize;
		for(int i=0;i<m_nRowCount;i++)
			ar << m_nPercent[i];

	}
	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;
	}
}
예제 #23
0
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);
	}
}
예제 #24
0
void ViewPointIO::save(ViewPoint &vp, CArchive &ar)
{
    if (ar.IsStoring())
    {
        std::string s;
        s = format("translation %0.2f %0.2f %0.2f\n",
                   vp.center()[0], vp.center()[0], vp.center()[2]);
        ar.Write(s.c_str(), s.size());
        Matrix4<float> viewmat(vp.orientation());
        s = format("rotation %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f\n",
                   viewmat.m00, viewmat.m01, viewmat.m02,
                   viewmat.m10, viewmat.m11, viewmat.m12,
                   viewmat.m20, viewmat.m21, viewmat.m22);
        ar.Write(s.c_str(), s.size());
        s = format("zoom %0.3f\nperspective %0.3f\n", vp.scale(), vp.perspective());
        ar.Write(s.c_str(), s.size());
        s = format("frontclip %0.2f\nbackclip %0.2f\n", vp.frontClip(), vp.backClip());
        ar.Write(s.c_str(), s.size());
        s = format("transform\n");
        ar.Write(s.c_str(), s.size());
    }
}
예제 #25
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);
	}
}
예제 #26
0
파일: BeginGame.cpp 프로젝트: IcyX/bote
	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);
		}
	}
예제 #27
0
void  CReportEntityLine::Serialize(CArchive& ar)
{
	typedef struct
	{
		int a_f;
		int b_f;
	} LINE_RESERVE_FIELDS;

	LINE_RESERVE_FIELDS line_reserve;
	memset(&line_reserve,0,sizeof(LINE_RESERVE_FIELDS));

	CDiagramEntity::Serialize(ar);
	if (ar.IsStoring())
	{
		// —охран¤ем
		double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() );
		ar.Write(&thickness,sizeof(double));
		unsigned int brC = GetBorderColor( );
		ar.Write(&brC,sizeof(unsigned int));

		ar.Write(&line_reserve,sizeof(LINE_RESERVE_FIELDS));
	}
	else
	{
		// „итаем
		double		linethickness;
		ar.Read(&linethickness,sizeof(double));	
		unsigned int	linecolor;
		ar.Read(&linecolor,sizeof(unsigned int));	

		ar.Read(&line_reserve,sizeof(LINE_RESERVE_FIELDS));
		unsigned int lt = CUnitConversion::InchesToPixels( linethickness );
		SetBorderThickness( lt );
		SetBorderColor( linecolor );
	}
}
예제 #28
0
void CRecordInfo::Serialize(CArchive& ar)
{
	if (ar.IsStoring()) {
		ar << ARCHIVE_VERSION;
		ar << sizeof(RECORD_INFO);
		ar.Write(&GetBaseInfo(), sizeof(RECORD_INFO));
	} else {
		int	Version;
		ar >> Version;
		if (Version > ARCHIVE_VERSION)
			AfxThrowArchiveException(CArchiveException::badIndex, ar.m_strFileName);
		int	BaseInfoSize;
		ar >> BaseInfoSize;
		ar.Read(&GetBaseInfo(), BaseInfoSize);
	}
}
예제 #29
0
void  CReportEntityBox::Serialize(CArchive& ar)
{
	
	typedef struct
	{
		int a_f;
		int b_f;
	} BOX_RESERVE_FIELDS;

	BOX_RESERVE_FIELDS box_reserve;
	memset(&box_reserve,0,sizeof(BOX_RESERVE_FIELDS));

	CDiagramEntity::Serialize(ar);
	if (ar.IsStoring())
	{
		// —охран¤ем
		double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() );
		ar.Write(&thickness,sizeof(double));
		unsigned int bst = GetBorderStyle( );
		ar.Write(&bst,sizeof(unsigned int));
		unsigned int brC = GetBorderColor( );
		ar.Write(&brC,sizeof(unsigned int));
		BOOL gf = GetFill();
		ar.Write(&gf, sizeof(BOOL));
		brC = GetFillColor();
		ar.Write(&brC,sizeof(unsigned int));
		ar.Write(&box_reserve,sizeof(BOX_RESERVE_FIELDS));
	}
	else
	{
		// „итаем
		double		bordhickness;
		ar.Read(&bordhickness,sizeof(double));
		unsigned int		bordst;
		ar.Read(&bordst,sizeof(unsigned int));
		unsigned int	linecolor;
		ar.Read(&linecolor,sizeof(unsigned int));
		BOOL fil;
		ar.Read(&fil,sizeof(BOOL));
		unsigned int	filcolor;
		ar.Read(&filcolor,sizeof(unsigned int));

		ar.Read(&box_reserve,sizeof(BOX_RESERVE_FIELDS));

		int bt = CUnitConversion::InchesToPixels( bordhickness );
		
		SetBorderThickness( bt );
		SetBorderStyle( bordst );
		SetBorderColor( linecolor );
		SetFill( fil );
		SetFillColor( filcolor );

	}
}
예제 #30
0
void CAlbumFolder::Serialize(CArchive& ar, int nVersion)
{
	POSITION pos;

	if ( ar.IsStoring() )
	{
		ar << m_sSchemaURI;

		ar.WriteCount( m_pXML != NULL ? 1 : 0 );
		if ( m_pXML ) m_pXML->Serialize( ar );

		ar << m_bCollSHA1;
		if ( m_bCollSHA1 ) ar.Write( &m_pCollSHA1, sizeof(SHA1) );

		ar << m_sName;
		ar << m_bExpanded;
		ar << m_bAutoDelete;
		ar << m_sBestView;

		ar.WriteCount( GetFolderCount() );

		for ( pos = GetFolderIterator() ; pos ; )
		{
			CAlbumFolder* pFolder = GetNextFolder( pos );
			pFolder->Serialize( ar, nVersion );
		}

		ar.WriteCount( GetFileCount() );

		for ( pos = GetFileIterator() ; pos ; )
		{
			CLibraryFile* pFile = GetNextFile( pos );
			ar << pFile->m_nIndex;
		}
	}
	else
	{
		CLibraryFile* pCollection = NULL;

		if ( m_pParent != NULL )
		{
			ar >> m_sSchemaURI;
			m_pSchema = SchemaCache.Get( m_sSchemaURI );
		}
		else
		{