DLCardToolDlg.h
3.02 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// DLCardToolDlg.h : 头文件
//
#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "password_machine.h"
#include "DLConfig.h"
enum LOG_TYPE
{
LOG_TRACE = 0,
LOG_ERROR
};
enum KEY_TYPE
{
KT_DCCK = 0,
KT_DEAK,
KT_DAMK,
KT_DACK,
};
enum ENCRYPT_TYPE
{
ET_PWM = 0, //加密机加密
ET_DES, //软加密
ET_NO, //未加密
ET_UNKNOWN //未知加密状态
};
typedef struct CARD_STATE_INFO
{
bool bAlreadyUpdate;
CARD_STATE_INFO()
{
bAlreadyUpdate = false;
}
CARD_STATE_INFO& operator= (const CARD_STATE_INFO stuSD)
{
this->bAlreadyUpdate = stuSD.bAlreadyUpdate;
return *this;
}
}CardStateInfo;
typedef struct CARD_BASIC_INFO
{
std::string sCardNum;
std::string sCardOldSn; //沈阳老卡写在05文件中的sn号
CARD_BASIC_INFO& operator= (const CARD_BASIC_INFO stuSD)
{
this->sCardNum = stuSD.sCardNum;
this->sCardOldSn = stuSD.sCardOldSn;
return *this;
}
}BasicInfo;
// CDLCardToolDlg 对话框
class CDLCardToolDlg : public CDialogEx
{
class UpdataBtn : public CButton
{
private:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
void DrawFilledRect(CDC* dc, CRect rc, COLORREF color);
void DrawButtonText(CDC* dc, CRect rc, CString caption, COLORREF textcolor);
};
// 构造
public:
CDLCardToolDlg(CWnd* pParent = NULL); // 标准构造函数
// 对话框数据
enum { IDD = IDD_DLCARDTOOL_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
private:
void SetMsgLog(CString sText, LOG_TYPE emLogType = LOG_TRACE, int iErrorCode = 0);
CardStateInfo CheckCardState(BasicInfo biCardInfo);
CardStateInfo ReadJson(CString sResponseBody);
void GetMainKey(bool bUsePWM, std::string sSN, std::string &sDCCK);
BasicInfo ReadBasicInfo();
std::string CalculateKey(BasicInfo biCardBasicInfo, KEY_TYPE ktKeyType, int iEncryptType);
void InstallKey(std::string sDir, std::string sNewKey, std::string sMainKey, KEY_TYPE ktKeyType, int iKeyID);
void WriteData(std::string sDir, int iFileID, int iOffest, int iLen, std::string sKey, std::string sData);
void ResizeCtrl();
void SetCtrlText();
void SetCtrlFont();
void SetCtrlImg();
void SetResultTest(CString sTitle, CString sText);
public:
afx_msg void OnBnClickedButtonCardupdate();
private:
CStatic m_cExplain;
CStatic m_cExplain1;
CStatic m_cExplain2;
CStatic m_cExplain3;
CStatic m_cExplain4;
CStatic m_cExplain5;
CStatic m_cExplain6;
CStatic m_cExplain7;
CStatic m_cExplain8;
CStatic m_cExplain9;
CStatic m_cExplain10;
CStatic m_cExplain11;
UpdataBtn m_cUpdateButton;
CStatic m_cResult;
CStatic m_cResultText;
CStatic m_cResultText2;
CStatic m_cStaticImg;
PWDMachine m_cPWDMachine;
CDLConfig m_cConfig;
private:
CStatic m_cStaticCardNum;
CStatic m_cStaticCardNumText;
CFont m_cFontBig;
CFont m_cFontSmall;
CImage m_cImg;
CPen m_cPen;
public:
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
private:
bool m_bSetRed;
};