R
Richard Mathis
I have the following C++ code:
define MAXXPAXX 64
// Pack sub component of database struct.
typedef PREFIX_PACKED struct
{
DWORD packid;
long price;
long valPrice;
BYTE byInvIndex;
BYTE nothing; // filler to cause word alignment.
WORD numCards;
WORD packType;
} PACKED PACKENTRY;
// Database struct
typedef PREFIX_PACKED struct
{
DWORD crc32;
WORD recordType;
DWORD dateTime;
DWORD transNum;
DWORD cashierNum;
WORD posNum;
DWORD unitTicketNum;
DWORD dwSerialNum;
DWORD dwPlayerID;
DWORD voidDateTime;
// if !voidDateTime
// if DB_REC_NORM, voidReason == additinoal pack unit ID
// if DB_REC_ADDPACK voidReason == additinoal pack unit ID
// if DB_REC_ADDPACK voidCashierNum == original unitTicket
// if void ticket and is DB_REC_ADDPACK
// relink master and additionals.
// if void ticket is DB_REC_NORM and has additional packs
// All additional packs are voided.
#define unitLinkBase voidCashierNum
DWORD voidCashierNum;
#define unitLinkNext voidReason
WORD voidReason;
DWORD dwSurchargePacks;
long lSurchargePrice;
WORD numPacks;
PACKENTRY pax[MAXXPAXX];
} PACKED DBSTRUCT;
typedef DBSTRUCT FAR * LPDBSTRUCT;
While I am somewhat concerned about the keyword PACKED (does it have
any bearing to me, does it matter or can I ignore it?), my primary
concern is how to declare
PACKENTRY pax[MAXXPAXX];
in C#, as C# doesn't allow declared arrays in structs. I've been
working with something like
[MarshalAs(PACKENTRY, SizeConst=64)]
byte[] pax; But of course C# is looking for a variable instead of
PACKENTRY. Anyway, anyone have any ideas?
Thanks in advance,
define MAXXPAXX 64
// Pack sub component of database struct.
typedef PREFIX_PACKED struct
{
DWORD packid;
long price;
long valPrice;
BYTE byInvIndex;
BYTE nothing; // filler to cause word alignment.
WORD numCards;
WORD packType;
} PACKED PACKENTRY;
// Database struct
typedef PREFIX_PACKED struct
{
DWORD crc32;
WORD recordType;
DWORD dateTime;
DWORD transNum;
DWORD cashierNum;
WORD posNum;
DWORD unitTicketNum;
DWORD dwSerialNum;
DWORD dwPlayerID;
DWORD voidDateTime;
// if !voidDateTime
// if DB_REC_NORM, voidReason == additinoal pack unit ID
// if DB_REC_ADDPACK voidReason == additinoal pack unit ID
// if DB_REC_ADDPACK voidCashierNum == original unitTicket
// if void ticket and is DB_REC_ADDPACK
// relink master and additionals.
// if void ticket is DB_REC_NORM and has additional packs
// All additional packs are voided.
#define unitLinkBase voidCashierNum
DWORD voidCashierNum;
#define unitLinkNext voidReason
WORD voidReason;
DWORD dwSurchargePacks;
long lSurchargePrice;
WORD numPacks;
PACKENTRY pax[MAXXPAXX];
} PACKED DBSTRUCT;
typedef DBSTRUCT FAR * LPDBSTRUCT;
While I am somewhat concerned about the keyword PACKED (does it have
any bearing to me, does it matter or can I ignore it?), my primary
concern is how to declare
PACKENTRY pax[MAXXPAXX];
in C#, as C# doesn't allow declared arrays in structs. I've been
working with something like
[MarshalAs(PACKENTRY, SizeConst=64)]
byte[] pax; But of course C# is looking for a variable instead of
PACKENTRY. Anyway, anyone have any ideas?
Thanks in advance,