Command.cpp 792 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "../ToolSystem.h"
  2. #include "../Project/Project.h"
  3. #include "Command.h"
  4. namespace ToolCore
  5. {
  6. Command::Command(Context* context) : Object(context),
  7. timeOut_(0.0f)
  8. {
  9. }
  10. Command::~Command()
  11. {
  12. }
  13. bool Command::Parse(const String& command)
  14. {
  15. Vector<String> args = command.Split(' ');
  16. String errorMsg;
  17. return Parse(args, 0, errorMsg);
  18. }
  19. void Command::Error(const String& errorMsg)
  20. {
  21. VariantMap eventData;
  22. eventData[CommandError::P_MESSAGE] = errorMsg;
  23. SendEvent(E_COMMANDERROR, eventData);
  24. }
  25. void Command::Finished()
  26. {
  27. ToolSystem* tsystem = GetSubsystem<ToolSystem>();
  28. Project* project = tsystem->GetProject();
  29. if (project && project->IsDirty())
  30. project->Save(project->GetProjectFilePath());
  31. SendEvent(E_COMMANDFINISHED);
  32. }
  33. }