/* Create a filename and open the file, according to the specified cert, key and keyid */ BIO *GenerateFile(const char *version, unsigned int version_num, const DEFCERT_st *entry, BOOL with_pub_key, const DEFCERT_keyid_item *item) { if(!entry || entry->dercert_data == NULL) return NULL; return GenerateFile(version, version_num, "roots/", entry->dercert_data, entry->dercert_len, with_pub_key, item); }
void Log::Write(char* logline) { m_stream << logline << endl; if (m_stream.tellp() > LOG_MAX_LEN) { m_stream.close(); GenerateFile(); } }
BOOL ProduceUntrustedCertificateXML_File(const char *version, unsigned int version_num, const DEFCERT_UNTRUSTED_cert_st *item, EVP_PKEY *key, int sig_alg, BOOL include_pubkey) { if(item == NULL || item->dercert_data == NULL) return TRUE; BIO *target = NULL; BIO *target1 = NULL; BOOL ret = FALSE; do{ // Create file target = GenerateFile(version, version_num, "untrusted/", item->dercert_data, item->dercert_len, include_pubkey, NULL); if(!target) break; target1 = BIO_new(BIO_s_mem()); if(!target1) break; // header if(!BIO_puts(target, "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n")) break; // Write cert if(!ProduceUntrustedCertificateXML(target1, item, key, sig_alg)) break; if(!BIO_flush(target1)) break; unsigned char *buffer = NULL; unsigned long buffer_len =0; buffer_len = BIO_get_mem_data(target1, &buffer); if(buffer == NULL || buffer_len == 0) break; // Sign file if(!SignXMLData(target, buffer, buffer_len, key, sig_alg)) break; if(!BIO_flush(target)) break; ret = TRUE; } while(0); BIO_free(target1); BIO_free(target); target = NULL; target1 = NULL; return TRUE; }
Log::Log(char* szFilePath) { ZeroMemory(m_szFilePath,sizeof(m_szFilePath)); strcpy(m_szFilePath,szFilePath); char szCmp[2] = {0},szPath[256] = {0}; int i=1; for (;i<strlen(szFilePath);i++) { memcpy(szCmp,szFilePath+i,1); if (strcmp(szCmp,"\\") == 0) { memcpy(szPath,szFilePath,i); _mkdir(szPath); } } if (i != strlen(szFilePath)) _mkdir(m_szFilePath); GenerateFile(); }
/* Create a filename and open the file, according to the specified cert, key and keyid in a given path*/ BIO *GenerateFile(const char *version, unsigned int version_num, const char *path, const byte *dercert_data, size_t dercert_len, BOOL with_pub_key, const DEFCERT_keyid_item *item) { if(dercert_data == NULL) return NULL; BIO *ret = NULL; char *filename = NULL; do { filename = GenerateFileName(version_num, dercert_data, dercert_len, with_pub_key, item); if(filename == NULL) break; ret = GenerateFile(version, path, filename); }while(0); delete [] filename; return ret; }
bool ProjectGenerator::Make() { NGL_OUT(_T("nui project generator\n")); // create target directory nglPath targetpath = nglPath(mProjectTargetPath); if (!targetpath.Create()) { nglString msg; msg.Format(_T("creating target directory '%ls'"), targetpath.GetChars()); return MsgError(msg); } NGL_OUT(_T("nui project generator : target directory created '%ls'\n"), targetpath.GetChars()); //copy the src folder if (!CopyDirectory(targetpath + nglPath(_T("src")), mNuiTemplatePath + nglPath(_T("src")))) return false; //copy the resources folders if (!CopyDirectory(targetpath + nglPath(_T("resources")), mNuiTemplatePath + nglPath(_T("resources")))) return false; if (!CopyDirectory(targetpath + nglPath(_T("resources/css")), mNuiTemplatePath + nglPath(_T("resources/css")))) return false; if (!CopyDirectory(targetpath + nglPath(_T("resources/decorations")), mNuiTemplatePath + nglPath(_T("resources/decorations")))) return false; nglPath projpath; nglPath projectfile; nglString filename; // create xcodeproj folder if (mpCheckXcode->IsPressed()) { projpath = targetpath; nglString projfolder = mProjectName + nglString(_T(".xcodeproj")); projpath += nglPath(projfolder); if (!projpath.Create()) { nglString msg; msg.Format(_T("creating xcodeproj folder '%ls'"), projpath.GetChars()); return MsgError(msg); } NGL_OUT(_T("nui project generator : project folder created '%ls'\n"), projpath.GetChars()); // generate xcode project file projectfile = targetpath; projectfile += nglPath(projfolder); projectfile += nglPath(_T("project.pbxproj")); if (!GenerateFile(mNuiTemplatePath + nglPath(_T("TemplateApp.xcodeproj/project.pbxproj")), projectfile)) return false; } // generate visual studio 2008 project file if (mpCheckVisualStudio2008->IsPressed()) { filename = mProjectName + nglString(_T(".2008.vcproj")); projectfile = targetpath; projectfile += nglPath(filename); if (!GenerateFile(mNuiTemplatePath + nglPath(_T("TemplateApp.2008.vcproj")), projectfile)) return false; } // generate visual studio 2008 solution file if (mpCheckVisualStudio2008->IsPressed()) { filename = mProjectName + nglString(_T(".2008.sln")); projectfile = targetpath; projectfile += nglPath(filename); if (!GenerateFile(mNuiTemplatePath + nglPath(_T("TemplateApp.2008.sln")), projectfile)) return false; } // generate Info.plist if (mpCheckXcode->IsPressed()) { filename = mProjectName + nglString(_T(".plist")); projectfile = targetpath; projectfile += nglPath(filename); if (!GenerateFile(mNuiTemplatePath + nglPath(_T("TemplateApp.plist")), projectfile)) return false; } // generate iPhone Info.plist if (mpCheckXcode->IsPressed()) { filename = mProjectName + nglString(_T("-iPhone.plist")); projectfile = targetpath; projectfile += nglPath(filename); if (!GenerateFile(mNuiTemplatePath + nglPath(_T("TemplateApp-iPhone.plist")), projectfile)) return false; } // generate resource.rc filename = _T("resource.rc"); projectfile = targetpath; projectfile += nglPath(filename); if (!GenerateFile(mNuiTemplatePath + nglPath(_T("resource.rc")), projectfile)) return false; nglString msg; msg.Format(_T("nui project '%ls' successfully generated!"), mProjectName.GetChars()); nuiMessageBox* pMessageBox = new nuiMessageBox(GetMainWindow(), nglString(_T("Project Creator")), msg, eMB_OK); pMessageBox->QueryUser(); return true; }
bool ClassGenerateDialog::GenerateClass(Table* pTab, const wxString& path) { wxString hFileName = wxT(""); wxString cFileName = wxT(""); wxArrayString arrFileNames = wxStringTokenize( m_mapTemplateFiles[ m_choiceTemplates->GetStringSelection() ], wxT(";"), wxTOKEN_RET_EMPTY ); if (pTab->IsView()) { hFileName = arrFileNames[2]; cFileName = arrFileNames[3]; } else { hFileName = arrFileNames[0]; cFileName = arrFileNames[1]; } wxTextFile htmpFile(m_mgr->GetInstallDirectory() + wxT("/templates/databaselayer/") + hFileName); wxTextFile ctmpFile(m_mgr->GetInstallDirectory() + wxT("/templates/databaselayer/") + cFileName); if (!htmpFile.Open() || !ctmpFile.Open()) return false; classTableName = pTab->GetName(); classItemName = m_txPrefix->GetValue() + pTab->GetName() + m_txPostfix->GetValue(); classItemDef = wxT("__") + classItemName.Upper() + wxT("_H__"); classColName = m_txPrefix->GetValue() + pTab->GetName() + wxT("Collection")+ m_txPostfix->GetValue(); classUtilName = m_txPrefix->GetValue() + pTab->GetName() + wxT("Utils")+ m_txPostfix->GetValue(); wxString hFile; wxFileName fnHeaderFileName(path + wxT("/") + classItemName + wxT(".h")); wxString cFile; wxFileName fnCppFileName(path + wxT("/") + classItemName + wxT(".cpp")); bool suc = GenerateFile(pTab,htmpFile, hFile, classItemName, classItemDef,classColName,classTableName, classUtilName); suc &= GenerateFile(pTab, ctmpFile, cFile, classItemName, classItemDef,classColName,classTableName, classUtilName); htmpFile.Close(); ctmpFile.Close(); // format output files FormatFile( hFile ); FormatFile( cFile ); ::WriteFileWithBackup(fnCppFileName.GetFullPath(), cFile, false); ::WriteFileWithBackup(fnHeaderFileName.GetFullPath(), hFile, false); // add files to the workspace wxArrayString arrString; arrString.Add( path + wxT("/") + classItemName + wxT(".h")); arrString.Add( path + wxT("/") + classItemName + wxT(".cpp")); m_mgr->AddFilesToVirtualFolder( m_txVirtualDir->GetValue(), arrString ); // retag workspace wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, XRCID("retag_workspace") ); EventNotifier::Get()->TopFrame()->GetEventHandler()->AddPendingEvent( evt ); return suc; }