ConsoleThread.cpp 824 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "ConsoleThread.h"
  2. #include <ctype.h>
  3. #include <iostream>
  4. #include <string>
  5. #include "CDI.h"
  6. #include "LocalConfig.h"
  7. #include "PacketAnalizer.h"
  8. ConsoleThread::ConsoleThread()
  9. {
  10. counter = 0;
  11. DoMLoop = false;
  12. }
  13. void ConsoleThread::RunCmdInput()
  14. {
  15. int ch = 0;
  16. string inputstr;
  17. if (cin.peek() == EOF)
  18. {
  19. return;
  20. }
  21. getline(cin, inputstr);
  22. GetCommandDispathIF()->CommandInput(inputstr.c_str());
  23. return;
  24. }
  25. ConsoleThread::~ConsoleThread()
  26. {
  27. }
  28. bool ConsoleThread::Exec()
  29. {
  30. //Sleep(3000);
  31. if (DoMLoop == false && WaitTheThreadEndSign(100) == false)
  32. {
  33. RunCmdInput();
  34. return true;
  35. }
  36. if (WaitTheThreadEndSign(100) == false)
  37. {
  38. RunCmdInput();
  39. return true;
  40. }
  41. return false;
  42. }
  43. bool ConsoleThread::OnEndThread()
  44. {
  45. return true;
  46. }
  47. bool ConsoleThread::OnStartThread()
  48. {
  49. return true;
  50. }