Browse Source

软件软加密发生错误修正

zhangjiaxin 1 year ago
parent
commit
1d04b01013

+ 11 - 3
RegistrationAuthorization/Form1.cs

@@ -6,6 +6,7 @@ using System.Drawing;
 using System.IO;
 using System.Linq;
 using System.Management;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -102,14 +103,21 @@ namespace RegistrationAuthorization
 
         private void Form1_Load(object sender, EventArgs e)
         {
+
+            //string assemblyPath = Assembly.GetExecutingAssembly().Location;
+            //string assemblyDirectory = Path.GetDirectoryName(assemblyPath);
+            //Console.WriteLine("编译路径(程序集位置): " + assemblyPath);
+            //Console.WriteLine("编译目录: " + assemblyDirectory);
+           
+
             string CPUID, DiskID;
             CPUID = getCpu();
             DiskID = GetDiskVolumeSerialNumber();
-            var ID = ReadXML("./Config/SysData/RegistrationProofreading.txt");
+            var ID = ReadXML(AppDomain.CurrentDomain.BaseDirectory+"\\Config\\SysData\\RegistrationProofreading.txt");
             List<string> list_time = new List<string>();
             List<string> list_str = new List<string>();
-            ID.TryGetValue("ID", out list_str);
-            ID.TryGetValue("Time", out list_time);
+            //ID.TryGetValue("ID", out list_str);
+            //ID.TryGetValue("Time", out list_time);
 
             ID.TryGetValue("ID", out list_str);
             ID.TryGetValue("Time", out list_time);

+ 1 - 1
RegistrationAuthorization/RegistrationAuthorization.csproj

@@ -45,7 +45,7 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>bin\x64\Debug\</OutputPath>
+    <OutputPath>..\bin\x64\Debug\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
     <PlatformTarget>x64</PlatformTarget>