#pragma once #include /** * @brief 授权管理类 */ class Authorization { public: /** * @brief 检查授权文件是否有效 * @return true 如果授权有效,false 如果授权无效或不存在 */ static bool IsAuthorized(); /** * @brief 生成授权码文件 * @param machineCode 机器码 * @return true 如果生成成功,false 如果失败 */ static bool GenerateAuthorizationCodeFile(const std::string &machineCode); /** * @brief 获取机器码 * @return 机器码字符串 */ static std::string GetMachineCode(); private: /** * @brief 获取CPU ID * @return CPU ID字符串 */ static std::string GetCPUID(); /** * @brief 获取硬盘序列号 * @return 硬盘序列号字符串 */ static std::string GetHardDiskSerial(); /** * @brief 获取MAC地址 * @return MAC地址字符串 */ static std::string GetMACAddress(); /** * @brief 验证授权文件 * @param licenseFile 授权文件路径 * @return true 如果授权文件有效,false 如果无效 */ static bool VerifyLicenseFile(const std::string &licenseFile); /** * @brief 解密授权文件 * @param encryptedData 加密的数据 * @return 解密后的数据 */ static std::string DecryptLicense(const std::string &encryptedData); /** * @brief 加密数据 * @param data 要加密的数据 * @return 加密后的数据 */ static std::string EncryptData(const std::string &data); };