![]() |
|
استخراج كود - نسخة قابلة للطباعة +- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb) +-- قسم : قسم لغة السي شارب C#.NET (http://vb4arb.com/vb/forumdisplay.php?fid=175) +--- قسم : قسم اسئلة C#.NET (http://vb4arb.com/vb/forumdisplay.php?fid=176) +--- الموضوع : استخراج كود (/showthread.php?tid=37761) |
استخراج كود - Ahmedmon - 10-02-21 ممكن استخراج معادله التفعيل من الكود هذا using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Windows.Forms; namespace serial_full.PL { public partial class ProductKey_Form : Form { public ProductKey_Form() { InitializeComponent(); } private void ProductKey_Form_Load(object sender, EventArgs e) { if (Properties.Settings.Default.ProdectKey == "1") { oldToolStripMenuItem.Enabled = false; } else if (Properties.Settings.Default.ProdectKey == "2") { newProductKeyToolStripMenuItem.Enabled = false; } } private void butProductKey_Click(object sender, EventArgs e) { if (txtPassword.Text == "05121996" || txtPassword.Text == "05121996") { txtProductKey.Text = GetHash(txtProductID.Text); } else { txtProductKey.Text = ""; } } public static string GetHash(string s) { string GetHash = ""; if (Properties.Settings.Default.ProdectKey == "1") { GetHash = GetHexString(new MD5CryptoServiceProvider().ComputeHash(new ASCIIEncoding().GetBytes(s))); } else if (Properties.Settings.Default.ProdectKey == "2") { GetHash = GetHexString2(new MD5CryptoServiceProvider().ComputeHash(new ASCIIEncoding().GetBytes(s))); } return GetHash; } private static string GetHexString2(byte[] bt) { string str1 = string.Empty; for (int index = 0; index < bt.Length; ++index) { int num1 = (int)bt[index]; int num2 = 18; int num3 = num1 & num2; int num4 = 6; int num5 = num1 >> num4 & 15; string str2 = num5 <= 6 ? str1 + num5.ToString() : str1 + ((char)(num5 - 4 + 65)).ToString(); str1 = num3 <= 6 ? str2 + num3.ToString() : str2 + ((char)(num3 - 4 + 65)).ToString(); if (index + 1 != bt.Length && (index + 1) % 2 == 0) str1 += "-"; } return str1; } private static string GetHexString(byte[] bt) { string str1 = string.Empty; for (int index = 0; index < bt.Length; ++index) { int num1 = (int)bt[index]; int num2 = 15; int num3 = num1 & num2; int num4 = 4; int num5 = num1 >> num4 & 15; string str2 = num5 <= 8 ? str1 + num5.ToString() : str1 + ((char)(num5 - 8 + 65)).ToString(); str1 = num3 <= 8 ? str2 + num3.ToString() : str2 + ((char)(num3 - 8 + 65)).ToString(); if (index + 1 != bt.Length && (index + 1) % 2 == 0) str1 += "-"; } return str1; } private void txtPassword_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtPassword.Text == "05121996" || txtPassword.Text == "05121996") { txtProductKey.Text = GetHash(txtProductID.Text); } else { txtProductKey.Text = ""; } } } private void ProductKey_Form_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.End) { Application.Exit(); } } private void oldToolStripMenuItem_Click(object sender, EventArgs e) { Properties.Settings.Default.ProdectKey = "1"; Properties.Settings.Default.Save(); newProductKeyToolStripMenuItem.Enabled = true; oldToolStripMenuItem.Enabled = false; } private void newProductKeyToolStripMenuItem_Click(object sender, EventArgs e) { Properties.Settings.Default.ProdectKey = "2"; Properties.Settings.Default.Save(); newProductKeyToolStripMenuItem.Enabled = false; oldToolStripMenuItem.Enabled =true ; } private void txtPassword_TextChanged(object sender, EventArgs e) { } } } (10-02-21, 10:39 PM)Ahmedmon كتب : ممكن استخراج معادله التفعيل من الكود هذا |