void FFmpegPresets::ExportPresets(wxString &filename) { XMLFileWriter writer; writer.Open(filename,wxT("wb")); WriteXMLHeader(writer); WriteXML(writer); }
/////////////////////////////////////////////////////////////////////////////////////////////////// // SaveMap: try to save the current map to the given file void CMapWriter::SaveMap(const VfsPath& pathname, CTerrain* pTerrain, WaterManager* pWaterMan, SkyManager* pSkyMan, CLightEnv* pLightEnv, CCamera* pCamera, CCinemaManager* pCinema, CPostprocManager* pPostproc, CSimulation2* pSimulation2) { CFilePacker packer(FILE_VERSION, "PSMP"); // build necessary data PackMap(packer, pTerrain); try { // write it out packer.Write(pathname); } catch (PSERROR_File_WriteFailed&) { LOGERROR("Failed to write map '%s'", pathname.string8()); return; } VfsPath pathnameXML = pathname.ChangeExtension(L".xml"); WriteXML(pathnameXML, pWaterMan, pSkyMan, pLightEnv, pCamera, pCinema, pPostproc, pSimulation2); }
FFmpegPresets::~FFmpegPresets() { XMLFileWriter writer; wxFileName xmlFileName(FileNames::DataDir(), wxT("ffmpeg_presets.xml")); writer.Open(xmlFileName.GetFullPath(),wxT("wb")); WriteXMLHeader(writer); WriteXML(writer); delete mPresets; }
void CVX_Sim::WriteVXA(CXML_Rip* pXML) { pXML->DownLevel("VXA"); pXML->SetElAttribute("Version", "1.1"); WriteXML(pXML); pEnv->WriteXML(pXML); pEnv->pObj->WriteXML(pXML); pXML->UpLevel(); }
void GDTextureObject::SaveXML(void) const { string fileName = ContentManager::theContentPath + "/gdt_"; fileName += name; fileName += ".xml"; ofstream fout( fileName.c_str(), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc ); fout << "<?xml version=\"1.0\"?>\n"; WriteXML( fout ); fout.close(); }
void GDMeshAttribute::SaveXML(void) const { std::string fileName = ContentManager::theContentPath + "/gdma_"; fileName += attributeName; fileName += ".xml"; std::ofstream fout( fileName.c_str(), ios_base::out | ios_base::binary | ios_base::trunc ); fout << "<?xml version=\"1.0\"?>\n"; WriteXML( fout ); fout.close(); }
bool CCheckpointSystem::SaveGame(EntityId checkpointId, const char* fileName) { CRY_ASSERT(fileName); if(!fileName || CHECKPOINT_SAVE_XML_NODE || CHECKPOINT_LOAD_XML_NODE) return false; //set extension FixedCheckpointString file(fileName); SetFilenameExtension(file); CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_COMMENT, "Saving checkpoint %s", file.c_str()); CHECKPOINT_SAVE_XML_NODE = GetISystem()->CreateXmlNode("Checkpoint"); //write checkpoint data SCheckpointData metaData; WriteMetaData(checkpointId, CHECKPOINT_SAVE_XML_NODE, metaData); //actor data // TODO For now, not saving actor info (AI) - If this happens later, support needs to be added for entity pools //WriteActorData(CHECKPOINT_SAVE_XML_NODE); //vehicle data WriteVehicleData(CHECKPOINT_SAVE_XML_NODE); //write game tokens WriteGameTokens(CHECKPOINT_SAVE_XML_NODE); //let game write if (m_pGameHandler) { m_pGameHandler->OnWriteData(CHECKPOINT_SAVE_XML_NODE); } //inform listeners UpdateListener(metaData, true); //write to file WriteXML(CHECKPOINT_SAVE_XML_NODE, file.c_str()); //draw text message on screen //static const ColorF color (0.0f, 0.85f, 0.2f, 1.0f); //g_pGame->GetIGameFramework()->GetIPersistantDebug()->Add2DText("Checkpoint saved", 2.5f, color, 2.0f); CHECKPOINT_SAVE_XML_NODE = NULL; return true; }
/////////////////////////////////////////////////////////////////////////////////////////////////// // SaveMap: try to save the current map to the given file void CMapWriter::SaveMap(const VfsPath& pathname, CTerrain* pTerrain, WaterManager* pWaterMan, SkyManager* pSkyMan, CLightEnv* pLightEnv, CCamera* pCamera, CCinemaManager* pCinema, CPostprocManager* pPostproc, CSimulation2* pSimulation2) { CFilePacker packer(FILE_VERSION, "PSMP"); // build necessary data PackMap(packer, pTerrain); // write it out packer.Write(pathname); VfsPath pathnameXML = pathname.ChangeExtension(L".xml"); WriteXML(pathnameXML, pWaterMan, pSkyMan, pLightEnv, pCamera, pCinema, pPostproc, pSimulation2); }
void mitk::ContourModelWriter::Write() { std::ostream* out; std::ofstream outStream; if( this->GetOutputStream() ) { out = this->GetOutputStream(); } else { outStream.open( this->GetOutputLocation().c_str() ); out = &outStream; } if ( !out->good() ) { mitkThrow() << "Stream not good."; } std::locale previousLocale(out->getloc()); std::locale I("C"); out->imbue(I); /*+++++++++++ Here the actual xml writing begins +++++++++*/ /*++++ <?xml version="1.0" encoding="utf-8"?> ++++*/ WriteXMLHeader( *out ); // // for each input object write its xml representation to // the stream // mitk::ContourModel::ConstPointer contourModel = dynamic_cast<const mitk::ContourModel*>(this->GetInput()); assert( contourModel.IsNotNull() ); WriteXML( contourModel.GetPointer(), *out ); out->imbue(previousLocale); if ( !out->good() ) // some error during output { throw std::ios_base::failure("Some error during contour writing."); } }
int main(int argc, char **argv) { if (argc != 5) { print_usage(); return EXIT_FAILURE; } std::ifstream cityTileFile(argv[1], std::ios_base::in); if (!cityTileFile) { std::cerr << "Failed to open \"" << argv[1] << "\"\n"; return EXIT_FAILURE; } std::string output_dir(argv[4]); auto voxelLayers = ApocRes::VoxelLayer::loadLayersFromFile(argv[2], argv[3]); int tileCount = 0; auto tile = ApocRes::CityMapTile::loadFromFile(cityTileFile, tileCount, voxelLayers); while (tile) { tinyxml2::XMLDocument doc{}; auto rootElement = doc.NewElement("openapoc"); doc.InsertFirstChild(rootElement); tile->WriteXML(rootElement); std::stringstream ss; ss << output_dir << "/citymap:" << tileCount << ".xml"; doc.SaveFile(ss.str().c_str()); delete tile; tileCount++; tile = ApocRes::CityMapTile::loadFromFile(cityTileFile, tileCount, voxelLayers); } }
// Write information about an untrusted certificate BOOL ProduceUntrustedCertificateXML(BIO *target, const DEFCERT_UNTRUSTED_cert_st *entry, EVP_PKEY *key, int sig_alg) { unsigned int i, read_len=0; int outl; if(target == NULL) return FALSE; if(entry->dercert_data == NULL) return TRUE; EVP_ENCODE_CTX base_64; unsigned char *buffer = new unsigned char[BUFFER_SIZE+1]; if(buffer == NULL) return FALSE; BOOL ret = FALSE; X509 *cert=NULL; char *name=NULL; do{ if(!BIO_puts(target, "-->\n<!-- Copyright (C) 2008-2009 Opera Software ASA. All Rights Reserved. -->\n\n<untrusted-certificate>\n")) break; const unsigned char *data = entry->dercert_data; cert = d2i_X509(NULL, &data, entry->dercert_len); if(cert == NULL) break; // Cert name in one line char *name = X509_NAME_oneline(X509_get_subject_name(cert), NULL, 0); if(!name) break; if(!WriteXML(target, "subject", name, (char *) buffer, BUFFER_SIZE)) break; OPENSSL_free(name); // friendly name if(entry->nickname) if(!WriteXML(target, "shortname", entry->nickname, (char *) buffer, BUFFER_SIZE)) break; // reason it is untrusted if(entry->reason) if(!WriteXML(target, "untrusted-reason", entry->reason, (char *) buffer, BUFFER_SIZE)) break; if(!BIO_puts(target, "<certificate-data>\n")) break; EVP_EncodeInit(&base_64); read_len=0; // Write Base64 encoded certificate for(i = 0; i < entry->dercert_len; i+= read_len) { read_len = (BUFFER_SIZE/4)*3; if(i + read_len > entry->dercert_len) read_len = entry->dercert_len -i; outl =0; EVP_EncodeUpdate(&base_64, buffer, &outl, entry->dercert_data+i, read_len); if(outl && !BIO_write(target, buffer, outl)) break; } outl =0; EVP_EncodeFinal(&base_64, buffer, &outl); if(outl && !BIO_write(target, buffer, outl)) break; if(!BIO_puts(target, "\n</certificate-data>\n")) break; if(!BIO_puts(target, "</untrusted-certificate>\n")) break; ret = TRUE; } while(0); X509_free(cert); OPENSSL_free(name); delete [] buffer; return ret; }
void CBirthdays::Store() { // Persistency WriteXML( m_homedir+"birthdays.xml"); }
void CDM_FEA::SaveFile(std::string filename) { CXML_Rip XML; WriteXML(&XML); XML.SaveFile(filename); }