如果我有一段对文件解密的代码,我要怎么样才能解密文件?我要把FXB解密回N3FXBundle.请帮助我- -----------------------------------------------------------------------------------------
- //
- // decode script file..
- // 胶农赋飘 颇老 佬绊 秦籍矫糯...
- //
- #ifdef _N3TOOL
- bool CN3FXBundle::DecodeScriptFile(const char* lpPathName)
- {
- FILE* stream = fopen(lpPathName, "r");
- if(!stream) return false;
- char szGamePathName[_MAX_PATH];
- char szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFName[_MAX_FNAME], szExt[_MAX_EXT];
- _splitpath(lpPathName, szDrive, szDir, szFName, szExt);
- _makepath(szGamePathName, szDrive, szDir, szFName, "fxb");
- CN3BaseFileAccess::FileNameSet(szGamePathName);
- char szLine[512] = "", szCommand[80] = "", szBuf[4][80] = { "", "", "", ""};
- char* pResult = fgets(szLine, 512, stream);
- sscanf(szLine, "%s %s %s %s %s", szCommand, szBuf[0], szBuf[1], szBuf[2], szBuf[3]);
- if(lstrcmpi(szCommand, "<n3fxbundle>"))
- {
- fclose(stream);
- return false;
- }
- while(!feof(stream))
- {
- char* pResult = fgets(szLine, 512, stream);
- if(pResult == NULL) continue;
- ZeroMemory(szCommand,80);
- ZeroMemory(szBuf[0],80);
- ZeroMemory(szBuf[1],80);
- ZeroMemory(szBuf[2],80);
- ZeroMemory(szBuf[3],80);
- sscanf(szLine, "%s %s %s %s %s", szCommand, szBuf[0], szBuf[1], szBuf[2], szBuf[3]);
- if(lstrcmpi(szCommand, "<name>")==0)
- {
- m_strName = szBuf[0];
- continue;
- }
- if(lstrcmpi(szCommand, "<part>")==0)
- {
- char szFullPath[_MAX_PATH]; //full path 父甸扁..
- sprintf(szFullPath,"%s%s",CN3Base::PathGet().c_str(), szBuf[0]);
-
- FXPARTWITHSTARTTIME* pPart = new FXPARTWITHSTARTTIME;
- pPart->fStartTime = atof(szBuf[1]);
- pPart->pPart = SetPart(szFullPath);
- if(!(pPart->pPart)) { delete pPart; continue; }
- for(int i=0;i<MAX_FX_PART;i++)
- {
- if(!m_pPart[i])
- {
- m_pPart[i] = pPart;
- break;
- }
- }
- continue;
- }
- if(lstrcmpi(szCommand, "<velocity>")==0)
- {
- m_fVelocity = atof(szBuf[0]);
- continue;
- }
- if(lstrcmpi(szCommand, "<depend_scale>")==0)
- {
- if(lstrcmpi(szBuf[0], "true")==0) m_bDependScale = true;
- else m_bDependScale = false;
- continue;
- }
- if(lstrcmpi(szCommand, "<Static_Pos>")==0)
- {
- if(lstrcmpi(szBuf[0], "true")==0) m_bStatic = true;
- else m_bStatic = false;
- continue;
- }
- }
- fclose(stream);
- Init();
- return true;
- }
- #endif // end of _N3TOOL
复制代码 |