|
@@ -46,6 +46,7 @@ int MainClass::main()
|
46
|
46
|
|
47
|
47
|
CommandLineOption optionKeyFile(&parser, "key-file", 'f', "Path to a file containing keys", "FILE");
|
48
|
48
|
CommandLineOption optionKey(&parser, "key", 'k', "Key to use to authenticate", "KEY");
|
|
49
|
+ CommandLineOption optionWriteSector0(&parser, "write-sector0", '0', "Write the sector 0 block 0 as any other sector");
|
49
|
50
|
|
50
|
51
|
CommandLineOption optionOutput(&parser, "output", 'o', "Redirect output to FILE. '-' to use stdout", "FILE", "-");
|
51
|
52
|
CommandLineOption optionInput(&parser, "input", 'i', "Read input from FILE. '-' to use stdin", "FILE", "-");
|
|
@@ -224,7 +225,7 @@ int MainClass::main()
|
224
|
225
|
res = mapKeys(tag, keys);
|
225
|
226
|
}
|
226
|
227
|
else if (action == Write) {
|
227
|
|
- res = write(tag, keys, inputData);
|
|
228
|
+ res = write(tag, keys, inputData, optionWriteSector0.isSet());
|
228
|
229
|
}
|
229
|
230
|
}
|
230
|
231
|
}
|
|
@@ -279,9 +280,9 @@ int MainClass::read(std::shared_ptr<FreeFareTagBusiness> tag, std::vector<std::s
|
279
|
280
|
return EX_OK;
|
280
|
281
|
}
|
281
|
282
|
|
282
|
|
-int MainClass::write(std::shared_ptr<FreeFareTagBusiness> tag, std::vector<std::string> keys, const std::string &data)
|
|
283
|
+int MainClass::write(std::shared_ptr<FreeFareTagBusiness> tag, std::vector<std::string> keys, const std::string &data, bool writeSector0)
|
283
|
284
|
{
|
284
|
|
- auto writeResult = tag->write(keys, data, false, printPercentMapKeys, printPercentWrite);
|
|
285
|
+ auto writeResult = tag->write(keys, data, writeSector0, printPercentMapKeys, printPercentWrite);
|
285
|
286
|
if (!writeResult) {
|
286
|
287
|
writeResult.print();
|
287
|
288
|
return EX_WRITE_ERROR;
|