summaryrefslogtreecommitdiff
path: root/IvyProbe/TestParseCmdLine.cpp
blob: 6b9201ec561f8dcc8cfb0bc6ae531e08ae8cff2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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;
	}
}