// --------------------------------------------------------------------------- // Returns ETrue if the status cannot change anymore // --------------------------------------------------------------------------- TBool CNcdReportInstall::StatusIsFinal() const { DLTRACEIN(("")); return IsOneOf( Status().iStatus, ENcdReportCancel, ENcdReportFail, ENcdReportSuccess ); }
String screengrab(String filename) { if(filename=="" || filename == " () ") { filename.sprintf("%s_%5.5d_.png",(const char*)screengrabprefix,screengrabcount); screengrabcount++; } if(!IsOneOf('.',filename)) filename << ".png"; HRESULT hr; // get display dimensions // this will be the dimensions of the front buffer D3DDISPLAYMODE mode; if (FAILED(hr=g_pd3dDevice->GetDisplayMode(0,&mode))) { return "fail getdisplaymode"; } // create the image surface to store the front buffer image // note that call to GetFrontBuffer will always convert format to A8R8G8B8 static LPDIRECT3DSURFACE9 surf=NULL; if (!surf && FAILED(hr=g_pd3dDevice->CreateOffscreenPlainSurface(mode.Width,mode.Height, D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT,&surf,NULL))) { return "fail createimagesurface"; } // Next, this surface is passed to the GetFrontBuffer() method of the device, which will copy the entire screen into our image buffer: // read the front buffer into the image surface if (FAILED(hr=g_pd3dDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&surf))) { surf->Release(); return "fail getfrontbuffer"; } //Finally, we call D3DXSaveSurfaceToFile() to create the BMP file, and release the temporary image surface: // write the entire surface to the requested file hr=D3DXSaveSurfaceToFile(filename,D3DXIFF_PNG,surf,NULL,NULL); // release the image surface // surf->Release(); // return status of save operation to caller return (hr==D3D_OK)? filename + " exported!" : "something failed"; }
char *CommandCompletion(const char *name,Array<String> &match) { static char returnvalue[11000]; returnvalue[0]='\0'; match.count=0; if(!name) return returnvalue; strcpy(returnvalue,name); int i; char *returnarg = returnvalue; const char *lastargument = name; // Move to the last argument... int len = strlen( name ); for (i=0; i<len; i++) { if (name[i] == ' ') { lastargument = name + i+1; returnarg = returnvalue + i+1; } } LVarMatches(lastargument,match); if(IsOneOf('.',lastargument)) { String n(""); const char *s=lastargument; while(*s!='.') n << *s++; s++; ClassDesc *cd=NULL; if(LVarLookup(n,cd)) for(int i=0;i<cd->members.count;i++) { if(!strncmp(cd->members[i].mname,s,strlen(s))) { match.Add(n + "." + cd->members[i].mname); } } } if(match.count==0) return returnvalue; if(match.count==1) { sprintf(returnarg,"%s",(const char*)match[0]); //,(foundobject)?".":" "); return returnvalue; } int j=0; while(lastargument[j]) { returnarg[j]=lastargument[j]; j++; } char c=' '; while(c) { c=' '; for(i=0;c!='\0' && i<match.count;i++) { if(c==' ') c=match[i][j]; else if(c != match[i][j]) c='\0'; } returnarg[j]=c; j++; } return returnvalue; }