void BcxFile::GetModel( std::vector< s16 >& skeleton_length, const Unit& unit, Ogre::MeshPtr mesh, Ogre::SkeletonPtr skeleton, VectorTexForGenBsx& textures ) { u32 offset_to_model_info = GetU32LE(0x04); u8 number_of_bones = GetU8(offset_to_model_info + 0x02); u8 number_of_parts = GetU8(offset_to_model_info + 0x03); u8 number_of_animations = GetU8(offset_to_model_info + 0x04); ////////////////////////// // mesh ////////////////////////// u16 offset_to_parts = GetU16LE(offset_to_model_info + 0x1c) + number_of_bones * 4; MeshFile file_m(this); file_m.GetData(unit.name, offset_to_parts, number_of_parts, mesh, textures); ////////////////////////// ////////////////////////// // skeleton ////////////////////////// u16 offset_to_bones = GetU16LE(offset_to_model_info + 0x1C); SkeletonFile file_s(this); file_s.GetData( skeleton_length, offset_to_bones, number_of_bones, skeleton ); ////////////////////////// /////////////////////////////////////////////////// // animations /////////////////////////////////////////////////// u32 offset_to_animations = GetU32LE(offset_to_model_info + 0x1C) - 0x80000000 + number_of_bones * 4 + number_of_parts * 0x20; AnimationFile afile(this); afile.GetData( skeleton_length, unit, offset_to_animations, number_of_animations, 0, skeleton ); }
/************ * *功能:check cdms statu every 1s * * * **/ void mainview::CheckNetworkState() { QFile file( "/sys/class/net/"+netconfig->devicename+"/operstate" ); if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) { QByteArray line = file.readLine(); QString mg = line; file.close(); qDebug() << mg; if(mg.compare("down\n") == 0) { if(netconfig->devicename.compare("wlan0")==0) QProcess::execute("ifconfig wlan0 up"); else startthread("/etc/init.d/networking restart"); } } QFile file_s( "./server.txt" ); if ( file_s.open(QIODevice::ReadOnly | QIODevice::Text) ) { QByteArray line = file_s.readLine(); QString mg = line; file_s.close(); QStringList md = mg.split("\n"); http->CheckService(md.at(0)); } else { emit_widgets(1); } }
void win_char_editor::file_save() { if (never_saved) //Se eseguo questo comando con una shortkey non faccio niente return; file_s(file); }
void BcxFile::GetSkeleton( std::vector< s16 >& skeleton_length ) { u32 offset_to_model_info = GetU32LE(0x04); u8 number_of_bones = GetU8(offset_to_model_info + 0x02); u16 offset_to_bones = GetU16LE(offset_to_model_info + 0x1C); SkeletonFile file_s(this); Ogre::SkeletonPtr skeleton; skeleton.setNull(); file_s.GetData( skeleton_length, offset_to_bones, number_of_bones, skeleton); }
void win_char_editor::file_save_as() { QString new_file; if (never_saved) new_file = save_chr(this, ""); else new_file = save_chr(this, file); if (!new_file.isEmpty()) { file_s(new_file); } }
int mod_handler(request_rec* r) { ::OutputDebugString("\n\n--------------------------------------------------------------------------------\n"); #ifdef _DEBUG function func(MOD_NAME ":" __FUNCTION__); #endif /* * We're about to start sending content, so we need to force the HTTP * headers to be sent at this point. Otherwise, no headers will be sent * at all. We can set any we like first, of course. **NOTE** Here's * where you set the "Content-type" header, and you do so by putting it in * r->content_type, *not* r->headers_out("Content-type"). If you don't * set it, it will be filled in with the server's default type (typically * "text/plain"). You *must* also ensure that r->content_type is lower * case. * * We also need to start a timer so the server can know if the connexion * is broken. */ r->content_type = "text/html"; r->no_cache = r->no_local_copy = 1; ::ap_send_http_header(r); /* * если требуется отправить только заголовок (HEAD запрос), то ничего не делаем */ if( !r->header_only ) { //SYSTEMTIME sys_time; ::GetSystemTime(&sys_time); ::ap_soft_timeout(MOD_NAME, r); ScopeGuard sg_ap_kill_timeout(MakeGuard(&::ap_kill_timeout, r)); std::string html_header( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n" "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n" "<head>\r\n" "\t<title>mod_phone_billing</title>\r\n" // мета-тег X-UA-Compatible должен быть помещен в HEAD страницы самым первым по счету, // если его поставить после любого другого мета-тега, например, после иконки или заголовка страницы, // то он будет просто проигнорирован. Не забывайте про эту особенность, когда будете верстать свой сайт. // Как вариант, мета-тег X-UA-Compatible можно использовать для проверки отображения сайта под разными // версиями IE, не устанавливая сами браузеры, а имея только один установленный IE8. // <meta http-equiv="X-UA-Compatible" content="IE=8"/> "\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\" />\r\n" "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\" />\r\n" "\t<meta http-equiv=\"Expires\" content=\"immediately\" />\r\n" "\t<meta name=\"robots\" content=\"noindex,nofollow\" />\r\n" "\t<meta name=\"document-state\" content=\"dynamic\" />\r\n" "\t<meta name=\"Pragma\" content=\"no-cache\" />\r\n" "\t<style>\r\n" "\t.panel {\r\n" "\t\tfloat: left;\r\n" "\t\twidth: 20%;\r\n" "\t}\r\n" "\t.content {\r\n" "\t\toverflow: hidden;\r\n" "\t}\r\n" "\t</style>\r\n" "\t<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\""); //! в элементе <link ...> заголовка настройка таблицы стилей использует config_mod_url if( 0==config_mod_url ) config_mod_url = "mod_phone_billing"; html_header.append(config_mod_url); html_header.append(".css\" />\r\n" //"\t<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"//www.ibm.com/common/v14/screen.css\"/> //"\t<link rel=\"stylesheet\" type=\"text/css\" media=\"print\" href=\"//www.ibm.com/common/v14/print.css\"/> "</head>\r\n" "<body>\r\n" ); ::ap_rputs(html_header.c_str(), r); ScopeGuard sg_mod_html_end(MakeGuard(&::mod_html_end, r)); /* * Locate our directory configuration record for the current request. */ // excfg* conf_struct = (excfg*)ap_get_module_config(r->per_dir_config, &phone_billing_module); /* * Now send our actual output. Since we tagged this as being * "text/html", we need to embed any HTML. */ try { if( M_POST==r->method_number ) { //::ap_hard_timeout(MOD_NAME, r); //ScopeGuard sg_ap_kill_timeout = MakeGuard(&::ap_kill_timeout, r); // // настраиваем структуры Apache и получаем клиентские http-данные // if( ::ap_setup_client_block(r, REQUEST_CHUNKED_ERROR) ) throw std::runtime_error(__FUNCTION__":'::ap_setup_client_block' failed"); long const cln_http_data_size = r->remaining; if( cln_http_data_size<=0 ) throw std::runtime_error(__FUNCTION__": invalid content length <=0"); if( cln_http_data_size>=config_max_len ) throw std::runtime_error(__FUNCTION__": content length too large (config:post_max_sz)."); char* const cln_http_data_ptr = (char* const)::malloc(cln_http_data_size); if( 0==cln_http_data_ptr ) throw std::runtime_error(__FUNCTION__":'::malloc' for 'client_http_data_block' failed"); ScopeGuard sg_cln_http_data_free(MakeGuard(&::free, cln_http_data_ptr)); char* const cln_http_data_end = cln_http_data_ptr + cln_http_data_size; if( ::ap_should_client_block(r)) { long const cln_http_data_len = ::ap_get_client_block(r, cln_http_data_ptr, cln_http_data_size); if( cln_http_data_len!=cln_http_data_size ) { std::string err_str; ::format(err_str, __FUNCTION__": '::ap_get_client_block' returned %1 bytes, content length %2 bytes\r\b", cln_http_data_len, cln_http_data_size ); #ifdef _DEBUG {::Sleep(10); FILETIME ft; ::GetSystemTimeAsFileTime(&ft); std::string file_name_r; ::format(file_name_r, "%1%2-RECV.txt", (void*)ft.dwHighDateTime, (void*)ft.dwLowDateTime); File<FileOpening::CreateAlways, FileAccess::ReadWrite, FileShare::ShareReadWriteDelete> file_r(file_name_r.c_str()); file_r.write(cln_http_data_ptr, cln_http_data_size);} #endif ::OutputDebugString(err_str.c_str()); throw std::runtime_error(err_str); } } else throw std::runtime_error(__FUNCTION__": '::ap_should_client_block' failed"); //-::ap_reset_timeout(r); //-::ap_kill_timeout(r); // получаем строку являющуюся разделителем http-аргументов вида: 'имя'\r\n'значение' char const* const delimit_ptr = (char*)::ap_table_get(r->headers_in, "Content-Type"); if( 0==delimit_ptr ) throw std::runtime_error(__FUNCTION__": '::ap_table_get' failed, for 'Content-Type' returned null"); char const* const delimit_end = delimit_ptr + ::strlen(delimit_ptr); HttpArgs http_args(cln_http_data_ptr, cln_http_data_end, delimit_ptr, delimit_end); //_asm int 3; UI_Control cont; const char* returned = cont.http_form_args_raw_parser(cln_http_data_ptr, cln_http_data_end, delimit_ptr, delimit_end); std::string html_output; cont.ui_handler(html_output, http_args, db_connection); ::ap_rputs(html_output.c_str(), r); #ifdef _DEBUG {::Sleep(10); FILETIME ft; ::GetSystemTimeAsFileTime(&ft); std::string file_name_r; ::format(file_name_r, "%1%2-RECV.txt", (void*)ft.dwHighDateTime, (void*)ft.dwLowDateTime); std::string file_name_s; ::format(file_name_s, "%1%2-SEND.txt", (void*)ft.dwHighDateTime, (void*)ft.dwLowDateTime); File<FileOpening::CreateAlways, FileAccess::ReadWrite, FileShare::ShareReadWriteDelete> file_r(file_name_r.c_str()); File<FileOpening::CreateAlways, FileAccess::ReadWrite, FileShare::ShareReadWriteDelete> file_s(file_name_s.c_str()); file_s.write(html_output.c_str(), html_output.size()); file_r.write(cln_http_data_ptr, cln_http_data_size);} #endif } else if( M_GET==r->method_number ) { // выдать страницу для ввода имени пользователя и пароля ::ap_rputs( "\t<table cellspacing=\"0\" cellpadding=\"1\" align=\"center\" valign=\"center\"><tr><td>\r\n" "\t<span class=\"rbfullbox\" style='text-align:left;'><b class=\"rbtbtop\"><b class=\"rbtbb1\"></b><b class=\"rbtbb2\"></b><b class=\"rbtbb3\"></b><b class=\"rbtbb4\"></b></b><span class=\"rbtbboxcontent\">\r\n" "\t<h3 class=\"rbtbboxtitle maintitleborderd\">login</h3>\r\n" "\t<div class=\"x2textcontent\">\r\n" "\t<div id=\"27779260342010226_Automatic_Headlines_1\" style=\"display: inline-table;\">\r\n" "\t<form method=\"post\" enctype=\"multipart/form-data\">\r\n" "\t\t<table cellspacing=\"0\" cellpadding=\"1\">\r\n" "\t\t<tr><td>Пользователь:</td><td><input type=\"text\" name=\"user\" maxlength=\"32\" value=\"admin\"></td></tr>\r\n" "\t\t<tr><td>Пароль:</td><td><input type=\"password\" name=\"pass\" maxlength=\"32\" value=\"qwerty\"></td></tr>\r\n" "\t\t<tr><td></td><td><input type=\"submit\" name=\"btn\" value=\">\" title=\"Авторизоваться\"/></td></tr>\r\n" "\t\t</table>\r\n" "\t</form>\r\n" "\t</div></div>\r\n" "</span><b class=\"rbtbbottom\"><b class=\"rbtbb8\"></b><b class=\"rbtbb7\"></b><b class=\"rbtbb6\"></b><b class=\"rbtbb5\"></b></b></span>\r\n" "\t<div style=\"height:8px\"></div>\r\n" "\t</tr></table>\r\n" ,r); /* * КОД НИЖЕ БЫЛ В МОДУЛЕ http://www.modsecurity.org/download/, НЕ ВХОДЯЩЕГО В ПОСТАВКУ Apache * * here we alter Apache internal structures to point those pointers to our buffer * and to reset counters so that Apache will think that the payload was not read at all * r->connection->client->inptr = (unsigned char *)buffer; r->connection->client->incnt = size + 1; r->remaining = size + 1; r->read_length = 0;*/ } } catch(const std::exception& e) { //API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error); ::ap_log_rerror(__FILE__, __LINE__, APLOG_ERR|APLOG_NOERRNO, r, MOD_NAME"-> exception in '"__FUNCTION__"'. %s", e.what()); ::ap_rputs("<b>"MOD_NAME"-> exception in '"__FUNCTION__"':</b><pre>\r\n", r); ::ap_rputs(e.what(), r); ::ap_rputs("</pre>\r\n<a href=\"", r); ap_rputs(config_mod_url, r); ::ap_rputs("/\"> На главную страницу... </a>\r\n", r); } // здесь ScopeGuard делает за нас '::ap_rputs("</body>\r\n</html>\r\n", r);' // чтобы отменить ранее поставленный таймаут /* * We're all done, so cancel the timeout we set. Since this is probably * the end of the request we *could* assume this would be done during * post-processing - but it's possible that another handler might be * called and inherit our outstanding timer. Not good; to each its own. */ // здесь ScopeGuard отменит поставленный ранее таймаут делая за нас '::ap_kill_timeout(r);' } /* * We did what we wanted to do, so tell the rest of the server we * succeeded. */ return OK; }