Example #1
0
static bool DoImport(const wxCmdLineParser& parser)
{
	wxString sFileName;
	if (!parser.Found(_T("f"), &sFileName))
	{
		ReportError(_T("A filename must be specified with -f"));
		return false;
	}

#if SVGDEBUG
	wxString sDebugTraceLevel;
	if (parser.Found(_T("T"), &sDebugTraceLevel))
	{
		sDebugTraceLevel.ToLong(&iDebugTraceLevel);
		fprintf(stderr, "debug trace level %ld enabled\n", iDebugTraceLevel);
	}
#endif

	// Ask the library to create a Xar Exporter object
	CXarExport* pExporter = XarLibrary::CreateExporter();
	bool bRetVal = true;

	// Call StartExport passing stdout as where to write to
	if (pExporter->StartExport())
	{
		// Call DoImportInternal to actually do the work
		if (!DoImportInternal(pExporter, sFileName))
		{
			bRetVal = false;
		}
	}
	else
	{
		ReportError(_T("StartExport failed"));
		bRetVal = false;
	}

	// Delete the exporter object to clean up
	delete pExporter;

	return bRetVal;
}
Example #2
0
bool mazeDlgApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
    if(parser.GetParamCount()<2) {
     cout << "Call Format: ./maze <maze file> <brain file>" << endl;
     exit(0);
    }

    // to get at your unnamed parameters use
    for (int i = 0; i < parser.GetParamCount(); i++)
    {
            files.Add(parser.GetParam(i));
	    cout << files[i].mb_str() << endl;
    }
 
    // and other command line parameters
 
    // then do what you need with them.
 
    return true;
}
/**
 * Loads the list(s) of files, delete the file that contains the list if the
 * <CODE>deleteTempLists</CODE> switch is activated.
 *
 * @param  parser  Command line parser.
 */
void CmdLineOptions::expandFilesList(const wxCmdLineParser& parser)
{
  wxString lists;
  if (!parser.Found(wxT("fl"), &lists))
    // No file.
    return;
  
  wxStringTokenizer tkzLists(lists, wxT("|"), wxTOKEN_STRTOK);
  while (tkzLists.HasMoreTokens())
  {
    wxString fileName = tkzLists.GetNextToken();
    if (!fileName.empty())
    {
      wxLogNull logNo;   // No log
      bool read = false; // the file has been opened and read ?

      {  // open a block to destroy the wxFileInputStream before erasing the file
        wxFileInputStream input(fileName);
        if (input.Ok())
        {
          // Reads the lines
          wxTextInputStream text(input);
          wxString line;

          line = text.ReadLine();
          while (!input.Eof())
          {
            line.Strip(wxString::both);
            if (!line.empty())
              files.Add(line);
            line = text.ReadLine();
          }
          read = true;
        }
      }

      if (read && deleteTempLists)
      {
        // Checks if the read file has the extension of the temp file.
        wxString ext;
        wxFileName::SplitPath(fileName, NULL, NULL, NULL, &ext);
        wxString tmpExts = wxConfig::Get()->Read(_T("Files/TempExts"), _T("tmp temp"));
        wxStringTokenizer tkz(tmpExts, wxT(" \t\r\n"), wxTOKEN_STRTOK);
        bool found = false;
        while (!found && tkz.HasMoreTokens())
          if (::compareFileName(tkz.GetNextToken(), ext) == 0)
            found = true;
          
        if (found)
          ::wxRemoveFile(fileName);
      }
    }
  }
}
Example #4
0
bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
    if ( !wxApp::OnCmdLineParsed(parser) )
        return false;

    if ( parser.GetParamCount() )
    {
        const wxString loc = parser.GetParam();
        const wxLanguageInfo * const lang = wxLocale::FindLanguageInfo(loc);
        if ( !lang )
        {
            wxLogError(_("Locale \"%s\" is unknown."), loc);
            return false;
        }

        m_lang = static_cast<wxLanguage>(lang->Language);
    }

    return true;
}
Example #5
0
bool CodeLiteApp::IsSingleInstance(const wxCmdLineParser& parser)
{
    // check for single instance
    if(clConfig::Get().Read(kConfigSingleInstance, false)) {
        wxString name = wxString::Format(wxT("CodeLite-%s"), wxGetUserId().c_str());
        
        wxString path;
#ifndef __WXMSW__
        path = "/tmp";
#endif
        m_singleInstance = new wxSingleInstanceChecker(name, path);
        if(m_singleInstance->IsAnotherRunning()) {
            // prepare commands file for the running instance
            wxArrayString files;
            for(size_t i = 0; i < parser.GetParamCount(); i++) {
                wxString argument = parser.GetParam(i);

                // convert to full path and open it
                wxFileName fn(argument);
                fn.MakeAbsolute();
                files.Add(fn.GetFullPath());
            }

            try {
                // Send the request
                clSocketClient client;
                bool dummy;
                client.ConnectRemote("127.0.0.1", SINGLE_INSTANCE_PORT, dummy);

                JSONRoot json(cJSON_Object);
                json.toElement().addProperty("args", files);
                client.WriteMessage(json.toElement().format());
                return false;

            } catch(clSocketException& e) {
                CL_ERROR("Failed to send single instance request: %s", e.what());
            }
        }
    }
    return true;
}
Example #6
0
bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser )
{
	wxString dest;

	if (parser.Found( L"cfgpath", &dest ) && !dest.IsEmpty())
	{
		Console.Warning( L"Config path override: " + dest );
		Overrides.SettingsFolder = dest;
	}

	if (parser.Found( L"cfg", &dest ) && !dest.IsEmpty())
	{
		Console.Warning( L"Config file override: " + dest );
		Overrides.VmSettingsFile = dest;
	}

	Overrides.DisableSpeedhacks = parser.Found(L"nohacks");

	if (parser.Found(L"gamefixes", &dest))
	{
		Overrides.ApplyCustomGamefixes = true;
		Overrides.Gamefixes.Set( dest, true );
	}

	if (parser.Found(L"fullscreen"))	Overrides.GsWindowMode = GsWinMode_Fullscreen;
	if (parser.Found(L"windowed"))		Overrides.GsWindowMode = GsWinMode_Windowed;

	const PluginInfo* pi = tbl_PluginInfo; do
	{
		if( !parser.Found( pi->GetShortname().Lower(), &dest ) ) continue;

		if( wxFileExists( dest ) )
			Console.Warning( pi->GetShortname() + L" override: " + dest );
		else
		{
			wxDialogWithHelpers okcan( NULL, AddAppName(_("Plugin Override Error - %s")) );

			okcan += okcan.Heading( wxsFormat(
				_("%s Plugin Override Error!  The following file does not exist or is not a valid %s plugin:\n\n"),
				pi->GetShortname().c_str(), pi->GetShortname().c_str()
			) );

			okcan += okcan.GetCharHeight();
			okcan += okcan.Text(dest);
			okcan += okcan.GetCharHeight();
			okcan += okcan.Heading(AddAppName(_("Press OK to use the default configured plugin, or Cancel to close %s.")));

			if( wxID_CANCEL == pxIssueConfirmation( okcan, MsgButtons().OKCancel() ) ) return false;
		}
		
		Overrides.Filenames.Plugins[pi->id] = dest;

	} while( ++pi, pi->shortname != NULL );
	
	return true;
}
Example #7
0
bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
    wxString *confName = new wxString;
    if (parser.Found("c",confName)) {
        if (confName) {
            config.setConfigName(confName->ToStdString());
        }
    }
    
    config.load();

    return true;
}
Example #8
0
void UpdaterApp::OnInitCmdLine(wxCmdLineParser& parser)
{
    #ifndef HAVE_WX29
        #define STR _T
    #else
        #define STR
    #endif

    wxCmdLineEntryDesc cmdLineDesc[] =
    {
		{ wxCMD_LINE_SWITCH, STR("h"), STR("help"), _("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
		{ wxCMD_LINE_OPTION, STR("f"), STR("target-exe"),  _("the SpringLobby executeable to be updated"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR },
		{ wxCMD_LINE_OPTION, STR("r"), STR("target-rev"),  _("the SpringLobby revision to update to"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR },
		{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 }//while this throws warnings, it is mandatory according to http://docs.wxwidgets.org/stable/wx_wxcmdlineparser.html
    };

    parser.SetDesc( cmdLineDesc );
    parser.SetSwitchChars (_T("-"));

    #undef STR
}
bool MainApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
    mStartHidden = false;

    mBatchMode = parser.Found(wxT("b"));

    mEnableAppProfiles = parser.Found(wxT("a"));

    if (mBatchMode || mEnableAppProfiles)
    {
	mStartHidden = true;
    }

    if (!parser.Found(wxT("c"), &mColorTemp))
    {
	mColorTemp = 0;	
    }
    else
    {
	mStartHidden = true;
    }

    if (!parser.Found(wxT("i"), &mGPUIndex))
    {
	mGPUIndex = 0;
    }

    if (parser.GetParamCount() > 0)
    {
        mProfileName = parser.GetParam(0);
	mStartHidden = true;
    }

    return true;
}
Example #10
0
bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	s_bDoVerbose = parser.Found(_T("v"));

	if (!parser.Found(_T("f"), &m_sOutFile))
	{
		ReportError(_T("A filename must be specified with -f"));
		return false;
	}

	if (!parser.Found(_T("x"), &m_sXMLFile))
	{
		ReportError(_T("An XML filename must be specified with -x"));
		return false;
	}
	if (!parser.Found(_T("i")) && !parser.Found(_T("e")))
	{
		ReportError(_T("An action must be specified with -i or -e"));
		return false;
	}
	m_bDoExport = parser.Found(_T("e"));

	// Open the output file for writing
	wxFileOutputStream OutFile(m_sXMLFile);
	if (!OutFile.Ok())
	{
		ReportError(_T("Failed to open output XML file."));
		// Set an appropriate error here
		return false;
	}
	wxTextOutputStream OutText(OutFile);

	OutText << _T("<XPFilterConfig>\n");
	OutText << _T("<Private ");

	m_bCancelled = false;
	if (m_bDoExport) {
		SVGExportDialog *dlg = new SVGExportDialog(NULL);
		if (dlg->ShowModal() != wxID_OK) {
			// user cancelled export
			m_bCancelled = true;
		} else {
			// output exporter settings
			if (dlg->m_SVGVersionComboBox->GetSelection() == 0)
				OutText << _T("version=\"1.1\" ");
			else
				OutText << _T("version=\"1.2\" ");
			if (dlg->m_VerboseCheckBox->IsChecked())
				OutText << _T("verbose=\"1\" ");
			else
				OutText << _T("verbose=\"0\" ");
		}
		dlg->Destroy();
	}
	OutText << _T("/>\n");
	OutText << _T("</XPFilterConfig>\n");

    return true;
}
Example #11
0
bool wxAppConsoleBase::OnCmdLineParsed(wxCmdLineParser& parser)
{
#if wxUSE_LOG
    if ( parser.Found(OPTION_VERBOSE) )
    {
        wxLog::SetVerbose(true);
    }
#else
    wxUnusedVar(parser);
#endif // wxUSE_LOG

    return true;
}
bool CTimerControlApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	if (!wxApp::OnCmdLineParsed(parser))
		return false;

	m_nolog = parser.Found(NOLOGGING_SWITCH);

	wxString logDir;
	bool found = parser.Found(LOGDIR_OPTION, &logDir);
	if (found)
		m_logDir = logDir;

	wxString confDir;
	found = parser.Found(CONFDIR_OPTION, &confDir);
	if (found)
		m_confDir = confDir;

	if (parser.GetParamCount() > 0U)
		m_name = parser.GetParam(0U);

	return true;
}
Example #13
0
bool CodeLiteApp::IsSingleInstance(const wxCmdLineParser &parser, const wxString &curdir)
{
    // check for single instance
    if ( clConfig::Get().Read("SingleInstance", false) ) {
        const wxString name = wxString::Format(wxT("CodeLite-%s"), wxGetUserId().c_str());

        m_singleInstance = new wxSingleInstanceChecker(name);
        if (m_singleInstance->IsAnotherRunning()) {
            // prepare commands file for the running instance
            wxString files;
            for (size_t i=0; i< parser.GetParamCount(); i++) {
                wxString argument = parser.GetParam(i);

                //convert to full path and open it
                wxFileName fn(argument);
                fn.MakeAbsolute(curdir);
                files << fn.GetFullPath() << wxT("\n");
            }

            if (files.IsEmpty() == false) {
                Mkdir(ManagerST::Get()->GetStarupDirectory() + wxT("/ipc"));

                wxString file_name, tmp_file;
                tmp_file 	<< ManagerST::Get()->GetStarupDirectory()
                            << wxT("/ipc/command.msg.tmp");

                file_name 	<< ManagerST::Get()->GetStarupDirectory()
                            << wxT("/ipc/command.msg");

                // write the content to a temporary file, once completed,
                // rename the file to the actual file name
                WriteFileUTF8(tmp_file, files);
                wxRenameFile(tmp_file, file_name);
            }
            return false;
        }
    }
    return true;
}
Example #14
0
void mainApp::OnInitCmdLine (wxCmdLineParser &parser) 
{
  static const wxCmdLineEntryDesc cmdLineDesc[] =
  {    
    { wxCMD_LINE_PARAM,  NULL, NULL, "input-file", 
      wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
    { wxCMD_LINE_OPTION,  "verbose" ,"verbose",NULL,
      wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
    { wxCMD_LINE_NONE }
  };
  parser.SetDesc(cmdLineDesc);
  return;
}
Example #15
0
bool CamulecmdApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	m_HasCmdOnCmdLine = parser.Found(wxT("command"), &m_CmdString);
	if (m_CmdString.Lower().StartsWith(wxT("help")))
	{
		OnInitCommandSet();
		printf("%s %s\n", m_appname, (const char *)unicode2char(GetMuleVersion()));
		Parse_Command(m_CmdString);
		exit(0);
	}
	m_interactive = !m_HasCmdOnCmdLine;
	return CaMuleExternalConnector::OnCmdLineParsed(parser);
}
Example #16
0
    virtual void OnInitCmdLine(wxCmdLineParser& parser)
    {
        static const wxCmdLineEntryDesc desc[] =
        {
            { wxCMD_LINE_OPTION, "m", "map-mode", "", wxCMD_LINE_VAL_NUMBER },
            { wxCMD_LINE_OPTION, "p", "pen-width", "", wxCMD_LINE_VAL_NUMBER },
            { wxCMD_LINE_OPTION, "w", "width", "", wxCMD_LINE_VAL_NUMBER },
            { wxCMD_LINE_OPTION, "h", "height", "", wxCMD_LINE_VAL_NUMBER },
            { wxCMD_LINE_OPTION, "L", "lines", "", wxCMD_LINE_VAL_NUMBER },
        };

        parser.SetDesc(desc);
    }
Example #17
0
void
Client::OnInitCmdLine(wxCmdLineParser& pParser)
{
    wxApp::OnInitCmdLine(pParser);
    pParser.AddSwitch(wxT("e"),wxT("event"),_("Use event based worker (default)"),wxCMD_LINE_PARAM_OPTIONAL);
    pParser.AddSwitch(wxT("t"),wxT("thread"),_("Use thread based worker"),wxCMD_LINE_PARAM_OPTIONAL);
    pParser.AddSwitch(wxT("r"),wxT("random"),_("Send radnom data (default)"),wxCMD_LINE_PARAM_OPTIONAL);
    pParser.AddOption(wxT("m"),wxT("message"),_("Send message from <str>"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL);
    pParser.AddOption(wxT("f"),wxT("file"),_("Send contents of <file>"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL);
    pParser.AddOption(wxT("H"),wxT("hostname"),_("IP or name of host to connect to"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL);
    pParser.AddOption(wxT("s"),wxT("stress"),_("stress test with <num> concurrent connections"),wxCMD_LINE_VAL_NUMBER,wxCMD_LINE_PARAM_OPTIONAL);
}
/**
 * Initializes the options.
 *
 * Should be called at the application startup.
 *
 * param  parser  Command line parser.
 * @return <CODE>true</CODE> if the passed commands are corrects,
 *         <CODE>false</CODE> otherwise.
 */
bool CmdLineOptions::init(const wxCmdLineParser& parser)
{
  msgOut = wxMessageOutput::Get();
  wxString str;

  action = aNone;
  createType = cftNone;
  deleteTempLists = false;
  files.Clear();
  checksumsFileName.Clear();

  if (parser.Found(wxT("V")))
  {
    msgOut->Printf(wxT("%s"), ::getAppName().c_str());
    return false;
  }

  // Get the list of files.
  size_t paramCount = parser.GetParamCount();
  for (size_t i = 0; i < paramCount; i++)
    files.Add(parser.GetParam(i));

  // Expand the list of names of files.
  deleteTempLists = parser.Found(wxT("delete-temp-list"));
  expandFilesList(parser);

  // Checks for incompatibles switchs and/or options and/or number of given
  // files. Checks the validity of the given options.
  if (!checkVerifySwitch(parser) || !checkCreateOption(parser) ||
      !checkAppendOption(parser) || !checkCreateTypeOption(parser))
    return false;

  // If no action has been set, checks if a checksums' file must be opened.
  if (!checkOpenChecksumsFile(parser))
    return false;

  return true;
}
Example #19
0
static bool DoExport(const wxCmdLineParser& parser)
{
	wxString sFileName;
	if (!parser.Found(_T("f"), &sFileName))
	{
		ReportError(_T("A filename must be specified with -f"));
		return false;
	}

	wxString sXMLFileName;
	if (!parser.Found(_T("x"), &sXMLFileName))
	{
		ReportError(_T("An XML filename must be specified with -x"));
		return false;
	}

	// First we ask the library to create a Xar importer
	CXarImport* pImporter = XarLibrary::CreateImporter();
	bool bRetVal = true;

	// Call PrepareImport passing stdin as the source
	if (pImporter->PrepareImport())
	{
		if (!DoExportInternal(pImporter, sFileName, sXMLFileName, s_bDoCompress))
		{
			bRetVal = false;
		}
	}
	else
	{
		ReportError(_T("PrepareImport failed"));
		bRetVal = false;
	}

	delete pImporter;

	return bRetVal;
}
Example #20
0
//! @brief parses the command line
bool UpdaterApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	if ( parser.Found(_T("help")) )
		return false; // not a syntax error, but program should stop if user asked for command line usage
	m_paramcount = parser.GetParamCount();
	if (m_paramcount == 2) {
		m_source_dir = parser.GetParam(0);
		m_destination_dir = parser.GetParam(1);
		return true;
	}
	if (m_paramcount == 5) {
		if (!parser.GetParam(0).ToLong(&m_pid)) {
			ErrorMsgBox(_T("Invalid pid %s") + parser.GetParam(0));
			return false;
		}
		m_springlobby_exe = parser.GetParam(1);
		m_updater_exe = parser.GetParam(2);
		m_source_dir = parser.GetParam(3);
		m_destination_dir = parser.GetParam(4);
		return true;
	}
	return false;
}
Example #21
0
bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	// ignore auto-update function
	if(parser.Found(wxT("n"))) autoUpdateEnabled=false;
	if(parser.Found(wxT("f"))) enforceUpdate=true;
	

#if wxCHECK_VERSION(2, 9, 0)
	// special mode: put our hash into the clipboard
	if(parser.Found(wxT("d")))
	{
		if (wxTheClipboard->Open())
		{
			wxString txt = ConfigManager::getExecutablePath() + wxT(" ") + conv(ConfigManager::getOwnHash()) + wxT(" ") + wxT(__TIME__) + wxT(" ") + wxT(__DATE__);
			wxTheClipboard->SetData(new wxTextDataObject(txt));
			wxTheClipboard->Flush();
			wxTheClipboard->Close();
		}
		exit(0);
	}
#endif
    return true;
}
Example #22
0
bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
    int numModeOptions = 0;

#if wxUSE_MDI_ARCHITECTURE
    if ( parser.Found(CmdLineOption::MDI) )
    {
        m_mode = Mode_MDI;
        numModeOptions++;
    }
#endif // wxUSE_MDI_ARCHITECTURE

    if ( parser.Found(CmdLineOption::SDI) )
    {
        m_mode = Mode_SDI;
        numModeOptions++;
    }

    if ( parser.Found(CmdLineOption::SINGLE) )
    {
        m_mode = Mode_Single;
        numModeOptions++;
    }

    if ( numModeOptions > 1 )
    {
        wxLogError("Only a single option choosing the mode can be given.");
        return false;
    }

    // save any files given on the command line: we'll open them in OnInit()
    // later, after creating the frame
    for ( size_t i = 0; i != parser.GetParamCount(); ++i )
        m_filesFromCmdLine.push_back(parser.GetParam(i));

    return wxApp::OnCmdLineParsed(parser);
}
Example #23
0
bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser)
{
#ifdef __WXUNIVERSAL__
    wxString themeName;
    if ( parser.Found(OPTION_THEME, &themeName) )
    {
        wxTheme *theme = wxTheme::Create(themeName);
        if ( !theme )
        {
            wxLogError(_("Unsupported theme '%s'."), themeName.c_str());
            return false;
        }

        // Delete the defaultly created theme and set the new theme.
        delete wxTheme::Get();
        wxTheme::Set(theme);
    }
#endif // __WXUNIVERSAL__

#if defined(__WXMGL__)
    wxString modeDesc;
    if ( parser.Found(OPTION_MODE, &modeDesc) )
    {
        unsigned w, h, bpp;
        if ( wxSscanf(modeDesc.c_str(), wxT("%ux%u-%u"), &w, &h, &bpp) != 3 )
        {
            wxLogError(_("Invalid display mode specification '%s'."), modeDesc.c_str());
            return false;
        }

        if ( !SetDisplayMode(wxVideoMode(w, h, bpp)) )
            return false;
    }
#endif // __WXMGL__

    return wxAppConsole::OnCmdLineParsed(parser);
}
Example #24
0
void Rpcs3App::OnArguments(const wxCmdLineParser& parser)
{
	// Usage:
	//   rpcs3-*.exe               Initializes RPCS3
	//   rpcs3-*.exe [(S)ELF]      Initializes RPCS3, then loads and runs the specified (S)ELF file.

	if (parser.FoundSwitch("t"))
	{
		HLEExitOnStop = rpcs3::config.misc.exit_on_stop.value();
		rpcs3::config.misc.exit_on_stop = true;
		if (parser.GetParamCount() != 1)
		{
			wxLogDebug(wxT("A (S)ELF file needs to be given in test mode, exiting."));
			this->Exit();
		}
	}
	
	if (parser.GetParamCount() > 0)
	{
		Emu.SetPath(fmt::ToUTF8(parser.GetParam(0)));
		Emu.Load();
		Emu.Run();
	}
}
Example #25
0
static bool DoPrepareExport(const wxCmdLineParser& parser)
{
	wxString sFileName;
	if (!parser.Found(_T("f"), &sFileName))
	{
		ReportError(_T("A filename must be specified with -f"));
		return false;
	}

	wxString sXMLFileName;
	if (!parser.Found(_T("x"), &sXMLFileName))
	{
		ReportError(_T("An XML filename must be specified with -x"));
		return false;
	}

	// This need extending to handle the XML passing
	if (!DoPrepareExportInternal(sFileName, sXMLFileName))
	{
		return false;
	}

	return true;
}
Example #26
0
	bool MutApp::OnCmdLineParsed(wxCmdLineParser&  parser) {
		if (!wxApp::OnCmdLineParsed(parser)) return false;
#ifdef DEBUG
		debugFlags::ProcessCommandLine(parser);
#endif
		wxString str;
		int count = parser.GetParamCount();
		for (int i = 0; i<count;i++)
		{
			// we have a document to open
			str = parser.GetParam(i);
			DEBUGLOG(always,_T("cmd line param: %s\n"), WXSTRINGCAST(str));
			// this will probably see if the file exists, and has the right extension

//		MutFrame * frame = CreateMainFrame(EditorMenu);
//		frame->OpenFile(str);

			if (document_manager)
				document_manager->CreateDocument(str, wxDOC_SILENT);
		}

		DEBUGLOG (other, _T("Command line parsed."));
		return true;
	}
Example #27
0
void MyApp::OnInitCmdLine(wxCmdLineParser& parser)
{
	static const wxCmdLineEntryDesc cmdLineDesc[] =
	{
		{ wxCMD_LINE_SWITCH, _T("h"), _T("help"),	 _T("show this help message"),
			wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
		{ wxCMD_LINE_SWITCH, _T("v"), _T("verbose"), _T("be verbose") },
		{ wxCMD_LINE_OPTION, _T("f"), _T("file"),	 _T("output filename") },
		{ wxCMD_LINE_OPTION, _T("x"), _T("xmlfile"), _T("xml configuration filename") },
		{ wxCMD_LINE_SWITCH, _T("i"), _T("import"),	 _T("specify import action") },
		{ wxCMD_LINE_SWITCH, _T("e"), _T("export"),  _T("specify export action") },
		{ wxCMD_LINE_NONE }
	};

	parser.SetDesc(cmdLineDesc);
}
Example #28
0
static bool DoCanImport(const wxCmdLineParser& parser)
{
	wxString sFileName;
	if (!parser.Found(_T("f"), &sFileName))
	{
		ReportError(_T("A filename must be specified with -f"));
		return false;
	}

	if (!DoCanImportInternal(sFileName))
	{
		return false;
	}

	return true;
}
Example #29
0
	void MutApp::OnInitCmdLine(wxCmdLineParser&  parser) {
		const wxCmdLineEntryDesc cmdLineDesc[] = {
			{ wxCMD_LINE_PARAM,  NULL, NULL, _("logic file"), 
			  wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE|wxCMD_LINE_PARAM_OPTIONAL },
			{ wxCMD_LINE_NONE }
		};

		wxApp::OnInitCmdLine(parser);
		parser.SetDesc(cmdLineDesc);

#ifdef DEBUG
		debugFlags::InitCommandLine(parser);
#endif

	
	}
Example #30
0
void wxGISServerApp::OnInitCmdLine(wxCmdLineParser& pParser)
{
    wxAppConsole::OnInitCmdLine(pParser);
    pParser.AddSwitch(wxT( "v" ), wxT( "version" ),     _( "The version of this program" ));
    pParser.AddSwitch(wxT( "i" ), wxT( "install" ),     _( "Install wxGIS Server as service" ));
    pParser.AddSwitch(wxT( "r" ), wxT( "run" ),         _( "Run the wxGIS Server in standalone mode. Press 'q' to quit." ));
    pParser.AddSwitch(wxT( "u" ), wxT( "uninstall" ),   _( "Uninstall wxGIS Server service" ));
    pParser.AddSwitch(wxT( "s" ), wxT( "start" ),       _( "Start wxGIS Server service" ));

    pParser.SetLogo(wxString::Format(_("The wxGIS Server (%s)\nAuthor: Bishop (aka Barishnikov Dmitriy), polimax@mail.ru\nCopyright (c) 2010-%d"), wxString(wxGIS_VERSION_NUM_DOT_STRING_T).c_str(), __YEAR__));
}