#pragma once #include "OTSLicMgr.h" #include "OTSHelper.h" #include "DlgLicenseInfo.h" namespace OTSINTERFACE { using namespace System; using namespace OTSMODEL; using namespace OTSDATA; //using namespace System::Collections::Generic; // COTSLicenseInfo command target // license info class public ref class COTSLicenseInfoClr : public Object { public: COTSLicenseInfoClr(); // constructor COTSLicenseInfoClr(COTSLicenseInfoPtr a_Ptr); ~COTSLicenseInfoClr(); // detractor !COTSLicenseInfoClr(); void FreePointer(); // // machine id String^ GetMachineId(); void SetMachineId(String^ a_strMachineId); // software package id int GetPackId(); void SetPackId(int a_nPackId); // license type int GetLicType(); void SetLicType(int a_nLicType); // expire date DateTime^ GetExpireDate(); void SetExpireDate(DateTime^ a_oexpiredate); // computer nick name String^ GetComputerNickName(); void SetComputerNickName(String^ a_strComputerNickName); COTSLicenseInfoPtr GetCOTSLicenseInfo(); private: COTSLicenseInfo* m_pOTSLicenseInfo; }; // COTSLicInfoFile command target // license manager app file public ref class COTSLicInfoFileClr : public Object { public: COTSLicInfoFileClr(); // constructor COTSLicInfoFileClr(COTSLicInfoFilePtr a_ptr); ~COTSLicInfoFileClr(); // detractor !COTSLicInfoFileClr(); void FreePointer(); // file pathname String^ GetPathName(); void SetPathName(String^ a_strPathName); // modify flag bool IsModified(); void SetModify(bool a_bModify ); // Load/Save bool Load(String^ a_strPathName); bool Save(); private: COTSLicInfoFile* m_pOTSLicInfoFile; }; // COTSLicenseFile command target // OTS license/license key file public ref class COTSLicenseFileClr : public Object { public: COTSLicenseFileClr(); // constructor COTSLicenseFileClr(COTSLicenseFilePtr a_Ptr); // constructor ~COTSLicenseFileClr(); // detractor !COTSLicenseFileClr(); void FreePointer(); // // file pathname String^ GetPathName(); // license info bool GetLicenseInfo(COTSLicenseInfoClr^ % a_pOTSLicenseInfo); void SetLicenseInfo(COTSLicenseInfoClr^ a_pLicenseInfo); // Load/Save bool Load(String^ a_strPathName); bool Save(String^ a_strPathName); private: COTSLicenseFile* m_pOTSLicenseFile; }; // COTSLicMgr command target // manage license info file and license file public ref class COTSLicMgrClr : public Object { public: COTSLicMgrClr(); // constructor ~COTSLicMgrClr(); // constructor !COTSLicMgrClr(); void FreePointer(); // check if there is valid license of the given software package bool IsThereValidPackLicense(int a_nPackId); bool GetOTSLiceseFile(COTSLicenseFileClr^ % a_pOTSLicenseInfo); // load license info file bool LoadLicenseInfoFile(); bool GetOTSLicenseInfoFile(COTSLicInfoFileClr^ % a_pOTSLicenseInfo); // get license info file name String^ GetLicenseInfoFilePathName(); // get software package license file name String^ GetPackLicenseFilePathName(int a_nPackId); // check if the given license file is valid bool IsValidLicense(int a_nPackId, COTSLicenseInfoClr^ a_pOTSLicenseInfo, int% m_nLicStatus, bool a_bCheckMachinId, bool a_bTraceInfo); // // load license info from file bool LoadLicenseInfoFromFile(COTSLicenseInfoClr^ % a_pOTSLicenseInfo); // // create license file bool CreateLicenseFile(COTSLicenseInfoClr^ a_pOTSLicenseInfo); // // read license info from a text file bool LoadLicenseInfoFromTextFile(String^ a_strFilePathName, COTSLicenseInfoClr^ % a_pOTSLicenseInfo); // // get license info item bool GetLicnseInfoItem(COTSLicenseInfoClr^ a_pLicenseInfo, String^ a_strTitle, String^ a_strValue); // get software pack id string String^ GetSoftwarePackIdString(int a_nPackId); // get license type string String^ GetLicenseTypeIdString(int a_nLicTypeId); // // encrypt/decrypt license info string String^ EncryptLicenseInfo(COTSLicenseInfoClr^ a_pLicenseInfo); bool DecryptLicenseInfo(String^ a_strLicense, COTSLicenseInfoClr^ % a_pOTSLicenseInfo); bool ShowEditDialogExport(COTSLicenseInfoClr^ a_pLicenseInfo, bool a_bAdd, bool a_bRequest) { LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::ShowEditDialogExport ***************"); bool bRet; COTSLicenseInfoPtr a_ptr(new COTSLicenseInfo(a_pLicenseInfo->GetCOTSLicenseInfo().get())); bRet = ShowEditDialog(*a_ptr.get(), a_bAdd, a_bRequest); m_ComputerNicName = gcnew String(a_ptr->GetComputerNickName()); m_MachineId = gcnew String(a_ptr->GetMachineId()); m_PackId = (int)a_ptr->GetPackId(); m_LicType = (int)a_ptr->GetLicType(); m_oExpireDate = gcnew DateTime(a_ptr->GetExpireDate().GetYear(), a_ptr->GetExpireDate().GetMonth(), a_ptr->GetExpireDate().GetDay()); LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Enter COTSLicMgrClr::ShowEditDialogExport &&&&&&&&&&&&&&&"); return bRet; } String^ GetMachineId() { LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::GetMachineId ***************"); CString a_str = COTSHelper::GetMachineId(); String^ str = gcnew String(a_str); LogInfoTrace(__FILE__, __LINE__, _T("COTSLicMgrClr::GetMachineId is %s"), a_str); LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetMachineId &&&&&&&&&&&&&&&"); return str; } public: String^ m_ComputerNicName; String^ m_MachineId; int m_PackId; int m_LicType; DateTime^ m_oExpireDate; private: COTSLicMgr* m_pOTSLicMgr; }; }