搜索
 找回密码
 加入

谁懂C 代码的请进来一下

214550663 2008-4-9 12:57:27 1356
如果我有一段对文件解密的代码,我要怎么样才能解密文件?我要把FXB解密回N3FXBundle.请帮助我
  1. -----------------------------------------------------------------------------------------
  2. //
  3. // decode script file..
  4. // 胶农赋飘 颇老 佬绊 秦籍矫糯...
  5. //
  6. #ifdef _N3TOOL
  7. bool CN3FXBundle::DecodeScriptFile(const char* lpPathName)
  8. {
  9. FILE* stream = fopen(lpPathName, "r");
  10. if(!stream) return false;
  11. char szGamePathName[_MAX_PATH];
  12. char szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFName[_MAX_FNAME], szExt[_MAX_EXT];
  13. _splitpath(lpPathName, szDrive, szDir, szFName, szExt);
  14. _makepath(szGamePathName, szDrive, szDir, szFName, "fxb");
  15. CN3BaseFileAccess::FileNameSet(szGamePathName);
  16. char szLine[512] = "", szCommand[80] = "", szBuf[4][80] = { "", "", "", ""};
  17. char* pResult = fgets(szLine, 512, stream);
  18. sscanf(szLine, "%s %s %s %s %s", szCommand, szBuf[0], szBuf[1], szBuf[2], szBuf[3]);
  19. if(lstrcmpi(szCommand, "<n3fxbundle>"))
  20. {
  21.   fclose(stream);
  22.   return false;
  23. }
  24. while(!feof(stream))
  25. {
  26.   char* pResult = fgets(szLine, 512, stream);
  27.   if(pResult == NULL) continue;
  28.   ZeroMemory(szCommand,80);
  29.   ZeroMemory(szBuf[0],80);
  30.   ZeroMemory(szBuf[1],80);
  31.   ZeroMemory(szBuf[2],80);
  32.   ZeroMemory(szBuf[3],80);
  33.   sscanf(szLine, "%s %s %s %s %s", szCommand, szBuf[0], szBuf[1], szBuf[2], szBuf[3]);
  34.   if(lstrcmpi(szCommand, "<name>")==0)
  35.   {
  36.    m_strName = szBuf[0];
  37.    continue;
  38.   }
  39.   if(lstrcmpi(szCommand, "<part>")==0)
  40.   {
  41.    char szFullPath[_MAX_PATH]; //full path 父甸扁..
  42.    sprintf(szFullPath,"%s%s",CN3Base::PathGet().c_str(), szBuf[0]);
  43.    
  44.    FXPARTWITHSTARTTIME* pPart = new FXPARTWITHSTARTTIME;
  45.    pPart->fStartTime = atof(szBuf[1]);
  46.    pPart->pPart = SetPart(szFullPath);
  47.    if(!(pPart->pPart)) { delete pPart; continue; }
  48.    for(int i=0;i<MAX_FX_PART;i++)
  49.    {
  50.     if(!m_pPart[i])
  51.     {
  52.      m_pPart[i] = pPart;
  53.      break;
  54.     }
  55.    }
  56.    continue;   
  57.   }
  58.   if(lstrcmpi(szCommand, "<velocity>")==0)
  59.   {
  60.    m_fVelocity = atof(szBuf[0]);
  61.    continue;
  62.   }
  63.   if(lstrcmpi(szCommand, "<depend_scale>")==0)
  64.   {
  65.    if(lstrcmpi(szBuf[0], "true")==0) m_bDependScale = true;
  66.    else m_bDependScale = false;
  67.    continue;
  68.   }
  69.   if(lstrcmpi(szCommand, "<Static_Pos>")==0)
  70.   {
  71.    if(lstrcmpi(szBuf[0], "true")==0) m_bStatic = true;
  72.    else m_bStatic = false;
  73.    continue;
  74.   }
  75. }
  76. fclose(stream);
  77. Init();
  78. return true;
  79. }
  80. #endif // end of _N3TOOL
复制代码

0 回复

高级模式
游客