bool CArchonProcess::TransformAddress (const CString &sAddress, const CString &sMsg, CDatum dPayload, CString *retsDestMsgAddress, CString *retsDestMsg, CDatum *retdPayload, CString *retsError) // TransformAddress // // Transforms a Transpace Address. { CString sNamespace; if (!CTranspaceInterface::ParseAddress(sAddress, &sNamespace)) { *retsError = strPattern(ERR_BAD_TRANSPACE_ADDRESS, sAddress); return false; } // Is this a message namespace? char *pPos = sNamespace.GetParsePointer(); if (*pPos == '@') { // Send the message directly to the port specified by the namespace *retsDestMsgAddress = CString(pPos + 1); *retsDestMsg = sMsg; *retdPayload = dPayload; } // Is this a service namespace? else if (*pPos == '#') { // Parse the service endpoint CString sService(pPos + 1); // Encode into the proper payload CComplexArray *pPayload = new CComplexArray; pPayload->Append(sService); pPayload->Append(sMsg); pPayload->Append(dPayload); // Done *retsDestMsgAddress = ADDRESS_HYPERION_COMMAND; *retsDestMsg = MSG_HYPERION_SERVICE_MSG; *retdPayload = CDatum(pPayload); } // If this is a slash, then convert to Aeon else if (*pPos == '/') { *retsDestMsgAddress = ADDRESS_AEON_COMMAND; *retsDestMsg = sMsg; *retdPayload = dPayload; } // Otherwise, can't parse else { *retsError = strPattern(ERR_BAD_TRANSPACE_ADDRESS, sAddress); return false; } return true; }
BOOL CGameServDlg::OnInitDialog() { // Let the base class do it's thing... CDialog::OnInitDialog(); // Set the window title if necessary... #ifdef _ADDON CString sTitle; sTitle.LoadString(IDS_DIALOGTITLE_AO); SetWindowText(sTitle); #endif // Fill in some of the text info... SetDlgItemText(IDC_SERVER_NAME, g_ServerInfo.m_sName); SetDlgItemText(IDC_SERVER_TIME, "0:00"); CString sService(g_ServerInfo.m_sService); if (g_ServerInfo.m_sAddress[0] != '\0') { sService += " ("; sService += g_ServerInfo.m_sAddress; sService += ")"; } SetDlgItemText(IDC_SERVER_SERVICE, sService); SetDlgItemText(IDC_GAME_PLAYERS, "0"); SetDlgItemText(IDC_GAME_CURLEVEL, g_NetGame.m_sLevels[0]); SetDlgItemText(IDC_GAME_TIME, "0:00"); m_sCurLevel = g_NetGame.m_sLevels[0]; if (g_NetGame.m_byNumLevels > 1) SetDlgItemText(IDC_GAME_NEXTLEVEL, g_NetGame.m_sLevels[1]); else SetDlgItemText(IDC_GAME_NEXTLEVEL, ""); CString sBuf; if (g_NetGame.m_byEnd == NGE_FRAGS) sBuf.Format("%i Frags", g_NetGame.m_dwEndFrags); else if (g_NetGame.m_byEnd == NGE_TIME) sBuf.Format("%i Minutes", g_NetGame.m_dwEndTime); else if (g_NetGame.m_byEnd == NGE_FRAGSANDTIME) sBuf.Format("%i Frags or %i Minutes", g_NetGame.m_dwEndFrags, g_NetGame.m_dwEndTime); else sBuf = "None. Level never ends."; SetDlgItemText(IDC_GAME_GOAL, sBuf); for (int i = 0; i < g_NetGame.m_byNumLevels; i++) { m_lbLevels.AddString(g_NetGame.m_sLevels[i]); } // Set the icon... HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(hIcon, TRUE); SetIcon(hIcon, FALSE); for(i=0; i < 30; i++) { if(SetTimer((UINT)i, 500, NULL)) break; } // All done... return(TRUE); }
bool CAeonInterface::ParseFilePath (const CString &sFilePath, const CString &sRoot, int iOffset, const CDateTime &IfModifiedAfter, CString *retsAddr, CString *retsMsg, CDatum *retdPayload) // ParseFilePath // // Parses a filePath of the form: // // @Aeon.command/Arc.services/TransPackage.ars // /Arc.services/TransPackage.ars // ./TransPackage.ars // // Returns FALSE if error. { char *pPos = sFilePath.GetParsePointer(); char *pPosEnd = pPos + sFilePath.GetLength(); // Create a fileDownloadDesc to specify that we not read more than 100K // at a time (so that we don't overload our IPC buffer). CComplexStruct *pFDDesc = new CComplexStruct; pFDDesc->SetElement(FIELD_PARTIAL_MAX_SIZE, 100000); pFDDesc->SetElement(FIELD_PARTIAL_POS, iOffset); if (IfModifiedAfter.IsValid()) pFDDesc->SetElement(FIELD_IF_MODIFIED_AFTER, IfModifiedAfter); CDatum dFileDownloadDesc(pFDDesc); // If the path starts with @ then this is an absolute path CString sParsedPath; if (*pPos == '@') { // LATER return false; } // Is this a service namespace? else if (*pPos == '#') { CString sNamespace; if (!CTranspaceInterface::ParseAddress(sFilePath, &sNamespace)) return false; // Compose a proper download command payload CComplexArray *pPayload = new CComplexArray; pPayload->Append(sFilePath); pPayload->Append(sFilePath); pPayload->Append(dFileDownloadDesc); CDatum dPayload(pPayload); // Parse the service endpoint CString sService(sNamespace.GetParsePointer() + 1); // Encode into the proper payload CComplexArray *pPayload2 = new CComplexArray; pPayload2->Append(sService); pPayload2->Append(MSG_TRANSPACE_DOWNLOAD); pPayload2->Append(dPayload); // Done *retsAddr = ADDRESS_HYPERION_COMMAND; *retsMsg = MSG_HYPERION_SERVICE_MSG; *retdPayload = CDatum(pPayload2); return true; } // If it starts with a slash then it is an Aeon path else if (*pPos == '/') { sParsedPath = sFilePath; *retsAddr = ADDR_AEON; *retsMsg = MSG_AEON_FILE_DOWNLOAD; // Generate a message for Aeon to load the file CComplexArray *pPayload = new CComplexArray; pPayload->Insert(sParsedPath); pPayload->Insert(dFileDownloadDesc); // Done *retdPayload = CDatum(pPayload); } // If it starts with a ./ then this is a relative path else if (*pPos == '.') { pPos++; if (pPos == pPosEnd || *pPos != '/') return false; // Root must be valid if (sRoot.IsEmpty()) return false; // If the root already ends in '/' then skip. if (*(sRoot.GetParsePointer() + sRoot.GetLength() - 1) == '/') pPos++; sParsedPath = sRoot + CString(pPos); *retsAddr = ADDR_AEON; *retsMsg = MSG_AEON_FILE_DOWNLOAD; // Generate a message for Aeon to load the file CComplexArray *pPayload = new CComplexArray; pPayload->Insert(sParsedPath); pPayload->Insert(dFileDownloadDesc); // Done *retdPayload = CDatum(pPayload); } // Otherwise this is a relative path. else { // Root must be valid if (sRoot.IsEmpty()) return false; // Add '/' separator if (*(sRoot.GetParsePointer() + sRoot.GetLength() - 1) == '/') sParsedPath = sRoot + sFilePath; else sParsedPath = sRoot + SEPARATOR_SLASH, sFilePath; *retsAddr = ADDR_AEON; *retsMsg = MSG_AEON_FILE_DOWNLOAD; // Generate a message for Aeon to load the file CComplexArray *pPayload = new CComplexArray; pPayload->Insert(sParsedPath); pPayload->Insert(dFileDownloadDesc); // Done *retdPayload = CDatum(pPayload); } return true; }