I'm new in the area that I'm working in, but I've been able to get some code working in Visual Studio C# where using the System.Management.dll I could make the program check for the hard drive serial, then return it to me to use later.
Then, I made another program that checks the same things, and if it matches the same serial the first program produced, then it thinks "this computer is licensed to use this program etc"
I've found out how to successfully add the reference to System.Management to my code and it all compiles, etc. But when I compile it, the output window subtly displays a line with this error:
"AssemblyResolveEvent handlers cannot return Assemblies loaded for reflection only"
and the code doesn't run in the strategy analyzer window.
I have no idea what the line in quotes means, but I can tell it doesn't like what I'm trying to do with system.management and the device ID checking. But can anyone please elaborate to me what it's problem is?
This is the code I'm using to try to check the device ID:
ManagementObject HardDisk = new ManagementObject(@"win32_logicaldisk.deviceid=""" + "C" + @":""");
HardDisk.Get();
string VolumeSerial = dsk["VolumeSerialNumber"].ToString();
if (VolumeSerial == "[whatever the hard drive serial you want may be]")
Print("YOU HAVE THE RIGHT COMPUTER FOR THIS CODE");
else
Print("License doesn't match hard drive ID");
Comment