void SourceTASReader::ParseProps() { while (ParseLine()) { if (IsFramesLine() || IsVarsLine()) { break; } ParseProp(); } }
void mbCmdSandbox::Execute(mbCommands& stack) { MB_CMD_GUARD_OPT; wxString id = ParseProp(wxT("Id")); PrintExecute(stack, wxT("%s"), id.c_str() ); GmbSandbox().Add(id); MB_CMD_UNGUARD_OPT; }
void mbCmdDirEmpty::Execute(mbCommands& stack) { MB_CMD_GUARD_OPT; wxString id = ParseProp(wxT("Id")); PrintExecute(stack, wxT("%s"), id.c_str() ); if( wxDirExists(id) && (wxDir(id).HasFiles() || wxDir(id).HasSubDirs()) && !optional ) ThrowError(wxT("Failed: %s"), id.c_str() ); MB_CMD_UNGUARD_OPT; }
void mbCmdSetCurrentDir::Execute(mbCommands& stack) { MB_CMD_GUARD_OPT; wxString id = ParseProp(wxT("Id"), false); PrintExecute(stack, wxT("%s"), id.c_str() ); if( !wxSetWorkingDirectory(id) ) ThrowError(wxT("Failed to set CWD to: %s"), id.c_str() ); MB_CMD_UNGUARD_OPT; }
void mbCmdDirRemove::Execute(mbCommands& stack) { MB_CMD_GUARD_OPT; wxString id = ParseProp(wxT("Id"), false); PrintExecute(stack, wxT("%s"), id.c_str() ); GmbSandbox().Validate(id); if( !wxFileName::Rmdir(id) && !optional ) ThrowError(wxT("Failed: %s"), id.c_str() ); MB_CMD_UNGUARD_OPT; }
void mbCmdDirRename::Execute(mbCommands& stack) { MB_CMD_GUARD_OPT; wxString from = ParseProp(wxT("From")); wxString to = ParseProp(wxT("To")); wxString file = ParseProp(wxT("File"), true); bool overwrite = ParseBool(wxT("Overwrite"), true); if( !file.empty() ) { from += file; to += file; } PrintExecute(stack, wxT("%s >> %s"), from.c_str(), to.c_str() ); GmbSandbox().Validate(to); GmbSandbox().Validate(from); if( !wxRenameFile(from, to, overwrite) && !optional ) ThrowError(wxT("Failed: %s >> %s"), from.c_str(), to.c_str() ); MB_CMD_UNGUARD_OPT; }
void mbCmdDirMake::Execute(mbCommands& stack) { MB_CMD_GUARD_OPT; wxString id = ParseProp(wxT("Id")); PrintExecute(stack, wxT("%s"), id.c_str()); GmbSandbox().Validate(id); if( !wxDirExists(id) ) { if( !wxMkdir(id) && !optional ) ThrowError(wxT("Failed: %s"), id.c_str()); } MB_CMD_UNGUARD_OPT; }
void mbCmdDirExists::Execute(mbCommands& stack) { MB_CMD_GUARD_OPT; wxString id = ParseProp(wxT("Id")); PrintExecute(stack, wxT("%s"), id.c_str() ); if( wxDirExists(id) ) { // Execute children ExecuteChildren(stack); } else if( !optional ) { ThrowError(wxT("Failed: %s"), id.c_str() ); } MB_CMD_UNGUARD_OPT; }
void mbCmdForEachDir::Execute(mbCommands& stack) { mbDirTraverser traverser; wxString idref; MB_CMD_GUARD_OPT; bool hidden = ParseBool(wxT("Hidden"), true, wxT("yes")); bool recurse = ParseBool(wxT("Recurse"), true); bool reverse = ParseBool(wxT("Reverse"), true); wxString id = ParseProp(wxT("Id"), true, wxT("ForEach")); wxString path = ParseProp(wxT("Path"), false); wxString flagstr; int flags = 0; if( hidden ) { flags |= wxDIR_HIDDEN; flagstr += wxT("Hidden "); } if( recurse ) { flags |= wxDIR_DIRS; flagstr += wxT("Recurse "); } if( reverse ) { flagstr += wxT("Reverse "); } wxFileName fname = wxFileName(path); wxString filespec = fname.GetFullName(); PrintExecute(stack, wxT("%s %s %s"), fname.GetPathWithSep().c_str(), filespec.c_str(), flagstr.c_str() ); traverser = mbDirTraverser::Init( fname.GetPathWithSep(), filespec, flags, reverse ); idref = id; // Optional parameter does not affect ForEachFile child elements so stop here MB_CMD_UNGUARD_OPT; for( mbDirTraverser ft=traverser; ft; ++ft ) { GmbVariables().PushLocal(GetDebugId(&stack), idref, ft.GetPath() ); for( mbCommands::iterator it=m_commands.begin(); it!=m_commands.end(); ++it ) { // Special Ignore elements if( wxString(wxT("Ignore")).IsSameAs((*it)->GetName()) ) { // Parse ignore mask, if matches current file then skip to next file if( wxMatchWild((*it)->ParseProp(wxT("Id"), false), ft.GetPath(), false) ) break; } else { // Execute other children elements normally mbCmd::StaticExecute(stack, *it); } } GmbVariables().PopLocal(GetDebugId(&stack)); } }