void SyntaxHighlightDlg::OnExport(wxCommandEvent& event) { // Get list of choices wxArrayString lexers = ColoursAndFontsManager::Get().GetAllLexersNames(); wxArrayInt choices; if(::wxGetSelectedChoices(choices, _("Select which lexers you wish to export"), _("Export Lexers"), lexers, this) == wxNOT_FOUND) { return; } // Select the 'save' path wxString path = ::wxFileSelector( _("Save as"), "", "MySettings.zip", "", wxFileSelectorDefaultWildcardStr, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if(path.IsEmpty()) return; clZipWriter zw(path); for(size_t i = 0; i < choices.GetCount(); ++i) { wxString file; file << "lexer_" << lexers.Item(choices.Item(i)).Lower() << "_*.xml"; zw.AddDirectory(clStandardPaths::Get().GetUserLexersDir(), file); } zw.Close(); ::wxMessageBox(_("Settings have been saved into:\n") + zw.GetFilename().GetFullPath()); }
void SyntaxHighlightDlg::OnExportAll(wxCommandEvent& event) { // Get list of choices wxArrayString lexers = ColoursAndFontsManager::Get().GetAllLexersNames(); // Select the 'save' path wxString path = ::wxFileSelector( _("Save as"), "", "MySettings.zip", "", wxFileSelectorDefaultWildcardStr, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if(path.IsEmpty()) return; clZipWriter zw(path); zw.AddDirectory(clStandardPaths::Get().GetUserLexersDir(), "lexer_*.xml"); zw.Close(); ::wxMessageBox(_("Settings have been saved into:\n") + zw.GetFilename().GetFullPath()); }
void ImageController::Replace(const std::wstring& sNewImage) { ::DeleteFile(m_sImageZipFile.c_str()); std::string sCheckSum = CStdStringA(CMD5Checksum::GetMD5(CStdString(sNewImage).c_str())); std::wstring sCheckSumFile = sNewImage + L".checksum"; std::ofstream oFile(CStdStringA(sCheckSumFile), std::ios::out | std::ios::trunc); oFile << sCheckSum; oFile.close(); ZipWrapper zw(m_sImageZipFile); zw.AddFileToZip(sNewImage); zw.AddFileToZip(sCheckSumFile); }