bool Spy_SendMessageCommand(SOCKET sock, const TCHAR* pszMsg, const TCHAR* pszCapital) { bool bRet = false; CSpyCommandMessageBox cmd; cmd.SetMessage(pszMsg); cmd.SetCaption(pszCapital); SharePtr<SSocketContext> socketContent = CSpyManager::GetInstance()->GetSocket(sock); BEATS_ASSERT(socketContent.Get() != NULL, _T("Invalid socket!")); if (socketContent.Get() != NULL) { bRet = CSpyCommandManager::GetInstance()->SendCommand(socketContent, &cmd); } return bRet; }
bool Spy_SendFileInfoCommand(SOCKET sock, const TCHAR* pszCmd, TFileInfoFeedbackFunc pFeedbackFunc, void* pUserData) { bool bRet = false; CSpyCommandGetFileInfo cmd; cmd.SetFeedBackFuncAddr((uint32_t)pFeedbackFunc, (uint32_t)pUserData); cmd.SetFileName(pszCmd); SharePtr<SSocketContext> socketContent = CSpyManager::GetInstance()->GetSocket(sock); BEATS_ASSERT(socketContent.Get() != NULL, _T("Invalid socket!")); if (socketContent.Get() != NULL) { bRet = CSpyCommandManager::GetInstance()->SendCommand(socketContent, &cmd); } return bRet; }
bool Spy_UploadFiles(SOCKET sock, const std::vector<TString>& files, const TString& strStorePath, CFileFilter* pFilter) { bool bRet = false; CSpyCommandUploadFile cmd; cmd.SetUploadFile(files); cmd.SetStorePath(strStorePath.c_str()); cmd.SetFileFilter(pFilter); SharePtr<SSocketContext> socketContent = CSpyManager::GetInstance()->GetSocket(sock); BEATS_ASSERT(socketContent.Get() != NULL, _T("Invalid socket!")); if (socketContent.Get() != NULL) { bRet = CSpyCommandManager::GetInstance()->SendCommand(socketContent, &cmd); } return bRet; }
CTextureFrag *CTextureAtlas::CreateTextureFrag(const TString &name, kmVec2 point, kmVec2 size) { BEATS_ASSERT(m_textureFrags.find(name) == m_textureFrags.end()); SharePtr<CResource> pSelf; CResourceManager::GetInstance()->QueryResource(GetFilePath(), pSelf); BEATS_ASSERT(pSelf.Get() == this); CTextureFrag *frag = new CTextureFrag(name, pSelf, point, size); m_textureFrags[name] = frag; return frag; }
const SBeatsSocket* Spy_Connect(uint32_t uIPAddress) { const SBeatsSocket* pRet = NULL; SOCKET socket = Beats_CreateSocket(SOCK_STREAM, 0); BEATS_ASSERT(socket != INVALID_SOCKET, _T("Create socket failed!")); if (socket != INVALID_SOCKET) { sockaddr_in address_in; memset(&address_in, 0, sizeof(address_in)); address_in.sin_family = AF_INET; address_in.sin_port = htons(SPY_DEFAULT_PORT); address_in.sin_addr.S_un.S_addr = uIPAddress; SharePtr<SSocketContext> pContext = CSpyManager::GetInstance()->ConnectToSpy(socket, &address_in, true); if (pContext.Get() != NULL) { pRet = Beats_GetSockInfo(pContext->m_socket); } } return pRet; }