API Documentation
Loading...
Searching...
No Matches
NDEVRActivation.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/INIInterface.h>
3#if NDEVR_SECURITY
4#include <NDEVR/Time.h>
5#include <NDEVR/TimeSpan.h>
6#include <NDEVR/TranslatedString.h>
7namespace NDEVR
8{
9 struct ActivationInfo;
10 /**--------------------------------------------------------------------------------------------------
11 \brief Logic for creating an activation key for a software package
12 *-----------------------------------------------------------------------------------------------**/
13 class NDEVRActivation : public INIInterface
14 {
15 public:
16 enum LicenseType : uint01
17 {
18 e_os_user_name = 0
19 , e_software_user_name
20 , e_software_email
21 , e_date_range
22 , e_hardware_cpu
23 , e_hardware_gpu
24 , e_harddrive
25 , e_os_key
26 , e_mac_address
27 , e_application_name
28 };
29 public:
30 NDEVRActivation(const TranslatedString& activation_name, const String& id);
31 NDEVRActivation(const File& file);
32 virtual void getINI(INIFactory& factory) final override;
33 TranslatedString name() const;
34 NDEVR_BASE_API String id() const;
35 String featureIDs();
36 String localCheckID();
37 TimeSpan activationTimeSpan() const;
38 bool isActivated();
39 NDEVR_BASE_API void setActive(LicenseType type, bool active, bool force_active);
40 NDEVR_BASE_API void temporaryActivate(const TimeSpan& span, String password);
41#ifdef _DEBUG
42 NDEVR_BASE_API void activate(String request_string, File admin_file, File location);
43#endif
44 void setActiveRange(TimeSpan span);
45 private:
46 TranslatedString m_name;
47 ActivationInfo* m_activation_info;
48 };
49
50 /**--------------------------------------------------------------------------------------------------
51 \brief Logic that sits and monitors for issues with software based on FeatureOptions.
52 *-----------------------------------------------------------------------------------------------**/
53 class NDEVR_BASE_API NDEVRActivationServer
54 {
55 public:
56 static void ReadSoftwareLicenses();
57 static bool IsSoftwareActivated();
58 static TimeSpan SoftwareActivationTimePeriod();
59 static bool IsFeatureActivated(const String& id);
60 static String LocalCheckID(const String& feature_id);
61 static void GenerateTrialPeriod(const String& feature_id, TimeSpan span, const String& password);
62 static bool AcceptSoftwareLicense(File file);
63 static bool AddActivation(NDEVRActivation* activation);
64 static Time InternetTime();
65 static void SetInternetTime(const Time& time, const String& password);
66 static void SetInternetTimeOffset(const TimeSpan& time, const String& password);
67#ifdef _DEBUG
68 static void Activate(String id, String request_string, File admin_file, File location);
69#endif
70 static NDEVRActivation* ApplicationActivation();
71 static NDEVRActivation* FeatureActivation(const String& id);
72 static NDEVRActivation* FeatureActivation(const TranslatedString name, const String& id);
73 private:
74 static Dictionary<String, NDEVRActivation*> s_activated_features;
75 };
76}
77#endif
#define NDEVR_BASE_API
Definition DLLInfo.h:78
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:78