void ReportWindow::Pdf() { static FileSel fs; static bool b; if(!b) { fs.Type(t_("PDF file"), "*.pdf"); fs.AllFilesType(); } if(!fs.ExecuteSaveAs(t_("Output PDF file"))) return; SaveFile(~fs, UPP::Pdf(*report)); }
XMLError XMLDocument::SaveFile(const char* filename, bool compact) { FILE* fp = callfopen(filename, "w"); if (!fp) { SetError(XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0); return _errorID; } SaveFile(fp, compact); fclose(fp); return _errorID; }
bool TiXmlDocument::SaveFile( const char * filename ) const { // The old c stuff lives on... FILE* fp = TiXmlFOpen( filename, "w" ); if ( fp ) { bool result = SaveFile( fp ); fclose( fp ); return result; } return false; }
void WorkspaceWork::RestoreBackup() { for(int i = 0; i < backup.GetCount(); i++) { Backup& b = backup[i]; String fn = backup.GetKey(i); if(b.data.IsVoid()) DeleteFile(fn); else { SaveFile(fn, b.data); SetFileTime(fn, b.time); } } }
FString ExportPresetFile(FString SuggestedFilename) { FString OutOpenFilename; FString InOutLastPath = "."; if ( SaveFile( TEXT("Export Preset"), TEXT("Export Types (*.sbsprs)|*.sbsprs;|All Files|*.*"), InOutLastPath, SuggestedFilename + ".sbsprs", OutOpenFilename ) ) return OutOpenFilename; else return FString(); }
bool TagReaderClient::SaveFileBlocking(const QString& filename, const Song& metadata) { Q_ASSERT(QThread::currentThread() != thread()); bool ret = false; TagReaderReply* reply = SaveFile(filename, metadata); if (reply->WaitForFinished()) { ret = reply->message().save_file_response().success(); } reply->deleteLater(); return ret; }
void Exit() { if (isFileEdited) { puts("Файл был изменен. Сохранить? y/n"); char answer = getch(); if (answer == 'y') { SaveFile(); } } exit(0); }
void Profile::Save() { if (!IsModified()) return; LogFormat("Saving profiles"); if (startProfileFile.IsNull()) SetFiles(nullptr); assert(!startProfileFile.IsNull()); SaveFile(startProfileFile); }
void Profile::SaveFile(const TCHAR *szFile) { if (StringIsEmpty(szFile)) return; LogFormat(_T("Saving profile to %s"), szFile); // Try to open the file for writing FileTransaction transaction(szFile); if (SaveFile(transaction)) transaction.Commit(); }
/* ============== WritePCXfile ============== */ void WritePCXfile(const char *filename, byte * data, int width, int height, byte * palette) { int i, j, length; pcx_t *pcx; byte *pack; pcx = safe_malloc(width * height * 2 + 1000); memset(pcx, 0, sizeof(*pcx)); pcx->manufacturer = 0x0a; // PCX id pcx->version = 5; // 256 color pcx->encoding = 1; // uncompressed pcx->bits_per_pixel = 8; // 256 color pcx->xmin = 0; pcx->ymin = 0; pcx->xmax = LittleShort((short)(width - 1)); pcx->ymax = LittleShort((short)(height - 1)); pcx->hres = LittleShort((short)width); pcx->vres = LittleShort((short)height); pcx->color_planes = 1; // chunky image pcx->bytes_per_line = LittleShort((short)width); pcx->palette_type = LittleShort(1); // not a grey scale // pack the image pack = &pcx->data; for(i = 0; i < height; i++) { for(j = 0; j < width; j++) { if((*data & 0xc0) != 0xc0) *pack++ = *data++; else { *pack++ = 0xc1; *pack++ = *data++; } } } // write the palette *pack++ = 0x0c; // palette ID byte for(i = 0; i < 768; i++) *pack++ = *palette++; // write output file length = pack - (byte *) pcx; SaveFile(filename, pcx, length); free(pcx); }
// **************************************************************************** // Method: XMLEdit::saveAs // // Purpose: // Menu callback: Save file with a new name. // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Cyrus Harrison, Thu May 15 16:00:46 PDT 200 // First pass at porting to Qt 4.4.0 // // **************************************************************************** void XMLEdit::saveAs() { QString file = QFileDialog::getSaveFileName( this, tr("Save file..."), QString(), tr("XML files (*.xml)")); if (file.isNull()) return; SaveFile(file); }
void CCommandProcessor::OnRespondGetLog(BYTE *pBuffer, size_t /*bufLen*/) { if (!m_bGetLog) { return; } m_bGetLog = FALSE; try { NET_HEAD_MAN head = {0}; SCREEN_TERMINFO stTermInfo = {0}; GetHead(pBuffer, &head); GetBody(pBuffer, &stTermInfo, sizeof(stTermInfo)); CByteArray buf; buf.SetSize(head.Length - sizeof(stTermInfo)); CopyMemory(buf.GetData(), pBuffer + sizeof(head) + sizeof(stTermInfo), buf.GetSize()); CString strPicFile(theApp.GetWorkPath() + _T("\\IBATermLog\\")); CIBAHelpper::MakeSurePathExists(strPicFile); strPicFile.Append(CA2W(stTermInfo.termID)); strPicFile.Trim(); if (head.Version == 1) //zip { strPicFile.AppendFormat(_T("[%s].zip"), CIBAHelpper::GetCurrentTimeAsString()); } else { strPicFile.AppendFormat(_T("[%s].log"), CIBAHelpper::GetCurrentTimeAsString()); } SaveFile(strPicFile, buf); } catch (CFileException* e) { e->Delete(); CIBALog::GetInstance()->Write(_T("Get Log: Operation file failed.")); } catch (...) { CIBALog::GetInstance()->Write(_T("Get Log failed.")); } }
/*! * \brief Remove the albumart image from the file * * \param filename The music file to remove the albumart * \param albumart The Album Art image to remove * \returns True if successful */ bool MetaIOID3::removeAlbumArt(const QString &filename, const AlbumArtImage *albumart) { if (filename.isEmpty() || !albumart) return false; AttachedPictureFrame::Type type = AttachedPictureFrame::Other; switch (albumart->m_imageType) { case IT_FRONTCOVER: type = AttachedPictureFrame::FrontCover; break; case IT_BACKCOVER: type = AttachedPictureFrame::BackCover; break; case IT_CD: type = AttachedPictureFrame::Media; break; case IT_INLAY: type = AttachedPictureFrame::LeafletPage; break; case IT_ARTIST: type = AttachedPictureFrame::Artist; break; default: type = AttachedPictureFrame::Other; break; } if (!OpenFile(filename, true)) return false; TagLib::ID3v2::Tag *tag = GetID3v2Tag(); if (!tag) return false; AttachedPictureFrame *apic = findAPIC(tag, type, QStringToTString(albumart->m_description)); if (!apic) return false; tag->removeFrame(apic); if (!SaveFile()) return false; return true; }
bool CentralWorkSaver::GameNew() { any_cancel = false; bool file_exists = TestFileExists(); bool game_modified = TestGameModified(); bool game_in_file = TestGameInFile(); if( file_exists && game_modified ) { if( game_in_file ) { int answer = SaveGamePrompt(true,FILE_EXISTS_GAME_MODIFIED,false); if( answer == wxYES ) SaveFile(false,FILE_EXISTS_GAME_MODIFIED,false); } else { int answer = SaveGamePrompt(true,FILE_EXISTS_GAME_NEW,false); if( answer == wxYES ) SaveFile(false,FILE_EXISTS_GAME_NEW,false); } } bool okay = !any_cancel; return okay; }
void bigMailerCfg::Save() { const String enter = "\r\n" ; String s = "lastList=" + lastList + enter + "lastMsg=" + lastMsg + enter + "smtpServer=" + smtpServer + enter + "user="******"pass="******"blacklist_" << i << "=" << blackList[i] << enter ; SaveFile(ConfigFile("bigmailer.ini"), s ) ; }
//Вывод в файл список в формате Оригинал - Русское - количество эпизодов void AnimeList::PrintFile() { if(!fs.ExecuteSaveAs()) return; String printfile = fs; String xml, name, namerus, episodes; for(int i = 0; i < listName.GetCount(); i++) { xml += Format(AsString(listName.Get(i, Named)) + " - " + AsString(listName.Get(i, NamedRus)) + " - Episodes: %d", listName.Get(i, Episodes)); RawCat(xml, "\r\n"); } if(!SaveFile(printfile, xml)) Exclamation("Error Saving the File"); }
bool Syscfg::SetRunState(bool attr) { pugi::xml_node node = GetNode("run_state"); pugi::xml_attribute node_attr = node.attribute("serve"); if (!node_attr) node_attr = node.append_attribute("serve"); node_attr = attr; node_attr = node.attribute("client"); if (!node_attr) node_attr = node.append_attribute("client"); node_attr = !attr; return SaveFile(); }
/* * FancyFileSave */ vi_rc FancyFileSave( void ) { vi_rc rc; if( CurrentFile == NULL ) { return( ERR_NO_FILE ); } rc = SaveFile( CurrentFile->name, -1, -1, TRUE ); if( rc == ERR_NO_ERR ) { CurrentFile->modified = FALSE; UpdateLastFileList( CurrentFile->name ); } return( rc ); } /* FancyFileSave */
bool Syscfg::SetFPS(INT value, bool is_push /*= false*/) { pugi::xml_node node; if (!is_push) node = GetNode("serve_data"); else node = GetNode("push_data"); pugi::xml_attribute attr = node.attribute("fps"); if (!attr) attr = node.append_attribute("fps"); attr = value; return SaveFile(); }
static int OnMenuSelected(void *wnd, int t_id, int m_id) { GEM_WINDOW *gwnd = (GEM_WINDOW *) wnd ; int code = GW_EVTSTOPROUTING ; switch( m_id ) { case M_FERME : gwnd->OnClose( wnd ) ; break ; case M_SAUVE : SaveFile( gwnd, 0 ) ; break ; case M_SAUVES : SaveFile( gwnd, 1 ) ; break ; default : code = GW_EVTCONTINUEROUTING ; break ; } GWOnMenuSelected( t_id, m_id ) ; return( code ) ; }
void Cmd_TextureMix() { miptex32_t *qtex32; char filename[1024]; int size; InitVars(); GetScriptToken (false); strcpy(root, token); RemoveExt(root); RemoveLeading(root); strcpy(filename, ExpandPathAndArchive(token)); if (SetVars(filename)) { // Create combined texture percent = ((TotalArea() * 100) / (out.w * out.h)); printf("Total area consumed : %d%%\n", percent); printf("Texture resolution : %dx%d pixels.\n", xcharsize, ycharsize); CreateMain(); // Save image as m32 sprintf (filename, "%spics/misc/%s.m32", gamedir, out.name); qtex32 = CreateMip32((unsigned *)outpixels, out.w, out.h, &size, false); qtex32->contents = 0; qtex32->value = 0; qtex32->scale_x = 1.0; qtex32->scale_y = 1.0; sprintf (qtex32->name, "misc/%s", out.name); printf ("\n\nwriting %s\n", filename); SaveFile (filename, (byte *)qtex32, size); free (qtex32); // Save out script file sprintf (filename, "%spics/misc/%s.fnt", gamedir, outscript); printf("Writing %s as script file\n", filename); if (!SaveScript(filename)) { printf("Unable to save output script.\n"); } } printf("Everythings groovy.\n"); Cleanup(); }
void CCalendarDlg2::OnOK() { SYSTEMTIME sysTime; BOOL bResult = (BOOL)::SendMessage(m_mcMonthCal, MCM_GETCURSEL, 0, (LPARAM) &sysTime); if(bResult) { dtSelected=COleDateTime(sysTime.wYear,sysTime.wMonth,sysTime.wDay,0,0,0); SetTextForDay(0); } CResizeableDialog::OnOK(); CString sNewContent; for(int i=0; i<aItems.GetSize(); i++) { sNewContent+=aItems[i]; sNewContent+="\r\n"; } SaveFile(sMainFile,sNewContent); }
// �Z�[�u void ST_RankingSave(void) {//12345 6789 int i,j, temp2[3]; FillMemory(&saveBuf, 5000 * 4, 0); saveBuf[0] = st_version; for(i=0;i<90;i++) { saveBuf[i + 10] = st_time[i]; saveBuf[i + 99] = st_end[i]; saveBuf[i + 188] = st_lvstop[i]; saveBuf[i + 277] = st_others[i]; } SaveFile("config/data/STRANKING.SAV", &saveBuf, 400 * 4); }
bool Syscfg::SetDir(LPCTSTR value, bool is_push) { pugi::xml_node node; if (!is_push) node = GetNode("serve_data"); else node = GetNode("push_data"); pugi::xml_attribute attr = node.attribute("dir_name"); if (!attr) attr = node.append_attribute("dir_name"); char multi[MAX_PATH]; attr = WideToMulti(value, multi); return SaveFile(); }
void WorkspaceWork::AddTopicGroup() { String package = GetActivePackage(); if(IsNull(package)) return; Tpp dlg; dlg.Load(PackageDirectory(package)); if(dlg.Run() != IDOK) return; String g = dlg.GetName(); if(g == "app.tpp") { String h = SourcePath(package, g); RealizeDirectory(h); SaveFile(AppendFileName(h, "all.i"), ""); } if(g.GetCount()) AddItem(g, false, false); }
truth configsystem::Save() { std::ofstream SaveFile(ConfigFileName.CStr(), std::ios::out); if(!SaveFile.is_open()) return false; for(int c = 0; c < Options; ++c) { SaveFile << Option[c]->Name << " = "; Option[c]->SaveValue(SaveFile); SaveFile << ";\n"; } return true; }
/** * @brief Creates a project directory (and a project file within that directory) in the * parent directory * * Creates a project directory (and a project file within that directory) in the * parent directory. The newly created project file is opened and all ProjectFile * access functions become available. * * If a project file is already open, we first prompt the user to either save, * discard changes, or cancel creating a new project. * * @param parentDirectory The directory in which to create the project directory * @param projectName The name to give both the project directory and the project file */ bool ProjectFile::CreateProjectFile(QString parentDirectory, QString projectName) { if (!ProjectIsOpen() || WarnProjectAlreadyOpen()) { /* Move into the project directory */ /* If the directory doesn't exist, try to create it */ projectDirectory = QDir(parentDirectory); if (!projectDirectory.cd(projectName)) { if (!projectDirectory.mkdir(projectName)) { WarnFileError("Unable to create project directory"); return false; } else if (!projectDirectory.cd(projectName)) { WarnFileError("Unable to access the project directory"); return false; } } /* Make sure there isn't a project file in the directory already */ projectDirectory.setNameFilters(QStringList("*.spf")); if (!projectDirectory.entryList().isEmpty()) { WarnFileError(QString("A project file already exists at ").append(parentDirectory+projectName)); return false; } /* Create the file */ SetProjectFile(projectDirectory.absolutePath() + QDir::separator() + projectName + ".spf"); if (OpenFileWrite()) { /* Create an empty project */ CreateEmptyProject(); /* Save the project file */ SaveFile(); /* Close the project file */ CloseFile(); return true; } } return false; }
void MapDialog::OnListBox(wxCommandEvent& evt) { if (evt.GetInt() < 0) m_Filename = wxEmptyString; else m_Filename = evt.GetString(); wxDynamicCast(FindWindow(ID_MapDialogFilename), wxTextCtrl)->ChangeValue(m_Filename); if (evt.GetEventType() == wxEVT_COMMAND_LISTBOX_DOUBLECLICKED) { if (m_Type == MAPDIALOG_OPEN) OpenFile(); else SaveFile(); } }
int Syscfg::GetFPS(bool is_push /*= false*/) { pugi::xml_node node; if(!is_push) node = GetNode("serve_data"); else node = GetNode("push_data"); pugi::xml_attribute attr = node.attribute("fps"); if (!attr) { attr = node.append_attribute("fps"); attr = 25; SaveFile(); } return attr.as_int(); }
bool CodeEditor::SaveFile() { // Return if no change if (!Modified()) return true; // Get file name if (!mFileName) { wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxSAVE | wxOVERWRITE_PROMPT); if (dlg.ShowModal() != wxID_OK) return false; mFileName = dlg.GetPath(); } // Save file return SaveFile(mFileName); }