void CHostBrowser::Serialize(CArchive& ar, int nVersion) // BROWSER_SER_VERSION { BOOL bProfilePresent = FALSE; if ( ar.IsStoring() ) { ar << m_bNewBrowse; ar << m_pAddress.S_un.S_addr; ar << m_nPort; ar << m_bMustPush; ar << m_bCanPush; SerializeOut( ar, m_oPushID ); SerializeOut( ar, m_oClientID ); ar << m_sNick; ar << m_bCanChat; ar << m_sServer; ar << m_nProtocol; ar << m_nHits; ar << (DWORD)m_nLength; ar << m_nReceived; bProfilePresent = ( m_pProfile != NULL ); ar << bProfilePresent; } else // Loading { Stop(); ar >> m_bNewBrowse; ar >> m_pAddress.S_un.S_addr; ar >> m_nPort; ar >> m_bMustPush; ar >> m_bCanPush; SerializeIn( ar, m_oPushID, 31 ); SerializeIn( ar, m_oClientID, 31 ); ar >> m_sNick; ar >> m_bCanChat; ar >> m_sServer; ar >> m_nProtocol; ar >> m_nHits; DWORD nLength = 0; ar >> nLength; m_nLength = nLength; // To QWORD ar >> m_nReceived; ar >> bProfilePresent; m_pVendor = VendorCache.LookupByName( m_sServer ); delete m_pProfile; m_pProfile = new CGProfile(); } if ( bProfilePresent ) { if ( m_pProfile == NULL ) m_pProfile = new CGProfile(); if ( m_pProfile ) m_pProfile->Serialize( ar, nVersion ); } }
void COptionTreeWrapper::Serialize(CHashString objName, vector<CHashString> objTypes, IArchive &ar, bool bRead) { if (m_mTrees[objName.GetUniqueID()].m_Tree == NULL) { m_mTrees[objName.GetUniqueID()].m_Tree = new COptionTree(); m_mTrees[objName.GetUniqueID()].m_Tree->Create(m_Style, m_Rect, m_pParentWnd, m_TreeOptions, m_ID); m_mTrees[objName.GetUniqueID()].m_Root = m_mTrees[objName.GetUniqueID()].m_Tree->InsertItem(new COptionTreeItem()); CString label; label = objName.GetString(); label += _T("("); label += objTypes[0].GetString(); label += _T(")"); m_mTrees[objName.GetUniqueID()].m_Root->SetLabelText(label); for (UINT i=0; i<objTypes.size(); i++) { CreateTree(objTypes[i].GetString(), objName); } m_vRootNames.push_back(objName); } if (bRead) { SerializeIn(ar, objName); } else { SerializeOut(ar, objName); } ExpandOneRoot(objName); }
inline void SerializeOut(QDataStream& s, const Ranges::List< Ranges::Range<quint64>, ListTraits >& rhs) { quint64 nTotal = rhs.limit(); quint64 nRemaining = rhs.length_sum(); quint64 nFragments = rhs.size(); s << nTotal << nRemaining << nFragments; for( Ranges::List< Ranges::Range<quint64>, ListTraits >::const_iterator i = rhs.begin(); i != rhs.end(); ++i ) { SerializeOut(s, *i); } }
//--------------------------------------------------------------------------------------------------- void SerializeOut(node_type& writer, const cSubTexture& value) { // split to chunks std::string lib, tex, subtex; cTexture::SplitName(value.first->Name(), lib, tex, subtex); // get tex/subtexlib auto it = mainapp()->Resources<cTextureLib>(lib)->FindByName(value.first->Name()); // get rect name const auto& rects = it->second->Rects(); auto itr = std::find_if(rects.begin(), rects.end(), [&](const std::map<std::string, cBox2i>::value_type& v) {return v.second == value.second; }); subtex = itr->first; // write out std::string outname = value.first->Name() + ":" + subtex; SerializeOut(writer, outname); }
void CDownloadSource::Serialize(CArchive& ar, int nVersion /* DOWNLOAD_SER_VERSION */) { if ( ar.IsStoring() ) { ar << m_sURL; ar << m_nProtocol; SerializeOut( ar, m_oGUID ); ar << m_nPort; if ( m_nPort ) ar.Write( &m_pAddress, sizeof(m_pAddress) ); ar << m_nServerPort; if ( m_nServerPort ) ar.Write( &m_pServerAddress, sizeof(m_pServerAddress) ); ar << m_sName; ar << m_nIndex; ar << m_bHashAuth; ar << m_bSHA1; ar << m_bTiger; ar << m_bED2K; ar << m_bBTH; ar << m_bMD5; ar << m_sServer; ar << m_sNick; ar << m_sCountry; ar << m_sCountryName; ar << m_nSpeed; ar << m_bPushOnly; ar << m_bCloseConn; ar << m_bReadContent; ar.Write( &m_tLastSeen, sizeof(FILETIME) ); SerializeOut2( ar, m_oPastFragments ); ar << m_bClientExtended; ar << m_bMetaIgnore; } else if ( nVersion >= 21 ) { ar >> m_sURL; ar >> m_nProtocol; SerializeIn( ar, m_oGUID, nVersion); ar >> m_nPort; if ( m_nPort ) ReadArchive( ar, &m_pAddress, sizeof(m_pAddress) ); ar >> m_nServerPort; if ( m_nServerPort ) ReadArchive( ar, &m_pServerAddress, sizeof(m_pServerAddress) ); ar >> m_sName; ar >> m_nIndex; ar >> m_bHashAuth; ar >> m_bSHA1; ar >> m_bTiger; ar >> m_bED2K; if ( nVersion >= 37 ) { ar >> m_bBTH; ar >> m_bMD5; }