Browse Source

[Hotfix] Added flag to write sector0

master
Robin Thoni 5 years ago
parent
commit
7dd4e39974
2 changed files with 5 additions and 4 deletions
  1. 4
    3
      cli/Interface/MainClass.cpp
  2. 1
    1
      cli/Interface/MainClass.h

+ 4
- 3
cli/Interface/MainClass.cpp View File

@@ -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;

+ 1
- 1
cli/Interface/MainClass.h View File

@@ -31,7 +31,7 @@ public:
31 31
 
32 32
     int read(std::shared_ptr<FreeFareTagBusiness> tag, std::vector<std::string> keys);
33 33
 
34
-    int write(std::shared_ptr<FreeFareTagBusiness> tag, std::vector<std::string> keys, const std::string& data);
34
+    int write(std::shared_ptr<FreeFareTagBusiness> tag, std::vector<std::string> keys, const std::string& data, bool writeSector0);
35 35
 
36 36
     Result<std::vector<std::string>> readFile(const std::string& filePath);
37 37
 

Loading…
Cancel
Save