void DirectoryListing::loadFile(const string& p_file, bool p_own_list) { #ifdef _DEBUG LogManager::message("DirectoryListing::loadFile = " + p_file); #endif m_file = p_file; // For now, we detect type by ending... const string ext = Util::getFileExt(p_file); if (!ClientManager::isBeforeShutdown()) { ::File ff(p_file, ::File::READ, ::File::OPEN); if (stricmp(ext, ".bz2") == 0 || stricmp(ext, ".dcls") == 0 // [+] IRainman dclst support || stricmp(ext, ".dclst") == 0 // [+] SSA dclst support ) { FilteredInputStream<UnBZFilter, false> f(&ff); loadXML(f, false, p_own_list); } else if (stricmp(ext, ".xml") == 0) { loadXML(ff, false, p_own_list); } } }
//-------------------------------------------------------------- void elementWarp::load() { loadXML(xRes, yRes, &vertici[0], nPoints, &texVert[0], nPoints, &screenPos[0], nPoints, &mainVertici[0], 4, &mainIndex[0], 4); createGrid(xRes, yRes); loadXML(xRes, yRes, &vertici[0], nPoints, &texVert[0], nPoints, &screenPos[0], nPoints, &mainVertici[0], 4, &mainIndex[0], 4); quadWarp.setTopLeftCornerPosition(ofPoint(mainVertici[0].x, mainVertici[0].y)); quadWarp.setTopRightCornerPosition(ofPoint(mainVertici[1].x, mainVertici[1].y)); quadWarp.setBottomRightCornerPosition(ofPoint(mainVertici[2].x, mainVertici[2].y)); quadWarp.setBottomLeftCornerPosition(ofPoint(mainVertici[3].x, mainVertici[3].y)); }
void DirectoryListing::loadFile(const string& name) { string txt; // For now, we detect type by ending... string ext = Util::getFileExt(name); dcpp::File ff(name, dcpp::File::READ, dcpp::File::OPEN); if(Util::stricmp(ext, ".bz2") == 0) { FilteredInputStream<UnBZFilter, false> f(&ff); loadXML(f, false); } else if(Util::stricmp(ext, ".xml") == 0) { loadXML(ff, false); } }
void DirectoryListing::loadFile(const string& name) throw(FileException, SimpleXMLException) { string txt; // For now, we detect type by ending... string ext = Util::getFileExt(name); if(Util::stricmp(ext, ".bz2") == 0) { ::File ff(name, ::File::READ, ::File::OPEN); FilteredInputStream<UnBZFilter, false> f(&ff); const size_t BUF_SIZE = 64*1024; AutoArray<char> buf(BUF_SIZE); size_t len; size_t bytesRead = 0; for(;;) { size_t n = BUF_SIZE; len = f.read(buf, n); txt.append(buf, len); bytesRead += len; if(SETTING(MAX_FILELIST_SIZE) && bytesRead > (size_t)SETTING(MAX_FILELIST_SIZE)*1024*1024) break; if(len < BUF_SIZE) break; } loadXML(txt, false); } }
void DirectoryListing::loadFile(const string& name) throw(FileException, SimpleXMLException) { string txt; // For now, we detect type by ending... string ext = Util::getFileExt(name); if(Util::stricmp(ext, ".bz2") == 0) { ::File ff(name, ::File::READ, ::File::OPEN); FilteredInputStream<UnBZFilter, false> f(&ff); const size_t BUF_SIZE = 64*1024; AutoArray<char> buf(BUF_SIZE); size_t len; size_t bytesRead = 0; for(;;) { size_t n = BUF_SIZE; len = f.read(buf, n); txt.append(buf, len); bytesRead += len; if(SETTING(MAX_FILELIST_SIZE) && bytesRead > (size_t)SETTING(MAX_FILELIST_SIZE)*1024*1024) break; if(len < BUF_SIZE) break; } } else if(Util::stricmp(ext, ".xml") == 0) { int64_t sz = ::File::getSize(name); if(sz == -1 || sz >= static_cast<int64_t>(txt.max_size())) throw(FileException(CSTRING(FILE_NOT_AVAILABLE))); txt.resize((size_t) sz); size_t n = txt.length(); ::File(name, ::File::READ, ::File::OPEN).read(&txt[0], n); } loadXML(txt, false); }
bool ledPresets::isClicked(int x, int y, bool dragged) { bool isclicked = false; // for (int i = 0; i < 3; i++) if (dragged) return isclicked; if (Record.isClicked(x, y)) { isRec = Record.isOn; isLedsClicked = false; return true; } if (LEDS::isClicked(x, y)) { isLedsClicked = true; // LEDS::setClicked(x, y, isRec ? color.red : color.black); ledLastClicked = LEDS::numClicked(x, y, isRec ? color.red : color.yellow); // get last clicked only after setClicked leds[ledLastClicked].color = isRec ? color.red : (presets[ledLastClicked].is_active ? color.yellow : color.black); printf("PRESET LED CLIK %i\n", ledLastClicked); LEDS::setClickedAll(); return true; } isLedsClicked = false; if (SaveXML.isClicked(x, y)) { saveXML(); } if (LoadXML.isClicked(x, y)) { loadXML(); } return false; }
QFile::FileError App::loadXML(const QString& fileName) { QFile::FileError retval = QFile::NoError; QDomDocument doc(QLCFile::readXML(fileName)); if (doc.isNull() == false) { if (doc.doctype().name() == KXMLQLCWorkspace) { if (loadXML(doc) == false) { retval = QFile::ReadError; } else { setFileName(fileName); m_doc->resetModified(); retval = QFile::NoError; } } else { retval = QFile::ReadError; } } return retval; }
/* main function in embree namespace */ int main(int argc, char** argv) { /* for best performance set FTZ and DAZ flags in MXCSR control and status register */ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); /* create stream for parsing */ Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv)); /* parse command line */ parseCommandLine(stream, FileName()); /* load default scene if none specified */ if (filename.ext() == "") { FileName file = FileName::executableFolder() + FileName("models/cornell_box.ecs"); parseCommandLine(new ParseStream(new LineCommentFilter(file, "#")), file.path()); } /* configure number of threads */ if (g_numThreads) g_rtcore += ",threads=" + std::to_string((long long)g_numThreads); if (g_numBenchmarkFrames) g_rtcore += ",benchmark=1"; g_rtcore += g_subdiv_mode; /* load scene */ if (strlwr(filename.ext()) == std::string("obj")) { g_scene->add(loadOBJ(filename,g_subdiv_mode != "")); } else if (strlwr(filename.ext()) == std::string("xml")) { g_scene->add(loadXML(filename,one)); } else if (filename.ext() != "") THROW_RUNTIME_ERROR("invalid scene type: "+strlwr(filename.ext())); /* initialize ray tracing core */ init(g_rtcore.c_str()); /* send model */ g_obj_scene.add(g_scene.dynamicCast<SceneGraph::Node>(),g_instancing_mode); g_scene = nullptr; set_scene(&g_obj_scene); /* benchmark mode */ if (g_numBenchmarkFrames) renderBenchmark(outFilename); /* render to disk */ if (outFilename.str() != "") renderToFile(outFilename); /* interactive mode */ if (g_interactive) { initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen); enterWindowRunLoop(g_anim_mode); } return 0; }
void MOOSAppDocumentation::showReleaseInfoAndExit() { showTitleSection("RELEASE INFO"); if(m_xml_doc == NULL) // loaded if necessary loadXML(); showSynopsis(); blk(" "); blk("AUTHORS: "); blk("------------------------------------ "); for(int i = 0 ; i < m_info_authors.size() ; i++) blk(multiLineMessage("- " + m_info_authors[i], MESSAGE_LENGTH, " ")); blk(" "); blk("CONTEXT: "); blk("------------------------------------ "); blk(" Date: " + m_info_date); blk(" Organization: " + m_info_organization); blk(" Licence: " + m_info_licence); blk(" "); blk("OPTIONAL COMMENTS: "); blk("------------------------------------ "); blk(multiLineMessage(m_optional_comments, MESSAGE_LENGTH, " ")); blk(" "); blk("SUGGESTED IMPROVEMENTS: "); blk("------------------------------------ "); blk(multiLineMessage(m_suggested_improvements, MESSAGE_LENGTH, " ")); blk(" "); exit(0); }
void MOOSAppDocumentation::showInterfaceAndExit() { showTitleSection("INTERFACE"); if(m_xml_doc == NULL) // loaded if necessary loadXML(); blk("SUBSCRIPTIONS: "); blk("------------------------------------ "); if(m_subscriptions.empty()) blk(" No subscription. "); else for(int i = 0 ; i < m_subscriptions.size() ; i++) blk(m_subscriptions[i].toString()); blk(" "); blk("PUBLICATIONS: "); blk("------------------------------------ "); if(m_publications.empty()) blk(" No publication. "); else for(int i = 0 ; i < m_publications.size() ; i++) blk(m_publications[i].toString()); blk(" "); exit(0); }
void QLCFixtureDef::checkLoaded() { // Already loaded ? Nothing to do if (m_isLoaded == true) return; if (manufacturer() == KXMLFixtureGeneric && (model() == KXMLFixtureGeneric || model() == KXMLFixtureRGBPanel)) { m_isLoaded = true; return; } if (m_defFileAbsolutePath.isEmpty()) { qWarning() << Q_FUNC_INFO << "Empty file path provided ! This is a trouble."; return; } qDebug() << "Loading fixture definition now... " << m_defFileAbsolutePath; bool error = loadXML(m_defFileAbsolutePath); if (error == false) { m_isLoaded = true; m_defFileAbsolutePath = QString(); } }
BOOL CBFXmlDoc::createXML(LPCTSTR newFilename, LPCTSTR rootTag) { if (StrCmp(newFilename, _T("")) == 0 || StrCmp(rootTag, _T("")) == 0) { ASSERT(FALSE); return FALSE; } FILE *fStream; errno_t e = _tfopen_s(&fStream, newFilename, _T("wt,ccs=UNICODE")); if (e != 0) return false; // failed.. CStdioFile xmlFile(fStream); // open the file from this stream //CFile xmlFile(newFilename, CFile::modeCreate | CFile::modeReadWrite); CString str = BF_XML_HEADER; str += _T("<"); str += rootTag; str += _T(">\n</"); str += rootTag; str += _T(">\n"); // write string, with null-terminator //xmlFile.Write(str, str.GetLength()); xmlFile.WriteString(str); xmlFile.Close(); if (!loadXML(newFilename)) { ASSERT(FALSE); return FALSE; } return TRUE; }
QFile::FileError QLCFixtureDef::loadXML(const QString& fileName) { QFile::FileError error = QFile::NoError; if (fileName.isEmpty() == true) return QFile::OpenError; QDomDocument doc = QLCFile::readXML(fileName); if (doc.isNull() == true) { qWarning() << Q_FUNC_INFO << "Unable to read from" << fileName; return QFile::ReadError; } if (doc.doctype().name() == KXMLQLCFixtureDefDocument) { if (loadXML(doc) == true) error = QFile::NoError; else error = QFile::ReadError; } else { error = QFile::ReadError; qWarning() << Q_FUNC_INFO << fileName << "is not a fixture definition file"; } return error; }
QLCFixtureMode::QLCFixtureMode(QLCFixtureDef* fixtureDef, const QDomElement* tag) { m_fixtureDef = fixtureDef; if (tag != NULL) loadXML(tag); }
QLCChannel::QLCChannel(const QDomElement* tag) { m_name = QString::null; m_group = QString(KQLCChannelGroupIntensity); m_controlByte = 0; loadXML(tag); }
/* main function in embree namespace */ int main(int argc, char** argv) { /* create stream for parsing */ Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv)); /* parse command line */ parseCommandLine(stream, FileName()); if (g_numThreads) g_rtcore += ",threads=" + std::stringOf(g_numThreads); if (g_numBenchmarkFrames) g_rtcore += ",benchmark=1"; g_rtcore += g_subdiv_mode; /* load scene */ if (strlwr(filename.ext()) == std::string("obj")) { if (g_subdiv_mode != "") { std::cout << "enabling subdiv mode" << std::endl; loadOBJ(filename,one,g_obj_scene,true); } else loadOBJ(filename,one,g_obj_scene); } else if (strlwr(filename.ext()) == std::string("xml")) loadXML(filename,one,g_obj_scene); else if (filename.ext() != "") THROW_RUNTIME_ERROR("invalid scene type: "+strlwr(filename.ext())); /* initialize ray tracing core */ init(g_rtcore.c_str()); /* convert triangle meshes to subdiv meshes */ if (g_only_subdivs) g_obj_scene.convert_to_subdiv(); /* send model */ set_scene(&g_obj_scene); /* benchmark mode */ if (g_numBenchmarkFrames) renderBenchmark(outFilename); /* render to disk */ if (outFilename.str() != "") renderToFile(outFilename); /* interactive mode */ if (g_interactive) { initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen); enterWindowRunLoop(g_anim_mode); } return 0; }
void MOOSAppDocumentation::showSynopsis() { if(m_xml_doc == NULL) // loaded if necessary loadXML(); blk("SYNOPSIS: "); blk("------------------------------------ "); blk(multiLineMessage(m_synopsis, MESSAGE_LENGTH, " ")); }
//-------------------------------------------------------------- void startScene::setup(){ bgImage.loadImage("images/bg.png"); loadXML(); width = 2160/4; height = 3840/4; bDragged = false; }
bool CalibrationData::load(const std::string& filename){ if(boost::filesystem::exists(filename) && boost::filesystem::path(filename).extension()=="xml") { return loadXML(filename); } else { std::cerr << "CalibrationData error: no such .xml file: " << filename << std::endl; return false; } }
void NILoader::load(OptionsCont& oc) { // load types first NIXMLTypesHandler* handler = new NIXMLTypesHandler(myNetBuilder.getTypeCont()); loadXMLType(handler, oc.getStringVector("type-files"), "types"); // try to load height data so it is ready for use by other importers #ifdef HAVE_INTERNAL HeightMapper::loadIfSet(oc); #endif // try to load using different methods NIImporter_SUMO::loadNetwork(oc, myNetBuilder); NIImporter_RobocupRescue::loadNetwork(oc, myNetBuilder); NIImporter_OpenStreetMap::loadNetwork(oc, myNetBuilder); NIImporter_VISUM::loadNetwork(oc, myNetBuilder); NIImporter_ArcView::loadNetwork(oc, myNetBuilder); NIImporter_Vissim::loadNetwork(oc, myNetBuilder); NIImporter_DlrNavteq::loadNetwork(oc, myNetBuilder); NIImporter_OpenDrive::loadNetwork(oc, myNetBuilder); NIImporter_MATSim::loadNetwork(oc, myNetBuilder); NIImporter_ITSUMO::loadNetwork(oc, myNetBuilder); if (oc.getBool("tls.discard-loaded") || oc.getBool("tls.discard-simple")) { myNetBuilder.getNodeCont().discardTrafficLights(myNetBuilder.getTLLogicCont(), oc.getBool("tls.discard-simple"), oc.getBool("tls.guess-signals")); size_t removed = myNetBuilder.getTLLogicCont().getNumExtracted(); if (removed > 0) { WRITE_MESSAGE(" Removed " + toString(removed) + " traffic lights before loading plain-XML"); } } loadXML(oc); // check the loaded structures if (myNetBuilder.getNodeCont().size() == 0) { throw ProcessError("No nodes loaded."); } if (myNetBuilder.getEdgeCont().size() == 0) { throw ProcessError("No edges loaded."); } // report loaded structures WRITE_MESSAGE(" Import done:"); if (myNetBuilder.getDistrictCont().size() > 0) { WRITE_MESSAGE(" " + toString(myNetBuilder.getDistrictCont().size()) + " districts loaded."); } WRITE_MESSAGE(" " + toString(myNetBuilder.getNodeCont().size()) + " nodes loaded."); if (myNetBuilder.getTypeCont().size() > 0) { WRITE_MESSAGE(" " + toString(myNetBuilder.getTypeCont().size()) + " types loaded."); } WRITE_MESSAGE(" " + toString(myNetBuilder.getEdgeCont().size()) + " edges loaded."); if (myNetBuilder.getEdgeCont().getNoEdgeSplits() > 0) { WRITE_MESSAGE("The split of edges was performed " + toString(myNetBuilder.getEdgeCont().getNoEdgeSplits()) + " times."); } if (GeoConvHelper::getProcessing().usingGeoProjection()) { WRITE_MESSAGE("Proj projection parameters used: '" + GeoConvHelper::getProcessing().getProjString() + "'."); } }
bool CalibrationData::load(const QString& filename){ QFileInfo info(filename); // QString type = info.suffix(); if(info.exists() && info.suffix()=="xml") return loadXML(filename); else { std::cerr << "CalibrationData error: no such .xml file: " << filename.toStdString() << std::endl; return false; } }
MyXML::MyXML(QString fileNmae) { if(fileNmae.isEmpty()) return; saveFileName = fileNmae; QFileInfo fileInfo(saveFileName); if(fileInfo.exists() && fileInfo.isFile()) loadXML(); //文件存在,载入文件 else creatXML(); //文件不存在,新创建一个文件 }
QFileDevice::FileError App::loadXML(const QString &fileName) { QFile::FileError retval = QFile::NoError; if (fileName.isEmpty() == true) return QFile::OpenError; QXmlStreamReader *doc = QLCFile::getXMLReader(fileName); if (doc == NULL || doc->device() == NULL || doc->hasError()) { qWarning() << Q_FUNC_INFO << "Unable to read from" << fileName; return QFile::ReadError; } while (!doc->atEnd()) { if (doc->readNext() == QXmlStreamReader::DTD) break; } if (doc->hasError()) { QLCFile::releaseXMLReader(doc); return QFile::ResourceError; } /* Set the workspace path before loading the new XML. In this way local files can be loaded even if the workspace file has been moved */ m_doc->setWorkspacePath(QFileInfo(fileName).absolutePath()); if (doc->dtdName() == KXMLQLCWorkspace) { if (loadXML(*doc) == false) { retval = QFile::ReadError; } else { setFileName(fileName); m_doc->resetModified(); retval = QFile::NoError; } } else { retval = QFile::ReadError; qWarning() << Q_FUNC_INFO << fileName << "is not a workspace file"; } QLCFile::releaseXMLReader(doc); return retval; }
QFile::FileError QLCFixtureDef::loadXML(const QString& fileName) { QFile::FileError error = QFile::NoError; if (fileName.isEmpty() == true) return QFile::OpenError; QXmlStreamReader *doc = QLCFile::getXMLReader(fileName); if (doc == NULL || doc->device() == NULL || doc->hasError()) { qWarning() << Q_FUNC_INFO << "Unable to read from" << fileName; return QFile::ReadError; } while (!doc->atEnd()) { if (doc->readNext() == QXmlStreamReader::DTD) break; } if (doc->hasError()) { QLCFile::releaseXMLReader(doc); return QFile::ResourceError; } if (doc->dtdName() == KXMLQLCFixtureDefDocument) { // qDebug() << Q_FUNC_INFO << "Loading " << fileName; if (loadXML(*doc) == true) error = QFile::NoError; else { qWarning() << fileName << QString("%1\nLine %2, column %3") .arg(doc->errorString()) .arg(doc->lineNumber()) .arg(doc->columnNumber()); error = QFile::ReadError; } } else { error = QFile::ReadError; qWarning() << Q_FUNC_INFO << fileName << "is not a fixture definition file"; } QLCFile::releaseXMLReader(doc); return error; }
QFileDevice::FileError App::loadXML(const QString &fileName) { QFile::FileError retval = QFile::NoError; if (fileName.isEmpty() == true) return QFile::OpenError; QXmlStreamReader *doc = QLCFile::getXMLReader(fileName); if (doc == NULL || doc->device() == NULL || doc->hasError()) { qWarning() << Q_FUNC_INFO << "Unable to read from" << fileName; return QFile::ReadError; } while (!doc->atEnd()) { if (doc->readNext() == QXmlStreamReader::DTD) break; } if (doc->hasError()) { QLCFile::releaseXMLReader(doc); return QFile::ResourceError; } if (doc->dtdName() == KXMLQLCWorkspace) { if (loadXML(*doc) == false) { retval = QFile::ReadError; } else { setFileName(fileName); m_doc->resetModified(); retval = QFile::NoError; } } else { retval = QFile::ReadError; qWarning() << Q_FUNC_INFO << fileName << "is not a workspace file"; } QLCFile::releaseXMLReader(doc); return retval; }
VoxelImageData::VoxelImageData() { CTRACE; std::string pFilename="voxelimagedata.xml"; Document d; if(fileExists(pFilename)) { std::string c=loadFile(pFilename); if(c.length()) { d.parse_memory(c); loadXML(d.root()); } } }
bool ImportManager::loadWorkspace(const QString &fileName) { QString localFilename = fileName; if (localFilename.startsWith("file:")) localFilename = QUrl(fileName).toLocalFile(); bool retval = false; if (localFilename.isEmpty() == true) return false; QXmlStreamReader *doc = QLCFile::getXMLReader(localFilename); if (doc == NULL || doc->device() == NULL || doc->hasError()) { qWarning() << Q_FUNC_INFO << "Unable to read from" << localFilename; return false; } while (!doc->atEnd()) { if (doc->readNext() == QXmlStreamReader::DTD) break; } if (doc->hasError()) { QLCFile::releaseXMLReader(doc); return false; } m_importDoc->clearContents(); /* Set the workspace path before loading the new XML. In this way local files can be loaded even if the workspace file has been moved */ m_importDoc->setWorkspacePath(QFileInfo(localFilename).absolutePath()); if (doc->dtdName() == KXMLQLCWorkspace) { retval = loadXML(*doc); } else { qWarning() << Q_FUNC_INFO << localFilename << "is not a workspace file"; } QLCFile::releaseXMLReader(doc); return retval; }
function getcont(id)\ {\ var o=document.getElementById('trdiv_'+id);\ if(o)\ {\ o.parentNode.removeChild(o);\ o=document.getElementById('a_'+id);\ if(o)\ {\ o.innerHTML='预览';\ }\ }\ else\ {\ o=document.getElementById('a_'+id);\ if(o)\ {\ o.innerHTML='隐藏';\ }\ o=false;\ o=document.getElementById('tr_'+id);\ if(!o)\ return 0;\ var oDiv=document.createElement('div');\ oDiv.setAttribute('id','div_'+id);\ oDiv.innerHTML='Loading...';\ var oTD=document.createElement('td');\ oTD.setAttribute('id','tddiv_'+id);\ oTD.colSpan='5';\ oTD.appendChild(oDiv);\ var oTR=document.createElement('tr');\ oTR.setAttribute('id','trdiv_'+id);\ oTR.appendChild(oTD);\ insertAfter(oTR,o);\ if(arrCont[id])\ {\ modifcont(id,arrCont[id]);\ }\ else\ {\ o=document.getElementById('alink_'+id);\ var link=o.getAttribute('href');\ loadXML(link,showcont,id);\ }\ }\ }\
bool LevelLoader::loadWorld(string &xmlPath) { // Clear temporary variables clear(); // Load descriptions from the XML file bool xmlLoaded = loadXML(xmlPath); // Build the world bool worldBuilt = buildWorld(); cout << "xmlLoaded: " << xmlLoaded << endl; cout << "worldBuilt: " << worldBuilt << endl; if(xmlLoaded && worldBuilt) return true; return false; }
void LLAgentPilot::load() { std::string txt_filename = gSavedSettings.getString("StatsPilotFile"); std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile"); if (LLFile::isfile(xml_filename)) { loadXML(xml_filename); } else if (LLFile::isfile(txt_filename)) { loadTxt(txt_filename); } else { lldebugs << "no autopilot file found" << llendl; return; } }