+
+//=========================================================================
+void wxGUIEditorGraphicBBS::OnExportConsoleExecCommand(wxCommandEvent& event)
+{
+ wxFileDialog * saveFileDialog = new wxFileDialog(this,
+ wxT("Export console command"), wxEmptyString, wxT("ConsoleApp.txt"),
+ wxT("*.txt;*.bbs;*.bbg;*.sh;*.bat"), wxSAVE | wxOVERWRITE_PROMPT);
+
+ if (saveFileDialog->ShowModal() == wxID_OK)
+ {
+ wxString fileName = saveFileDialog->GetPath();
+ std::string filename = (const char*) (fileName.mb_str());
+ filename=CheckExtension (filename, ".txt");
+
+ ofstream file;
+ file.open(filename.c_str());
+
+ std::vector<std::string> extInputs = _tabsMgr->getActualTabPanel()->getSceneManager()->GetExternalInputsNames();
+
+ //TODO PUT IN A METHOD OF A FILES AND TEXT MANAGER CLASS !!!
+ //std::string inputsInCommentsWin="";
+ //std::string inputsInCommentsUnix="";
+ //std::string inputsInOneLineWin="";
+ std::string inputsInOneLineUnix="";
+ for (unsigned int i = 0; i < extInputs.size(); ++i)
+ {
+ /* No gusto la idea al jefe pero por si acaso ...
+ * RaC 2012 2nd HackFest
+ *
+ inputsInCommentsWin+="REM ";
+ inputsInCommentsWin+=extInputs[i];
+ inputsInCommentsWin+="=\"value\"\n";
+ inputsInCommentsUnix+="# ";
+ inputsInCommentsUnix+=extInputs[i];
+ inputsInCommentsUnix+="=\"value\"\n";
+
+ char buffer [50];
+ sprintf (buffer, "%d", (i+1));
+ inputsInOneLineWin+=extInputs[i];
+ inputsInOneLineWin+="=\"%";
+ inputsInOneLineWin+=buffer;
+ inputsInOneLineWin+="\" ";
+ */
+ inputsInOneLineUnix+=extInputs[i];
+ inputsInOneLineUnix+="=\"<value>\" ";
+
+ }
+
+
+ std::string content = "";
+ // writing file header
+ content += "# ----------------------------------\n";
+ content += "# - BBTKGEditor v ";
+ content += _currentBBGversion; //VERSION
+ content += " Console Commands to execute BBS application\n";
+ content += "# - ";
+ content += filename;
+ content += "\n";
+ content += "# ----------------------------------\n";
+ content += "\n";
+ content += "\n";
+ content += "# Command to execute bbi\n";
+ content += "bbi <bbs_path> ";
+ content += inputsInOneLineUnix;
+
+ /* No gusto la idea al jefe pero por si acaso ...
+ * RaC 2012 2nd HackFest
+ content += "# For Windows (copy the following lines to a .bat file)\n";
+ content += "REM BBS application\n";
+ content += "REM Inputs:\n";
+ content += inputsInCommentsWin;
+ content += "REM To use previous inputs, put %$inputName% in the corresponding input of the execution bbi line\n";
+ content += "bbi applicationBBS.bbs ";
+ content += inputsInOneLineWin;
+ content += "\n";
+ content += "\n";
+ content += "# For Linux or Mac (copy the following lines to a .sh file)\n";
+ content += "#!/bin/bash\n";
+ content += "# BBS application\n";
+ content += "# Inputs:\n";
+ content += inputsInCommentsUnix;
+ content += "# To use previous inputs, put $inputName in the corresponding input of the execution bbi line\n";
+ content += "bbi applicationBBS.bbs ";
+ content += inputsInOneLineUnix;
+ content += "\n";
+ */
+
+ file << content;
+ file.close();
+ }
+
+
+}
+