| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774 |
- #include "stdafx.h"
- #include "OTSLicMgrFunExport.h"
- namespace OTSINTERFACE {
- COTSLicenseInfoClr::COTSLicenseInfoClr() // constructor
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::COTSLicenseInfoClr ***************");
- m_pOTSLicenseInfo = new COTSLicenseInfo();
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::COTSLicenseInfoClr &&&&&&&&&&&&&&&");
- }
- COTSLicenseInfoClr::COTSLicenseInfoClr(COTSLicenseInfoPtr a_Ptr) // constructor
- {
- if (a_Ptr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("COTSLicenseInfoClr: invalid pointer"));
- return;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::COTSLicenseInfoClr ***************");
- m_pOTSLicenseInfo = new COTSLicenseInfo(a_Ptr.get());
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::COTSLicenseInfoClr &&&&&&&&&&&&&&&");
- }
- COTSLicenseInfoClr::~COTSLicenseInfoClr() // detractor
- {
- if (m_pOTSLicenseInfo != nullptr)
- {
- delete m_pOTSLicenseInfo;
- m_pOTSLicenseInfo = nullptr;
- }
- }
- COTSLicenseInfoClr::!COTSLicenseInfoClr() // detractor
- {
- if (m_pOTSLicenseInfo != nullptr)
- {
- delete m_pOTSLicenseInfo;
- m_pOTSLicenseInfo = nullptr;
- }
- }
- void COTSLicenseInfoClr::FreePointer() // detractor
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::FreePointer ***************");
- if (m_pOTSLicenseInfo != NULL)
- {
- delete m_pOTSLicenseInfo;
- m_pOTSLicenseInfo = NULL;
- }
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::FreePointer ***************");
- }
- // machine id
- String^ COTSLicenseInfoClr::GetMachineId()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetMachineId ***************");
- CString a_str = m_pOTSLicenseInfo->GetMachineId();
- String^ strOut = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("GetMachineId is %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::GetMachineId ***************");
- return strOut;
- }
- void COTSLicenseInfoClr::SetMachineId(String^ a_strMachineId)
- {
- if (a_strMachineId == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetMachineId: invalid pointer"));
- return;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::SetMachineId ***************");
- CString a_str = a_strMachineId;
- LogInfoTrace(__FILE__, __LINE__, _T("SetMachineId %s"),a_str);
- m_pOTSLicenseInfo->SetMachineId(a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::SetMachineId ***************");
- }
- // software package id
- int COTSLicenseInfoClr::GetPackId()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetPackId ***************");
- int bRet;
- bRet = (int)m_pOTSLicenseInfo->GetPackId();
- LogInfoTrace(__FILE__, __LINE__, _T("GetPackId is %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetPackId ***************");
- return bRet;
- }
- void COTSLicenseInfoClr::SetPackId( int a_nPackId)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::SetPackId ***************");
- m_pOTSLicenseInfo->SetPackId((OTS_SOFT_PACKAGE_ID)a_nPackId);
- LogInfoTrace(__FILE__, __LINE__, _T("SetPackId %d"), a_nPackId);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::SetPackId ***************");
- }
- // license type
- int COTSLicenseInfoClr::GetLicType()
- {
- int bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetLicType ***************");
- bRet = (int)m_pOTSLicenseInfo->GetLicType();
- LogInfoTrace(__FILE__, __LINE__, _T("GetLicType is %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::GetLicType ***************");
- return bRet;
- }
- void COTSLicenseInfoClr::SetLicType(int a_nLicType)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::SetLicType ***************");
- m_pOTSLicenseInfo->SetLicType((OTS_LICENSE_TYPE)a_nLicType);
- LogInfoTrace(__FILE__, __LINE__, _T("SetLicType %d"), a_nLicType);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::SetLicType ***************");
- }
- // expire date
- DateTime^ COTSLicenseInfoClr::GetExpireDate()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetExpireDate ***************");
- COleDateTime a_DT;
- a_DT = m_pOTSLicenseInfo->GetExpireDate();
- LogInfoTrace(__FILE__, __LINE__, _T("GetExpireDate: Year: Month: Date:is (%d:%d:%d)"), a_DT.GetYear(), a_DT.GetMonth(), a_DT.GetDay());
- #pragma warning(disable: 4244)
- DateTime^ a_dt = gcnew DateTime(a_DT);
- #pragma warning(default: 4244)
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetExpireDate ***************");
- return a_dt;
- }
- void COTSLicenseInfoClr::SetExpireDate(DateTime^ a_oexpiredate)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::SetExpireDate ***************");
- COleDateTime a_DT(a_oexpiredate->Year,
- a_oexpiredate->Month,
- a_oexpiredate->Day,
- a_oexpiredate->Hour,
- a_oexpiredate->Minute,
- a_oexpiredate->Second);
- LogInfoTrace(__FILE__, __LINE__, _T("SetExpireDate: Year: Month: Date:is (%d:%d:%d)"), a_DT.GetYear(), a_DT.GetMonth(), a_DT.GetDay());
- m_pOTSLicenseInfo->SetExpireDate(a_DT);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::SetExpireDate ***************");
- }
- // computer nick name
- String^ COTSLicenseInfoClr::GetComputerNickName()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetComputerNickName ***************");
- CString a_str = m_pOTSLicenseInfo->GetComputerNickName();
- LogInfoTrace(__FILE__, __LINE__, _T("GetComputerNickName is %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::GetComputerNickName ***************");
- String^ strOut = gcnew String(a_str);
- return strOut;
- }
- void COTSLicenseInfoClr::SetComputerNickName(String^ a_strComputerNickName)
- {
- if (a_strComputerNickName == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetComputerNickName: invalid pointer"));
- return;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::SetComputerNickName ***************");
- CString a_str = a_strComputerNickName;
- LogInfoTrace(__FILE__, __LINE__, _T("SetComputerNickName %s"), a_str);
- m_pOTSLicenseInfo->SetComputerNickName(a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::SetComputerNickName ***************");
- }
- COTSLicenseInfoPtr COTSLicenseInfoClr::GetCOTSLicenseInfo()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseInfoClr::GetCOTSLicenseInfo ***************");
- COTSLicenseInfoPtr a_pt ( new COTSLicenseInfo(m_pOTSLicenseInfo));
- return a_pt;
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseInfoClr::GetCOTSLicenseInfo ***************");
- }
- COTSLicInfoFileClr::COTSLicInfoFileClr() // constructor
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::COTSLicInfoFileClr ***************");
- m_pOTSLicInfoFile = new COTSLicInfoFile();
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::COTSLicInfoFileClr ***************");
- }
- COTSLicInfoFileClr::COTSLicInfoFileClr(COTSLicInfoFilePtr a_ptr) // constructor
- {
-
- if (a_ptr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("COTSLicInfoFileClr:invalid pointer"));
- return;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::COTSLicInfoFileClr ***************");
- m_pOTSLicInfoFile = new COTSLicInfoFile(a_ptr.get());
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::COTSLicInfoFileClr ***************");
- }
- COTSLicInfoFileClr::~COTSLicInfoFileClr() // detractor
- {
- if (m_pOTSLicInfoFile != NULL)
- {
- delete m_pOTSLicInfoFile;
- m_pOTSLicInfoFile = NULL;
- }
- }
- COTSLicInfoFileClr::!COTSLicInfoFileClr() // detractor
- {
- if (m_pOTSLicInfoFile != NULL)
- {
- delete m_pOTSLicInfoFile;
- m_pOTSLicInfoFile = NULL;
- }
- }
- void COTSLicInfoFileClr::FreePointer() // detractor
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::FreePointer ***************");
- if (m_pOTSLicInfoFile != NULL)
- {
- delete m_pOTSLicInfoFile;
- m_pOTSLicInfoFile = NULL;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Exit COTSLicInfoFileClr::FreePointer ***************");
- }
- // file pathname
- String^ COTSLicInfoFileClr::GetPathName()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::GetPathName ***************");
- CString a_str = m_pOTSLicInfoFile->GetPathName();
- String^ strOut = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("GetPathName %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::GetPathName ***************");
- return strOut;
- }
- void COTSLicInfoFileClr::SetPathName(String^ a_strPathName)
- {
- if (a_strPathName == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetPathName:invalid pointer"));
- return;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::SetMachineId ***************");
- CString a_str = a_strPathName;
- LogInfoTrace(__FILE__, __LINE__, _T("SetMachineId %s"), a_str);
- m_pOTSLicInfoFile->SetPathName(a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::SetMachineId ***************");
- }
- // modify flag
- bool COTSLicInfoFileClr::IsModified()
- {
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::IsModified ***************");
- bRet = m_pOTSLicInfoFile->IsModified();
- LogInfoTrace(__FILE__, __LINE__, _T("IsModified return is %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::IsModified ***************");
- return bRet;
- }
- void COTSLicInfoFileClr::SetModify(bool a_bModify)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::SetModify ***************");
- m_pOTSLicInfoFile->SetModify(a_bModify);
- LogInfoTrace(__FILE__, __LINE__, _T("SetModify %d"), a_bModify);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::SetModify ***************");
- }
- // Load/Save
- bool COTSLicInfoFileClr::Load(String^ a_strPathName)
- {
- if (a_strPathName == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("Load:invalid pointer"));
- return false;
- }
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::Load ***************");
- CString a_str = a_strPathName;
- bRet = m_pOTSLicInfoFile->Load(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("Load return is %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::Load ***************");
- return bRet;
- }
- bool COTSLicInfoFileClr::Save()
- {
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicInfoFileClr::Save ***************");
- bRet = m_pOTSLicInfoFile->Save();
- LogInfoTrace(__FILE__, __LINE__, _T("Save return is %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicInfoFileClr::Save ***************");
- return bRet;
- }
- COTSLicenseFileClr::COTSLicenseFileClr() // constructor
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::COTSLicenseFileClr ***************");
- m_pOTSLicenseFile = new COTSLicenseFile();
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseFileClr::COTSLicenseFileClr ***************");
- }
- COTSLicenseFileClr::COTSLicenseFileClr(COTSLicenseFilePtr a_Ptr) // constructor
- {
- if (a_Ptr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("COTSLicenseFileClr:invalid pointer"));
- return;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::COTSLicenseFileClr ***************");
- m_pOTSLicenseFile = new COTSLicenseFile(a_Ptr.get());
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseFileClr::COTSLicenseFileClr ***************");
- }
-
- COTSLicenseFileClr::~COTSLicenseFileClr() // detractor
- {
- if (m_pOTSLicenseFile != NULL)
- {
- delete m_pOTSLicenseFile;
- m_pOTSLicenseFile = NULL;
- }
- }
- COTSLicenseFileClr::!COTSLicenseFileClr() // detractor
- {
- if (m_pOTSLicenseFile != NULL)
- {
- delete m_pOTSLicenseFile;
- m_pOTSLicenseFile = NULL;
- }
- }
- void COTSLicenseFileClr::FreePointer() // detractor
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::FreePointer ***************");
- if (m_pOTSLicenseFile != NULL)
- {
- delete m_pOTSLicenseFile;
- m_pOTSLicenseFile = NULL;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Exit COTSLicenseFileClr::FreePointer ***************");
- }
- String^ COTSLicenseFileClr::GetPathName()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::GetPathName ***************");
- CString a_str = m_pOTSLicenseFile->GetPathName();
- String^ strOut = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("GetPathName %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseFileClr::GetPathName ***************");
- return strOut;
- }
-
- bool COTSLicenseFileClr::GetLicenseInfo(COTSLicenseInfoClr^ % a_pOTSLicenseInfo)
- {
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::GetLicenseInfo ***************");
- COTSLicenseInfoPtr a_Ptr;
- a_Ptr = m_pOTSLicenseFile->GetLicenseInfo();
- if (a_Ptr == nullptr)
- {
- return false;
- }
- else
- {
- a_pOTSLicenseInfo = gcnew COTSLicenseInfoClr(a_Ptr);
- return true;
- }
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseFileClr::GetLicenseInfo ***************");
- return bRet;
- }
- void COTSLicenseFileClr::SetLicenseInfo(COTSLicenseInfoClr^ a_pLicenseInfo)
- {
- if (a_pLicenseInfo == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetLicenseInfo:invalid pointer"));
- return;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::SetLicenseInfo ***************");
- COTSLicenseInfoPtr a_Ptr ( new COTSLicenseInfo(a_pLicenseInfo->GetCOTSLicenseInfo().get()));
- m_pOTSLicenseFile->SetLicenseInfo(a_Ptr);
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::SetLicenseInfo ***************");
- }
- bool COTSLicenseFileClr::Load(String^ a_strPathName)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::Load ***************");
- bool bRet;
- CString a_str = a_strPathName;
- bRet = m_pOTSLicenseFile->Load(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("Load return %d"),bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseFileClr::Load ***************");
- return bRet;
- }
- bool COTSLicenseFileClr::Save(String^ a_strPathName)
- {
- if (a_strPathName == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("Save:invalid pointer"));
- return false;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicenseFileClr::Save ***************");
- bool bRet;
- CString a_str = a_strPathName;
- bRet = m_pOTSLicenseFile->Save(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("Save return %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicenseFileClr::Save ***************");
- return bRet;
- }
- // COTSLicMgrClr Class
- COTSLicMgrClr::COTSLicMgrClr()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::COTSLicMgrClr ***************");
- m_pOTSLicMgr = new COTSLicMgr();
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::COTSLicMgrClr ***************");
- }
- COTSLicMgrClr::~COTSLicMgrClr()
- {
- if (m_pOTSLicMgr != NULL)
- {
- delete m_pOTSLicMgr;
- m_pOTSLicMgr = NULL;
- }
- }
- COTSLicMgrClr::!COTSLicMgrClr()
- {
- if (m_pOTSLicMgr != NULL)
- {
- delete m_pOTSLicMgr;
- m_pOTSLicMgr = NULL;
- }
- }
- void COTSLicMgrClr::FreePointer()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::FreePointer ***************");
- if (m_pOTSLicMgr != NULL)
- {
- delete m_pOTSLicMgr;
- m_pOTSLicMgr = NULL;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Exit COTSLicMgrClr::FreePointer ***************");
- }
- bool COTSLicMgrClr::IsThereValidPackLicense(int a_nPackId)
- {
- bool bRet = false;
-
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::IsThereValidPackLicense ***************");
- bRet = m_pOTSLicMgr->IsThereValidPackLicense((OTS_SOFT_PACKAGE_ID)a_nPackId);
- LogInfoTrace(__FILE__, __LINE__, _T("IsThereValidPackLicense return is %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::IsThereValidPackLicense ***************");
- return bRet;
- }
- bool COTSLicMgrClr::GetOTSLiceseFile(COTSLicenseFileClr^ % a_pOTSLicenseInfo)
- {
- bool bRet = false;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::GetOTSLicenseFile ***************");
- COTSLicenseFilePtr a_ptr = m_pOTSLicMgr->GetOTSLicenseFile();
- if (a_ptr == nullptr)
- {
- bRet = false;
- }
- else
- {
- a_pOTSLicenseInfo = gcnew COTSLicenseFileClr(a_ptr);
- bRet = true;
- }
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetOTSLicenseFile ***************");
- return bRet;
- }
- // load license info file
- bool COTSLicMgrClr::LoadLicenseInfoFile()
- {
- bool bRet = false;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::LoadLicenseInfoFile ***************");
- bRet = m_pOTSLicMgr->LoadLicenseInfoFile();
- LogInfoTrace(__FILE__, __LINE__, _T("LoadLicenseInfoFile return is %d"), bRet);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::LoadLicenseInfoFile ***************");
- return bRet;
- }
- bool COTSLicMgrClr::GetOTSLicenseInfoFile(COTSLicInfoFileClr^ % a_pOTSLicenseInfo)
- {
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::GetOTSLicenseInfoFile ***************");
- COTSLicInfoFilePtr a_ptr = m_pOTSLicMgr->GetOTSLicenseInfoFile();
- if (a_ptr == nullptr)
- {
- bRet = false;
- }
- else
- {
- a_pOTSLicenseInfo = gcnew COTSLicInfoFileClr(a_ptr);
- bRet = true;
- }
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetOTSLicenseInfoFile ***************");
- return bRet;
- }
- // get license info file name
- String^ COTSLicMgrClr::GetLicenseInfoFilePathName()
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::GetLicenseInfoFilePathName ***************");
- CString a_str = COTSLicMgr::GetLicenseInfoFilePathName();
- String^ strOut = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("GetLicenseInfoFilePathName is %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetLicenseInfoFilePathName ***************");
- return strOut;
- }
- // get software package license file name
- String^ COTSLicMgrClr::GetPackLicenseFilePathName(int a_nPackId)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::GetPackLicenseFilePathName ***************");
- CString a_str = COTSLicMgr::GetPackLicenseFilePathName((OTS_SOFT_PACKAGE_ID)a_nPackId);
- String^ strOut = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("GetPackLicenseFilePathName is %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetPackLicenseFilePathName ***************");
- return strOut;
- }
- // check if the given license file is valid
- bool COTSLicMgrClr::IsValidLicense(int a_nPackId,
- COTSLicenseInfoClr^ a_pOTSLicenseInfo,
- int% a_nLicStatus,
- bool a_bCheckMachinId,
- bool a_bTraceInfo)
- {
- if (a_pOTSLicenseInfo == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("Save:invalid pointer"));
- return false;
- }
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::IsValidLicense ***************");
- int a_nLicS = 0;
- COTSLicenseInfoPtr a_ptr(new COTSLicenseInfo(a_pOTSLicenseInfo->GetCOTSLicenseInfo().get()));
- bRet = COTSLicMgr::IsValidLicense((OTS_SOFT_PACKAGE_ID)a_nPackId,
- a_ptr,
- (OTS_LICENSE_STATUS &)a_nLicS,
- a_bCheckMachinId,
- a_bTraceInfo);
- a_nLicStatus = a_nLicS;
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::IsValidLicense ***************");
- return bRet;
- }
- // // load license info from file
- bool COTSLicMgrClr::LoadLicenseInfoFromFile(COTSLicenseInfoClr^ %a_pOTSLicenseInfo)
- {
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::LoadLicenseInfoFromFile ***************");
- COTSLicenseInfoPtr a_ptr = COTSLicMgr::LoadLicenseInfoFromFile();
- if (a_ptr == nullptr)
- {
- bRet = false;
- }
- else
- {
- a_pOTSLicenseInfo = gcnew COTSLicenseInfoClr(a_ptr);
- 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());
- bRet = true;
- }
-
-
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::LoadLicenseInfoFromFile ***************");
- return bRet;
- }
- // // create license file
- bool COTSLicMgrClr::CreateLicenseFile(COTSLicenseInfoClr^ a_pOTSLicenseInfo)
- {
- if (a_pOTSLicenseInfo == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CreateLicenseFile:invalid pointer"));
- return false;
- }
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::CreateLicenseFile ***************");
- COTSLicenseInfoPtr a_ptr(new COTSLicenseInfo(a_pOTSLicenseInfo->GetCOTSLicenseInfo().get()));
- bRet = COTSLicMgr::CreateLicenseFile(a_ptr);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::CreateLicenseFile ***************");
- return bRet;
- }
- // // read license info from a text file
- bool COTSLicMgrClr::LoadLicenseInfoFromTextFile(String^ a_strFilePathName, COTSLicenseInfoClr^ %a_pOTSLicenseInfo)
- {
- if (a_strFilePathName == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("LoadLicenseInfoFromTextFile:invalid pointer"));
- return false;
- }
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::LoadLicenseInfoFromTextFile ***************");
- CString a_str = a_strFilePathName;
- COTSLicenseInfoPtr a_ptr = COTSLicMgr::LoadLicenseInfoFromTextFile(a_str);
- if (a_ptr == nullptr)
- {
- bRet = false;
- }
- else
- {
- a_pOTSLicenseInfo = gcnew COTSLicenseInfoClr(a_ptr);
- bRet = true;
- }
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::LoadLicenseInfoFromTextFile ***************");
- return bRet;
- }
- // // get license info item
- bool COTSLicMgrClr::GetLicnseInfoItem(COTSLicenseInfoClr^ a_pLicenseInfo, String^ a_strTitle, String^ a_strValue)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::GetLicnseInfoItem ***************");
- CString a_strTil = a_strTitle;
- CString a_strval = a_strValue;
- COTSLicenseInfoPtr a_ptr(new COTSLicenseInfo(a_pLicenseInfo->GetCOTSLicenseInfo().get()));
- bool bRet = COTSLicMgr::GetLicnseInfoItem(a_ptr, a_strTil, a_strval);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetLicnseInfoItem ***************");
- return bRet;
- }
- // get software pack id string
- String^ COTSLicMgrClr::GetSoftwarePackIdString(int a_nPackId)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr:: GetSoftwarePackIdString ***************");
- CString a_str = COTSLicMgr::GetSoftwarePackIdString((OTS_SOFT_PACKAGE_ID)a_nPackId);
- String^ strOut = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("GetSoftwarePackIdString is %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetSoftwarePackIdString ***************");
- return strOut;
- }
- // get license type string
- String^ COTSLicMgrClr::GetLicenseTypeIdString(int a_nLicTypeId)
- {
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::GetLicenseTypeIdString ***************");
- CString a_str = COTSLicMgr::GetLicenseTypeIdString((OTS_LICENSE_TYPE)a_nLicTypeId);
- String^ strOut = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, _T("GetLicenseTypeIdString is %s"), a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::GetLicenseTypeIdString ***************");
- return strOut;
- }
- // // encrypt/decrypt license info string
- String^ COTSLicMgrClr::EncryptLicenseInfo(COTSLicenseInfoClr^ a_pLicenseInfo)
- {
- if (a_pLicenseInfo == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("LoadLicenseInfoFromTextFile:invalid pointer"));
- return nullptr;
- }
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::EncryptLicenseInfo ***************");
- COTSLicenseInfoPtr a_ptr(new COTSLicenseInfo(a_pLicenseInfo->GetCOTSLicenseInfo().get()));
- CString a_str = COTSLicMgr::EncryptLicenseInfo(a_ptr);
- String^ bRet = gcnew String(a_str);
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::EncryptLicenseInfo ***************");
- return bRet;
- }
- bool COTSLicMgrClr::DecryptLicenseInfo(String^ a_strLicense, COTSLicenseInfoClr^ % a_pOTSLicenseInfo)
- {
- if (a_strLicense == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("DecryptLicenseInfo:invalid pointer"));
- return false;
- }
- bool bRet;
- LogInfoTrace(__FILE__, __LINE__, "***************** Enter COTSLicMgrClr::DecryptLicenseInfo ***************");
- CString a_str = a_strLicense;
- COTSLicenseInfoPtr a_ptr = COTSLicMgr::DecryptLicenseInfo(a_str);
- if (a_ptr == nullptr)
- {
- bRet = false;
- }
- else
- {
- a_pOTSLicenseInfo = gcnew COTSLicenseInfoClr(a_ptr);
- bRet = true;
- }
- LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit COTSLicMgrClr::DecryptLicenseInfo ***************");
- return bRet;
- }
- }
|