Przeglądaj źródła

修改DlgLicenseInfo类

sunyi 5 lat temu
rodzic
commit
9134f123fb

+ 0 - 48
OTS/OTSModelSharp/COTSLicMgr.cs

@@ -1,48 +0,0 @@
-using OTSDataType;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-   public class COTSLicMgr
-    {
-      public  string m_ComputerNicName = "";
-      public string m_MachineId = "";
-      public int m_PackId = 0;
-      public int m_LicType = 0;
-      public string m_oExpireDate = "";
-      int nResult = 0;
-        public bool LoadLicenseInfoFromFile(ref COTSLicenseInfo cOTSLicenseInfo) {
-
-            return false;
-      }
-        public bool FreePointer() {
-
-            return false;
-        }
-
-        public string GetMachineId() {
-
-            return "";
-        }
-
-        public bool ShowEditDialogExport(COTSLicenseInfo cOTSLicenseInfo,bool a_bAdd,bool a_bRequest) {
-
-            return false;
-
-        }
-
-        public bool IsValidLicense(int OTSProduct, COTSLicenseInfo otsInfoClr, ref int nResult ,bool valid,bool valids) {
-
-            return false;
-        }
-
-        public bool CreateLicenseFile(COTSLicenseInfo otsInfoClr) {
-            return false;
-
-        }
-    }
-}

+ 9 - 7
OTS/OTSModelSharp/Measure/GetStageInfo/DlgLicenseInfo.cs

@@ -36,6 +36,8 @@ namespace OTSModelSharp.Measure.GetStageInfo
         bool m_bAdd;
 
         COTSLicenseInfo m_pLicenseInfo;
+
+        COTSLicMgr m_OTSLicMgr = new COTSLicMgr(null);
         public DlgLicenseInfo()
         {
             InitializeComponent();
@@ -139,7 +141,7 @@ namespace OTSModelSharp.Measure.GetStageInfo
                 a_pOTSLicenseInfo.SetLicType((COTSLicenseInfo.OTS_LICENSE_TYPE)m_nCombeLicenseType);
                 a_pOTSLicenseInfo.SetExpireDate(m_oExpireData);
 
-                String strEmail = COTSLicMgr::GetLicenseInfoTextBody(a_pOTSLicenseInfo);//升级完COTSLicMgr再修改此处
+                String strEmail = m_OTSLicMgr.GetLicenseInfoTextBody(a_pOTSLicenseInfo);//升级完COTSLicMgr再修改此处
                 strEmail.Trim();
                 if (strEmail == "")
                 {
@@ -148,7 +150,7 @@ namespace OTSModelSharp.Measure.GetStageInfo
                     return;
                 }
                 // email license info string
-                if (!SendEmail(SUPPORT_EMAIL_ADDRESS, SUPPORT_EMAIL_TITLE, strEmail))//此方法做成接口
+                if (!SendEmail(m_OTSLicMgr.SUPPORT_EMAIL_ADDRESS, SUPPORT_EMAIL_TITLE, strEmail))//此方法做成接口
                 {
                     // email license info string, return if send email fails
 
@@ -173,7 +175,7 @@ namespace OTSModelSharp.Measure.GetStageInfo
                     String strPathName = openFileDialog.FileName;
 
                     // try to load license info from a text file
-                    COTSLicenseInfo pOTSLicenseInfo = COTSLicMgr::LoadLicenseInfoFromTextFile(strPathName);
+                    COTSLicenseInfo pOTSLicenseInfo = m_OTSLicMgr.LoadLicenseInfoFromTextFile(strPathName);
                    
 
                     // set control data with the license info
@@ -259,7 +261,7 @@ namespace OTSModelSharp.Measure.GetStageInfo
                 a_pOTSLicenseInfo.SetExpireDate(m_oExpireData);
 
                 //create license info text file
-                if (!COTSLicMgr::CreateLicenseInfoFileText(a_pOTSLicenseInfo))
+                if (!m_OTSLicMgr.CreateLicenseInfoFileText(a_pOTSLicenseInfo))
                 {
                     return;
                 }
@@ -300,11 +302,11 @@ namespace OTSModelSharp.Measure.GetStageInfo
 
             // test the license info
             otsdataconst.OTS_LICENSE_STATUS nLicStatus = otsdataconst.OTS_LICENSE_STATUS.INVALID;
-            COTSLicMgr licMgr = new COTSLicMgr();
-            licMgr.IsValidLicense(Convert.ToInt32(pOTSLicenseInfo.GetPackId()), pOTSLicenseInfo, ref Convert.ToInt32(nLicStatus), false, false);
+            
+            m_OTSLicMgr.IsValidLicense(pOTSLicenseInfo.GetPackId(), pOTSLicenseInfo, nLicStatus, false, false);
             if (nLicStatus >= OTS_LICENSE_STATUS.OTS_LICENSE_STATUS_CAN_HAVEKEY && nLicStatus <= OTS_LICENSE_STATUS.MAX)
             {
-                strEditLicenseKey = COTSLicMgr.EncryptLicenseInfo(pOTSLicenseInfo);//升级完COTSLicMgr再修改此处
+                strEditLicenseKey = m_OTSLicMgr.EncryptLicenseInfo(pOTSLicenseInfo);//升级完COTSLicMgr再修改此处
             }
             // get license key string =========================
 

+ 3 - 0
OTS/OTSModelSharp/OTSLicMgr.cs

@@ -64,6 +64,9 @@ namespace OTSModelSharp
 
         const int TEXTFILE_ITEM_COLUMN_NUMBER = 2;
 
+        //Email address
+        const String SUPPORT_EMAIL_ADDRESS = "OTSSupport@opton.com.cn";
+
         // constructor
         public void OTSLicenseFile()
         {