/********************************** 功能说明 *********************************** * 主菜单 -> 维护菜单 *******************************************************************************/ void menu_Maintenance( void ) { extern void menu_ConfigureEx( void ); static struct uMenu const menu[] = { { 0x0202u, "维护" }, { 0x0C07u, "配置" }, { 0x0C19u, "标定" }, { 0x1807u, "记录" }, { 0x1819u, "版本" } }; uint8_t item = 1u; uint32_t password = InputPassword(); if (( Configure.Password != password ) && ( SysPassword1a != password )) { return; } do { cls(); Menu_Redraw( menu ); item = Menu_Select( menu, item, NULL ); switch( item ) { case 1: if ( ! Sampler_isRunning( Q_ALL )) { menu_Configure(); } break; case 2: if ( ! Sampler_isRunning( Q_ALL )) { menu_Calibrate(); } break; case 3: PowerLog_Query(); break; case 4: ShowEdition(); if ( K_RIGHT == getKey()) { if ( ! releaseKey( K_RIGHT, 100u )) { beep(); menu_ConfigureEx(); } } break; default: break; } } while( enumSelectESC != item ); }
void menu_Maintenance( void ) { static uint32_t password = 0; Lputs( 0x0102, "维 护 " ); if ( ! Sampler_isRunning( SP_Max )) { password = InputPassword(); if( password == Configure.Password ) { menu_UserMaintenance(); } else { switch( password ) { default: return; case SysPassword1a: menu_UserMaintenance(); break; case SysPassword2a: menu_ConfigureEx(); break; // case SysPassword3a: // HCBoxPIDParament(); // break; } } } else { MsgBox( "仪器采样中,请勿设置!", vbOKOnly ); return; } }
gchar * Untar(const char * name,const char * destdir) { ClassString archve = GetArchivePath(); const char mes[]="Не в архиве "; if(strncmp(name,archve.s,strlen(archve.s))) { printf("%s '%s' \n",mes,name); return 0; } struct stat file_stat; if(!lstat(name, &file_stat)) { if(S_ISLNK(file_stat.st_mode)) { return g_strdup(name); } } ClassString zip=g_strdup(&name[strlen(archve.s)]); ClassString inzip=g_strdup(zip.s); int inside=0; if(lstat(zip.s, &file_stat)) { inside=1; while(lstat(zip.s, &file_stat)) { zip=g_path_get_dirname(zip.s); } inzip=g_strdup(&inzip.s[strlen(zip.s)+1]); } else { printf("%s\n%s",mes,name); return 0; } ClassString cache=g_build_filename(PATH_CACHE_ARCHIVE,zip.s,NULL); CreateDirInDir(cache.s); ClassString com; const char * unpack_dir; if(!destdir) unpack_dir=cache.s; else unpack_dir=destdir; if(IsTar(zip.s)) { // ClassString base=g_path_get_dirname(inzip.s); // printf("`%s` base `%s`",inzip.s,base.s); // if(!strcmp(base.s,".")) // { // com=g_strdup_printf("cd '%s'; tar -x --file='%s' './%s'", unpack_dir,zip.s,inzip.s); // } else com=g_strdup_printf("cd '%s'; tar -x --file='%s' '%s'", unpack_dir,zip.s,inzip.s); Execute(com.s); } else if(IsDeb(zip.s)) { com=g_strdup_printf("cd '%s'; ar x '%s' '%s'", unpack_dir,zip.s,inzip.s); Execute(com.s); } else if(IsZip(zip.s)) { if(!lstat(name, &file_stat)) { if(S_ISDIR(file_stat.st_mode) ) com=g_strdup_printf("cd '%s'; unzip -o '%s' '%s/*'", unpack_dir, zip.s, inzip.s); else com=g_strdup_printf("cd '%s'; unzip -o '%s' '%s'", unpack_dir, zip.s, inzip.s); } Execute(com.s); } else if(IsRar(zip.s)) { if(inzip.s[0]=='*') { ClassString password=InputPassword(); printf("Треба пассворд <%s>\n",password.s); com=g_strdup_printf("cd '%s'; unrar -p'%s' x '%s' '%s'", unpack_dir,password.s,zip.s,&inzip.s[1]); printf("%s\n",com.s); } else com=g_strdup_printf("cd '%s'; unrar -p- x '%s' '%s'", unpack_dir,zip.s,inzip.s); Execute(com.s); } else return 0; cache=g_build_filename(unpack_dir,inzip.s,NULL); if(!destdir) { if(!lstat(cache.s, &file_stat)) { unlink(name); symlink(cache.s,name); return g_strdup(name); } else printf("file not create - '%s'\n",cache.s); } return g_strdup(cache.s); }