summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IvyProbe/TestParseCmdLine.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/IvyProbe/TestParseCmdLine.cpp b/IvyProbe/TestParseCmdLine.cpp
new file mode 100644
index 0000000..6b9201e
--- /dev/null
+++ b/IvyProbe/TestParseCmdLine.cpp
@@ -0,0 +1,75 @@
+// FxParseCmdLine.cpp: implementation of the FxParseCmdLine class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "NewFxServer.h"
+#include "FxParseCmdLine.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+FxParseCmdLine::FxParseCmdLine()
+{
+ m_loop = FALSE;
+ m_start = FALSE;
+ m_busstart = FALSE;
+ m_speed = 10000;
+ m_exoFile = "D:\\users\\fcolin\\DATA\\SceTobago.toc";
+ m_busNumber = "";
+}
+
+FxParseCmdLine::~FxParseCmdLine()
+{
+
+}
+
+void FxParseCmdLine::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast)
+{
+ if (bFlag)
+ {
+ ParseParamFlag(lpszParam);
+ }
+ else
+ ParseParamNotFlag(lpszParam);
+
+}
+
+void FxParseCmdLine::ParseParamFlag(LPCTSTR pszParam)
+{
+ if (lstrcmpi(pszParam, "loop") == 0)
+ m_loop = TRUE;
+ else if (lstrcmpi(pszParam, "busstart") == 0)
+ m_busstart = TRUE;
+ else if (lstrcmpi(pszParam, "start") == 0)
+ m_start = TRUE;
+ else if (lstrcmpi(pszParam, "bus") == 0)
+ m_shellCommand = BusNumber;
+ else if (lstrcmpi(pszParam, "file") == 0)
+ m_shellCommand = ExoFile;
+ else if (lstrcmpi(pszParam, "speed") == 0)
+ m_shellCommand = Speed;
+}
+
+void FxParseCmdLine::ParseParamNotFlag(LPCTSTR pszParam)
+{
+ switch ( m_shellCommand )
+ {
+ case BusNumber:
+ m_busNumber = pszParam;
+ break;
+ case ExoFile:
+ m_exoFile = pszParam;
+ break;
+ case Speed:
+ m_speed = atoi(pszParam);
+ break;
+ }
+}