mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2026-07-14 22:55:32 +08:00
Refactor(Replace isKeyA with KeyType)
This commit is contained in:
+9
-9
@@ -282,7 +282,7 @@ void Mifare::readAll()
|
||||
if(result.indexOf("isOk:01") != -1)
|
||||
{
|
||||
keyBList->replace(i, tmpKey);
|
||||
data_syncWithKeyWidget(false, i, false);
|
||||
data_syncWithKeyWidget(false, i, KEY_B);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -407,8 +407,8 @@ void Mifare::readAllC()
|
||||
}
|
||||
keyAList->replace(i, dataList->at(cardType.blks[i] + cardType.blk[i] - 1).left(12));
|
||||
keyBList->replace(i, dataList->at(cardType.blks[i] + cardType.blk[i] - 1).right(12));
|
||||
data_syncWithKeyWidget(false, i, true);
|
||||
data_syncWithKeyWidget(false, i, false);
|
||||
data_syncWithKeyWidget(false, i, KEY_A);
|
||||
data_syncWithKeyWidget(false, i, KEY_B);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -559,8 +559,8 @@ void Mifare::readAllE()
|
||||
}
|
||||
keyAList->replace(i, dataList->at(cardType.blks[i] + cardType.blk[i] - 1).left(12));
|
||||
keyBList->replace(i, dataList->at(cardType.blks[i] + cardType.blk[i] - 1).right(12));
|
||||
data_syncWithKeyWidget(false, i, true);
|
||||
data_syncWithKeyWidget(false, i, false);
|
||||
data_syncWithKeyWidget(false, i, KEY_A);
|
||||
data_syncWithKeyWidget(false, i, KEY_B);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -626,7 +626,7 @@ void Mifare::data_syncWithDataWidget(bool syncAll, int block)
|
||||
}
|
||||
}
|
||||
|
||||
void Mifare::data_syncWithKeyWidget(bool syncAll, int sector, bool isKeyA)
|
||||
void Mifare::data_syncWithKeyWidget(bool syncAll, int sector, KeyType keyType)
|
||||
{
|
||||
if(syncAll)
|
||||
{
|
||||
@@ -638,7 +638,7 @@ void Mifare::data_syncWithKeyWidget(bool syncAll, int sector, bool isKeyA)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isKeyA)
|
||||
if(keyType == KEY_A)
|
||||
ui->MF_keyWidget->item(sector, 1)->setText(keyAList->at(sector));
|
||||
else
|
||||
ui->MF_keyWidget->item(sector, 2)->setText(keyBList->at(sector));
|
||||
@@ -976,9 +976,9 @@ void Mifare::data_setData(int block, const QString &data)
|
||||
dataList->replace(block, data);
|
||||
}
|
||||
|
||||
void Mifare::data_setKey(int sector, bool isKeyA, const QString &key)
|
||||
void Mifare::data_setKey(int sector, KeyType keyType, const QString &key)
|
||||
{
|
||||
if(isKeyA)
|
||||
if(keyType == KEY_A)
|
||||
keyAList->replace(sector, key);
|
||||
else
|
||||
keyBList->replace(sector, key);
|
||||
|
||||
+8
-2
@@ -30,6 +30,12 @@ public:
|
||||
void dump();
|
||||
void restore();
|
||||
|
||||
enum KeyType
|
||||
{
|
||||
KEY_A,
|
||||
KEY_B,
|
||||
};
|
||||
|
||||
enum DataType
|
||||
{
|
||||
DATA_INVALID,
|
||||
@@ -84,7 +90,7 @@ public:
|
||||
bool data_isKeyValid(const QString &key);
|
||||
Mifare::DataType data_isDataValid(QString data);
|
||||
void data_syncWithDataWidget(bool syncAll = true, int block = 0);
|
||||
void data_syncWithKeyWidget(bool syncAll = true, int sector = 0, bool isKeyA = true);
|
||||
void data_syncWithKeyWidget(bool syncAll = true, int sector = 0, KeyType keyType = KEY_A);
|
||||
|
||||
CardType cardType;
|
||||
Mifare::CardType getCardType();
|
||||
@@ -104,7 +110,7 @@ public:
|
||||
void data_data2Key();
|
||||
|
||||
void data_setData(int block, const QString &data);
|
||||
void data_setKey(int sector, bool isKeyA, const QString &key);
|
||||
void data_setKey(int sector, KeyType keyType, const QString &key);
|
||||
void lockC();
|
||||
void writeAllE();
|
||||
void readAllE();
|
||||
|
||||
Reference in New Issue
Block a user