F_LicCode.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Management;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Dongke.IBOSS.PRD.Basics.Library;
  11. namespace Dongke.IBOSS.PRD.WCF.Hosting
  12. {
  13. public partial class F_LicCode : Form
  14. {
  15. public F_LicCode(string sid)
  16. {
  17. InitializeComponent();
  18. try
  19. {
  20. this.textBox1.Text = Encryption.EncryptDES(this.UUID + "_" + sid, sid);
  21. }
  22. catch
  23. {
  24. }
  25. }
  26. public string UUID
  27. {
  28. get
  29. {
  30. try
  31. {
  32. string code = null;
  33. SelectQuery query = new SelectQuery("select * from Win32_ComputerSystemProduct");
  34. using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
  35. {
  36. foreach (var item in searcher.Get())
  37. {
  38. using (item)
  39. {
  40. code = item["UUID"].ToString();
  41. }
  42. }
  43. }
  44. return code;
  45. }
  46. catch
  47. {
  48. return null;
  49. }
  50. }
  51. }
  52. private void btnClose_Click(object sender, EventArgs e)
  53. {
  54. this.Close();
  55. }
  56. private void btnCopy_Click(object sender, EventArgs e)
  57. {
  58. try
  59. {
  60. Clipboard.SetText(this.textBox1.Text);
  61. }
  62. catch
  63. {
  64. }
  65. }
  66. }
  67. }