static void RenamePaths(char *fromPtn, char *toPtn) { autoList_t *paths = ls("."); char *path; char *nPath; uint dirCount; uint index; eraseParents(paths); dirCount = lastDirCount; foreach(paths, path, index) { if(index < dirCount) { addCwd(path); { RenamePaths(fromPtn, toPtn); } unaddCwd(); } nPath = replaceLine(strx(path), fromPtn, toPtn, 1); if(replaceLine_getLastReplacedCount()) { coExecute_x(xcout("REN \"%s\" \"%s\"", path, nPath)); } memFree(nPath); } releaseDim(paths, 1); }
void MyGUI::update(float timeSinceLastFrame) { //在這裡更新衛星的狀態 CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr(); //衛星的狀態 CEGUI::String str_status; if(SatelliteStatus::current_status == SatelliteStatus::UNLAUNCHED){ str_status = GetUTF(L"未发射"); } else if(SatelliteStatus::current_status == SatelliteStatus::RISING){ str_status = GetUTF(L"上升中"); } else if(SatelliteStatus::current_status == SatelliteStatus::NEAR_TRACK){ str_status = GetUTF(L"近地轨道"); } else if(SatelliteStatus::current_status == SatelliteStatus::ECLLIPSE){ str_status = GetUTF(L"椭圆轨道"); } else if(SatelliteStatus::current_status == SatelliteStatus::FAR_TRACK){ str_status = GetUTF(L"远地轨道"); } else if(SatelliteStatus::current_status == SatelliteStatus::OUT_CONTROL){ str_status = GetUTF(L"失控"); } winMgr->getWindow("text_status")->setText(str_status); //卫星的坐标 char buffer0[1024]; char buffer1[1024]; char buffer2[1024]; sprintf(buffer0,"%f",SatelliteStatus::satellite_x); sprintf(buffer1,"%f",SatelliteStatus::satellite_y); sprintf(buffer2,"%f",SatelliteStatus::satellite_z); CEGUI::String strx(buffer0); CEGUI::String stry(buffer1); CEGUI::String strz(buffer2); winMgr->getWindow("text_x")->setText(strx); winMgr->getWindow("text_y")->setText(stry); winMgr->getWindow("text_z")->setText(strz); //卫星自转角 sprintf(buffer0,"%f",SatelliteStatus::satellite_angle); CEGUI::String str_rotate(buffer0); winMgr->getWindow("text_axisaxis")->setText(strx); //线速度 sprintf(buffer0,"%f km/h",SatelliteStatus::satellite_lv); CEGUI::String str_lv(buffer0); winMgr->getWindow("text_lvlv")->setText(str_lv); //角速度 sprintf(buffer0,"%f /h",SatelliteStatus::satellite_wv); CEGUI::String str_wv(buffer0); winMgr->getWindow("text_wvwv")->setText(str_wv); //线加速度 sprintf(buffer0,"%f /h^2",SatelliteStatus::satellite_a); CEGUI::String str_a(buffer0); winMgr->getWindow("text_aa")->setText(str_a); MyGUISystem::getSingletonPtr()->update(timeSinceLastFrame); }
static void OutputSaveData(void) { char *fileText = strx(SIGNATURE NEW_LINE); autoBlock_t *fileData; fileText = addLine_x(fileText, xcout("%u,%u", StageNo, HiScore)); if(ExtraOpened) fileText = addLine(fileText, NEW_LINE EXTRA_OPENED); fileData = ab_makeBlockLine_x(fileText); DoMask(fileData); writeBinary_xx(GetSaveDataFile(), fileData); }
static char *GetProjFile(void) { autoList_t *files = lsFiles("."); char *file; uint index; eraseParents(files); foreach(files, file, index) if(!_stricmp("vcproj", getExt(file))) break; errorCase(!file); // ? not found file = strx(file); releaseDim(files, 1); return file; }
static void ShowBuildTime(char *trgPath) { trgPath = makeFullPath(trgPath); if(existDir(trgPath)) { autoList_t *paths = lss(trgPath); char *path; uint index; sortJLinesICase(paths); foreach(paths, path, index) { char *relPath = changeRoot(strx(path), trgPath, NULL); if(existDir(path)) { cout("------------------------ %s\n", relPath); } else if( !_stricmp("exe", getExt(path)) || !_stricmp("dll", getExt(path)) || !_stricmp("exe_", getExt(path)) || !_stricmp("dll_", getExt(path)) ) { ShowBuildTime_File(path, relPath); } else { char *hash = md5_makeHexHashFile(path); hash[16] = '\0'; cout(" %s %s\n", hash, relPath); memFree(hash); } memFree(relPath); } releaseDim(paths, 1); }
static void ResolveRelHintPath(char *file) { char *text = readText_b(file); char *p; int modified = 0; text = strrm(text, 128000000); // XXX p = text; while(p = strstrNext(p, "<HintPath>")) { if(startsWith(p, "..\\")) { char *trailer = strx(p); uint c; for(c = 0; c < UTIntoParentStep; c++) { *p++ = '.'; *p++ = '.'; *p++ = '\\'; } strcpy(p, trailer); memFree(trailer); p = strstrNext(p, "</HintPath>"); errorCase(!p); modified = 1; } } if(modified) writeOneLineNoRet_b(file, text); memFree(text); }
foreach(files2, file, index) // 更新後のファイルとハッシュ、確認用 { addElement(trailLines, (uint)strx(file)); addElement(trailLines, (uint)md5_makeHexHashFile(file)); }