Newer
Older
Import / applications / MakePDF / LicenseCheck.h
@John Ryland John Ryland on 22 Dec 2020 963 bytes import NUC files
/*
   WickedDocs
   (C) Copyright 2020
   John Ryland
*/
#ifndef LICENSE_CHECK_H
#define LICENSE_CHECK_H


#include <string>
#include <vector>
#include <map>


class LicenseChecker
{
public:
  LicenseChecker();

  bool LicenseExists() { return licenseFound; }
  bool LicenseValid()  { return licenseFound && licenseValid; }
  bool IsTrial()       { return trial; }

  bool InstallLicense(std::string licenseText);

  static std::string LicenseFileLocation();
  static bool ValidateData(const std::vector<uint8_t>& data, const std::vector<uint8_t>& signature);
  static bool ValidateLicense(const std::string& licenseText);

  std::string Date() const   { return keyValuePairs.count("Date") ? keyValuePairs.at("Date") : "01/01/2020"; }

private:
  bool licenseFound;
  bool licenseValid;
  std::map<std::string,std::string> keyValuePairs;

  int trialExecutionsRemaining;
  bool trial;
  std::string version;
};


bool CheckLicense();


#endif // LICENSE_CHECK_H