PStream StartSavegame(const String &filename, const String &user_text, const Bitmap *user_image) { Stream *out = Common::File::CreateFile(filename); if (!out) return PStream(); // Initialize and write Vista header RICH_GAME_MEDIA_HEADER vistaHeader; memset(&vistaHeader, 0, sizeof(RICH_GAME_MEDIA_HEADER)); memcpy(&vistaHeader.dwMagicNumber, RM_MAGICNUMBER, sizeof(int)); vistaHeader.dwHeaderVersion = 1; vistaHeader.dwHeaderSize = sizeof(RICH_GAME_MEDIA_HEADER); vistaHeader.dwThumbnailOffsetHigherDword = 0; vistaHeader.dwThumbnailOffsetLowerDword = 0; vistaHeader.dwThumbnailSize = 0; convert_guid_from_text_to_binary(game.guid, &vistaHeader.guidGameId[0]); uconvert(game.gamename, U_ASCII, (char*)&vistaHeader.szGameName[0], U_UNICODE, RM_MAXLENGTH); uconvert(user_text, U_ASCII, (char*)&vistaHeader.szSaveName[0], U_UNICODE, RM_MAXLENGTH); vistaHeader.szLevelName[0] = 0; vistaHeader.szComments[0] = 0; // MS Windows Vista rich media header vistaHeader.WriteToFile(out); // Savegame signature out->Write(SavegameSource::Signature.GetCStr(), SavegameSource::Signature.GetLength()); // CHECKME: what is this plugin hook suppose to mean, and if it is called here correctly pl_run_plugin_hooks(AGSE_PRESAVEGAME, 0); // Write descrition block WriteDescription(out, user_text, user_image); return PStream(out); }
// // Write a PERF TBP configuration element to the XML output stream. // void CDCConfig::WriteTBPPerf(QTextStream& xmlStream) { xmlStream << " <tbp_perf" ; WriteStringAttr(xmlStream, "name", m_configName) ; WriteFloatAttr(xmlStream, "interval", m_interval) ; xmlStream << ">\n" ; WriteTooltip(xmlStream, m_toolTip) ; WriteDescription(xmlStream, m_description) ; xmlStream << " </tbp_perf>\n" ; }
//----------------------------------------------------------------------------- bool psNPCLoader::SaveToFile(int id, csString &filename) { filename.Insert(0,"/this/"); psCharacterLoader loader; npc = loader.LoadCharacterData(id,false); if(!npc) { CPrintf(CON_ERROR, "Error: Couldn't load NPC with id: %i\n",id); return false; } //*npc = *character; // removed npcID = id; area = npc->GetCharName(); csRef<iDocumentSystem> xml; xml.AttachNew(new csTinyDocumentSystem); csRef<iDocument> doc = xml->CreateDocument(); csRef<iDocumentNode> root = doc->CreateRoot(); npcRoot = root->CreateNodeBefore(CS_NODE_ELEMENT); npcRoot->SetValue("npc"); WriteBasicInfo(); WriteDescription(); WriteLocation(); WriteStats(); WriteMoney(); WriteEquipment(); WriteFactions(); WriteSkills(); WriteMerchantInfo(); WriteTrainerInfo(); WriteKnowledgeAreas(); WriteSpecificKnowledge(); csRef<iVFS> vfs = csQueryRegistry<iVFS> (psserver->GetObjectReg()); if(!vfs) return false; csString error = doc->Write(vfs, filename); if(!error.IsEmpty()) { CPrintf(CON_ERROR, "Error writing to file %s: %s\n",filename.GetData(), error.GetData()); return false; } return true; }
void ManPageWrite(Writer *out, const char *program, time_t last_modified, const char *short_description, const char *long_description, const struct option options[], const char *option_hints[], bool accepts_file_argument) { WriteCopyright(out); WriteHeader(out, program, last_modified); WriteName(out, program, short_description); WriteSynopsis(out, program, accepts_file_argument); WriteDescription(out, long_description); WriteOptions(out, options, option_hints); WriteCFEngine(out); WritePromiseTheory(out); WriteAvailability(out, program); WriteBugs(out); WriteSeeAlso(out); WriteAuthor(out); }
// // Write an EBP configuration element to the XML output stream. // void CDCConfig::WriteEBP(QTextStream& xmlStream) { xmlStream << " <ebp" ; WriteStringAttr(xmlStream, "name", m_configName) ; WriteDecimalAttr(xmlStream, "mux_period", m_multiplexPeriod) ; // num_groups is not read. It is written as a debugging aid xmlStream << ">\n" ; PerfEventList::iterator it = m_eventContainer.getPerfEventList()->begin(); PerfEventList::iterator it_end = m_eventContainer.getPerfEventList()->end(); for (; it != it_end; it++) { WriteEvent(xmlStream, &(*it)) ; } WriteTooltip(xmlStream, m_toolTip) ; WriteDescription(xmlStream, m_description) ; xmlStream << " </ebp>\n" ; }
bool DefFile::Write() { stream = new std::fstream(fileName.c_str(), std::ios::out); //if (stream != NULL) { WriteName(); WriteLibrary(); WriteExports(); WriteImports(); WriteDescription(); WriteStacksize(); WriteHeapsize(); WriteCode(); WriteData(); WriteSections(); delete stream; } return true; }