Quellcode durchsuchen

Modify the codes of the encryption part

CXS vor 3 Jahren
Ursprung
Commit
5c25f204c5
2 geänderte Dateien mit 38 neuen und 28 gelöschten Zeilen
  1. 38 27
      OTSIncAMeasureApp/CRegistration.cs
  2. 0 1
      OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

+ 38 - 27
OTSIncAMeasureApp/CRegistration.cs

@@ -14,48 +14,59 @@ namespace OTSMeasureApp
    
         public bool RegistrationVerification()
         {
-            string CPUID, DiskID;
+           
             try
             {
+                //if (!checkRegistration())//文件授权法
+                //{
+                //    return false;
+
+                //}
+                //狗加密法
                 SenseShield.DogDecrypting.decrypting(101);//参数为许可号
             }
             catch (Exception ex)
             {
-                CPUID = getCpu();
-                DiskID = GetDiskVolumeSerialNumber();
-                var ID = ReadXML("./Config/SysData/RegistrationProofreading.txt");
-                if (ID.Count == 0)
-                {
-                    return false;
-                }
-                List<string> list_str = new List<string>();
-                List<string> list_time = new List<string>();
-                ID.TryGetValue("ID", out list_str);
-                ID.TryGetValue("Time", out list_time);
-                string setCPU = ConvertString(list_str[0]);
-                string setDisk = ConvertString(list_str[1]);
-                string setYear = ConvertString(list_time[0]);
-                string setMonth = ConvertString(list_time[1]);
-                string setDay = ConvertString(list_time[2]);
-                if (CPUID != setCPU || DiskID != setDisk)
-                {
-                    return false;
 
-                }
+                return false;
 
-                DateTime dt = DateTime.ParseExact(setYear + setMonth + setDay + "235959", "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
+            }
+            return true;
+        }
+        private bool checkRegistration()
+        {
+            string CPUID, DiskID;
+            CPUID = getCpu();
+            DiskID = GetDiskVolumeSerialNumber();
+            var ID = ReadXML("./Config/SysData/RegistrationProofreading.txt");
+            if (ID.Count == 0)
+            {
+                return false;
+            }
+            List<string> list_str = new List<string>();
+            List<string> list_time = new List<string>();
+            ID.TryGetValue("ID", out list_str);
+            ID.TryGetValue("Time", out list_time);
+            string setCPU = ConvertString(list_str[0]);
+            string setDisk = ConvertString(list_str[1]);
+            string setYear = ConvertString(list_time[0]);
+            string setMonth = ConvertString(list_time[1]);
+            string setDay = ConvertString(list_time[2]);
+            if (CPUID != setCPU || DiskID != setDisk)
+            {
+                return false;
 
-                if (DateTime.Now > dt)
-                {
+            }
 
-                    return false;
-                }
+            DateTime dt = DateTime.ParseExact(setYear + setMonth + setDay + "235959", "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
 
+            if (DateTime.Now > dt)
+            {
 
+                return false;
             }
             return true;
         }
-   
 
 
         // 获得CPU的序列号

+ 0 - 1
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -158,7 +158,6 @@ namespace OTSMeasureApp
 
         private void OTSIncAMeasureAppForm_Load(object sender, EventArgs e)
         {
-          
             try
             {