This commit is contained in:
2024-01-24 08:25:44 +01:00
parent f260e92596
commit 36a799057c
42 changed files with 926 additions and 2313 deletions

View File

@@ -1,78 +1,28 @@
#include <stdio.h>
#include "utils.h"
#include "licenceGenerator.h"
#include "licenceReader.h"
#include "licenceCommon.h"
/// @brief hlavní funkce
/// @param argc
/// @param argv parametry pro generování licence
/// @return
int main(int argc, char *argv[])
int main5(int argc, char *argv[])
{
try
{
/* code */
// unordered_map<string, string> arguments = getArguments(argc, argv);
// LicenceGenerator generatorOld = LicenceGenerator(arguments["-uid"], arguments["-cid"], arguments["-csd"], arguments["-configFileName"]);
// generatorOld.createLicenceFile();
// return SUCCES;
unordered_map<string, string> arguments = getArguments(argc, argv);
// try
// {
// unordered_map<string, string> arguments = getArguments(argc, argv);
// LicenceGenerator generatorOld = LicenceGenerator(arguments["-uid"], arguments["-cid"], arguments["-csd"], arguments["-configFileName"]);
// generatorOld.createLicenceFile();
// return SUCCES;
// }
// catch (...)
// {
// cerr << "Obecná chyba\n";
// }
LicenceGenerator licenceGenerator = LicenceGenerator();
InitStructure initStructure;
initStructure.elcType = 2;
initStructure.licenceType = (int)LicenceType::EOS_EOV;
initStructure.licenceVersion = 1;
initStructure.licenceIndex = 0;
initStructure.compatibility = 1;
initStructure.licenceFilePath = "";
initStructure.cid_csd_filePath = "";
// //verze #1: načtení kompletní licence a zobrazení
// if (licenceGenerator.init(initStructure))
// {
// LicenceInfo21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
// int protocolId = 345;
// if (licenceGenerator.getLicenceInfo(protocolId, &info))
// {
// std::cout << "Počet licenčních bodů pro : " << protocolId << ": " << info.reqDataPointsCount << std::endl;
// if (info.licences.count(protocolId) > 0) cout << "počet z vectoru pro : " << protocolId << info.licences.at(888) << endl;
// cout << "všechny licenční body: " << endl;
// for (const auto &pair : info.licences) { std::cout << "<" << pair.first << ", " << pair.second << ">" << endl; }
// }
// else
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
// }
// else
// {
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
// }
// verze #2 : iterace pro kazdý bod zvlášť
if (licenceGenerator.initread(initStructure))
{
int protocolId = 888;
LicenceItem21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
if (licenceGenerator.getLicenceItemInfo(protocolId, &info))
{
std::cout << "Počet licenčních bodů pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
}
else
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
}
else
{
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
}
}
catch (...)
{
cerr << "Obecná chyba\n";
}
system("pause");
// system("pause");
return SUCCES;
}