Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. using System;
  2. using System.Xml;
  3. using System.Windows.Forms;
  4.  
  5. namespace Loginfinal
  6. {
  7. public partial class Form1 : MaterialSkin.Controls.MaterialForm
  8. {
  9. public Form1()
  10. {
  11. InitializeComponent();
  12. }
  13.  
  14. private void Form1_Load(object sender, EventArgs e)
  15. {
  16.  
  17. }
  18.  
  19. private void LoadAccounts(bool RedactPasswords)
  20. {
  21. AccountList.Items.Clear();
  22. XmlDocument XMLAccounts = new XmlDocument();
  23. string Accounts = RequestManager.RequestAccounts(Identity.ID);
  24.  
  25. try
  26. {
  27. XMLAccounts.LoadXml(Accounts);
  28.  
  29. foreach (XmlNode Account in XMLAccounts.SelectNodes("Accounts/Account"))
  30. {
  31. string UID = Account.SelectSingleNode("id").InnerText;
  32. string Username = Account.SelectSingleNode("username").InnerText;
  33. string Password = Account.SelectSingleNode("password").InnerText;
  34. string URL = Account.SelectSingleNode("url").InnerText;
  35. string[] AccountToAdd = { UID, Username, Password, URL };
  36. ListViewItem AccountListItem = new ListViewItem(AccountToAdd);
  37. AccountList.Items.Add(AccountListItem);
  38. }
  39. AccountList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
  40. }
  41. catch (Exception e)
  42. {
  43. MessageBox.Show(e.ToString());
  44. }
  45.  
  46. if (RedactPasswords)
  47. PasswordRedaction();
  48. }
  49.  
  50. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  51. {
  52. PasswordRedaction();
  53. }
  54.  
  55. private void PasswordRedaction()
  56. {
  57. if (PasswordHideCheckBox.Checked)
  58. {
  59. foreach (ListViewItem item in AccountList.Items)
  60. {
  61. int AsteriskCount = item.SubItems[2].Text.Length;
  62. string Asterisk = new string('*', AsteriskCount);
  63. if (AsteriskCount < 12)
  64. AsteriskCount += 10;
  65. item.SubItems[2].Text = Asterisk;
  66. }
  67. }
  68. else
  69. {
  70. AccountList.Items.Clear();
  71. LoadAccounts(false);
  72. }
  73. AccountList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
  74. }
  75.  
  76. private void AccountList_DoubleClick(object sender, EventArgs e)
  77. {
  78. if (PasswordHideCheckBox.Checked)
  79. LoadAccounts(false);
  80.  
  81. string Username = AccountList.SelectedItems[0].SubItems[1].Text;
  82. string Password = AccountList.SelectedItems[0].SubItems[2].Text;
  83.  
  84. if (PasswordHideCheckBox.Checked)
  85. LoadAccounts(true);
  86.  
  87. if (AccountList.SelectedItems.Count > 0)
  88. RequestManager.Login(Username, Password);
  89. }
  90.  
  91. private void CheckINISettingsSet()
  92. {
  93. Ini INISettings = new Ini();
  94. string SteamPath = INISettings.Read("SteamLocation");
  95.  
  96. if (string.IsNullOrEmpty(SteamPath))
  97. {
  98. OpenFileDialog SetSteamPath = new OpenFileDialog();
  99. SetSteamPath.Filter = "Applications (*.exe)|*.exe";
  100. SetSteamPath.ShowDialog();
  101. INISettings.Write("SteamLocation", SetSteamPath.FileName);
  102. MessageBox.Show("Steam path has been saved!", "Settings Saved!", MessageBoxButtons.OK, MessageBoxIcon.Information);
  103. }
  104. }
  105.  
  106. private void button1_Click(object sender, EventArgs e)
  107. {
  108. CheckINISettingsSet();
  109. StatusStripAuthString.Text = string.Format("Auth String: {0}", Identity.HWID());
  110. LoadAccounts(true);
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement