private string ProduceActivationKey() { string HDD_ID; string TLocalCode; try { HDD_ID = GetDriveSerialNumber("C:\\"); TLocalCode = (int.Parse("FF", NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(0, 2), NumberStyles.HexNumber)).ToString("X2") + "" + (int.Parse("FF", NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(2, 2), NumberStyles.HexNumber)).ToString("X2") + "" + (int.Parse("FF", NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(4, 2), NumberStyles.HexNumber)).ToString("X2") + "" + (int.Parse("FF", NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(6, 2), NumberStyles.HexNumber)).ToString("X2"); TLocalCode = TLocalCode.Substring(2, 1) + TLocalCode.Substring(7, 1) + TLocalCode.Substring(0, 1) + TLocalCode.Substring(4, 1) + TLocalCode.Substring(6, 1) + TLocalCode.Substring(1, 1) + TLocalCode.Substring(3, 1) + TLocalCode.Substring(5, 1); TLocalCode = TLocalCode.Substring(0, 2) + (int.Parse(TLocalCode.Substring(0, 2), NumberStyles.HexNumber) ^ int.Parse("FF", NumberStyles.HexNumber)).ToString("X2") + "" + TLocalCode.Substring(2, 2) + (int.Parse(TLocalCode.Substring(0, 2), NumberStyles.HexNumber) ^ int.Parse(TLocalCode.Substring(2, 2), NumberStyles.HexNumber)).ToString("X2") + "" + TLocalCode.Substring(4, 2) + (int.Parse(TLocalCode.Substring(0, 2), NumberStyles.HexNumber) ^ int.Parse(TLocalCode.Substring(2, 2), NumberStyles.HexNumber) ^ int.Parse(TLocalCode.Substring(4, 2), NumberStyles.HexNumber)).ToString("X2") + "" + TLocalCode.Substring(6, 2) + (int.Parse(TLocalCode.Substring(0, 2), NumberStyles.HexNumber) ^ int.Parse(TLocalCode.Substring(2, 2), NumberStyles.HexNumber) ^ int.Parse(TLocalCode.Substring(4, 2), NumberStyles.HexNumber) ^ int.Parse(TLocalCode.Substring(6, 2), NumberStyles.HexNumber)).ToString("X2"); return(TLocalCode); } catch (Exception) { return(string.Empty); } }
private bool CheckActivationCode(string TCounterCode) { string HDD_ID; string TCCStr; // HDD_ID = GetHardDiskSerialNo(); HDD_ID = GetDriveSerialNumber("C:\\"); if (TCounterCode == "" || TCounterCode == null) { return(false); } else { try { TCCStr = TCounterCode.Substring(13, 1) + TCounterCode.Substring(7, 1) + TCounterCode.Substring(11, 1) + TCounterCode.Substring(1, 1) + TCounterCode.Substring(15, 1) + TCounterCode.Substring(6, 1) + TCounterCode.Substring(10, 1) + TCounterCode.Substring(14, 1) + TCounterCode.Substring(4, 1) + TCounterCode.Substring(0, 1) + TCounterCode.Substring(5, 1) + TCounterCode.Substring(8, 1) + TCounterCode.Substring(2, 1) + TCounterCode.Substring(3, 1) + TCounterCode.Substring(9, 1) + TCounterCode.Substring(12, 1); TCCStr = (int.Parse(TCCStr.Substring(0, 4), NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(0, 2), NumberStyles.HexNumber)).ToString("X2") + "" + (int.Parse(TCCStr.Substring(4, 4), NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(2, 2), NumberStyles.HexNumber)).ToString("X2") + "" + (int.Parse(TCCStr.Substring(8, 4), NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(4, 2), NumberStyles.HexNumber)).ToString("X2") + "" + (int.Parse(TCCStr.Substring(12, 4), NumberStyles.HexNumber) - int.Parse(HDD_ID.Substring(6, 2), NumberStyles.HexNumber)).ToString("X2"); if (TCCStr == "A492B592") { return(true); } else { return(false); } } catch (Exception) { return(false); } } }