06-01-24, 02:10 AM
(آخر تعديل لهذه المشاركة : 06-01-24, 02:12 AM {2} بواسطة HALIM ELEULMA.)
الكود الذي قدمته يقوم بجلب بعض معلومات الجهاز مثل اسم النظام واسم الجهاز وبعض معلومات القرص الثابت، ثم يحسب قيمة مستخدمة للتفعيل
يرجى مراجعة الأكواد بعناية والتأكد من الدقة والتوافق مع متطلبات وبيئة العمل الخاصة بك قبل استخدامه
يرجى مراجعة الأكواد بعناية والتأكد من الدقة والتوافق مع متطلبات وبيئة العمل الخاصة بك قبل استخدامه
PHP كود :
using System;
using System.Management;
using System.Windows.Forms;
using Microsoft.Win32;
namespace YourNamespace
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
TxtWnd.Text = System.Environment.OSVersion.ToString();
TxtMname.Text = System.Environment.MachineName;
TxtLang.Text = System.Globalization.CultureInfo.InstalledUICulture.EnglishName;
ManagementObjectSearcher cmicWmi = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
string diskId = ""; // Digital ID
string diskSerialNumber = ""; // This we will call it the serial number for the time being.
string diskModel = ""; // serial number
foreach (ManagementObject cmicWmiObj in cmicWmi.Get())
{
diskId = cmicWmiObj["signature"].ToString();
diskSerialNumber = cmicWmiObj["serialnumber"].ToString();
diskModel = cmicWmiObj["Model"].ToString();
}
TextBox1.Text = diskSerialNumber;
TextBox2.Text = diskId;
TextBox4.Text = (Convert.ToInt32(TextBox2.Text) * 13 + 1225 - 1650).ToString();
TextBox4.Text = (Convert.ToInt32(TextBox4.Text) * 17).ToString();
}
private void Button1_Click(object sender, EventArgs e)
{
if (TextBox3.Text == TextBox4.Text)
{
MessageBox.Show("تمت عملية تفعيل البرنامج بنجاح");
string x = TextBox3.Text;
RegistryKey Activekey;
Activekey = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
Activekey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\FoxSoftware", true);
if (Activekey == null)
{
Activekey = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
Activekey.CreateSubKey("FoxSoftware");
Activekey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\FoxSoftware", true);
Activekey.SetValue("System_key", x);
Activekey.Close();
}
}
else
{
MessageBox.Show("رقم التفعيل الذي ادخلته غير صحيح الرجاء مراجعة قسم المبيعات");
Application.Exit();
}
}
}
}
