Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.66 KB | None | 0 0
  1. //UserLogin.cs
  2. //--USER GENERATED CODE--
  3.  
  4. using System;
  5. using System.Windows.Forms;
  6.  
  7. namespace WoWAuthenticate
  8. {
  9.     public partial class UserLogin : Form
  10.     {
  11.         private string userName;
  12.         private string password;
  13.  
  14.         private WoWAuthForm wowAuthForm;
  15.  
  16.         public UserLogin(WoWAuthForm AuthForm)
  17.         {
  18.             InitializeComponent();
  19.             wowAuthForm = AuthForm;
  20.         }
  21.  
  22.         private void IsFieldsValid()
  23.         {
  24.             if ((userNameBox.Text != "") && (passwordBox.Text != "") && (password2Box.Text == passwordBox.Text))
  25.             {
  26.                 userName = userNameBox.Text;
  27.                 password = passwordBox.Text;
  28.                 loginButton.Enabled = true;
  29.             }
  30.             else
  31.             {
  32.                 loginButton.Enabled = false;
  33.             }
  34.         }
  35.  
  36.         private void userNameBox_TextChanged(object sender, EventArgs e)
  37.         {
  38.             IsFieldsValid();
  39.         }
  40.  
  41.         private void passwordBox_TextChanged(object sender, EventArgs e)
  42.         {
  43.             IsFieldsValid();
  44.         }
  45.  
  46.         private void password2Box_TextChanged(object sender, EventArgs e)
  47.         {
  48.             IsFieldsValid();
  49.         }
  50.  
  51.         private void loginButton_Click(object sender, EventArgs e)
  52.         {
  53.             try
  54.             {
  55.                 string lines = userName + Environment.NewLine + password;
  56.                 System.IO.StreamWriter file = new System.IO.StreamWriter("info_bnet.txt");
  57.                 file.WriteLine(lines);
  58.                 file.Close();
  59.             }
  60.             catch (Exception ex)
  61.             {
  62.                 MessageBox.Show(ex.Message, ex.Source);
  63.             }
  64.             wowAuthForm.AddProgress();
  65.             wowAuthForm.ValidateGame();
  66.             Close();
  67.         }
  68.     }
  69. }
  70.  
  71. //--END USER GENERATED CODE--
  72.  
  73. //--BEGIN DESIGNER GENERATED CODE
  74.  
  75. namespace WoWAuthenticate
  76. {
  77.     partial class UserLogin
  78.     {
  79.         /// <summary>
  80.         /// Required designer variable.
  81.         /// </summary>
  82.         private System.ComponentModel.IContainer components = null;
  83.  
  84.         /// <summary>
  85.         /// Clean up any resources being used.
  86.         /// </summary>
  87.         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  88.         protected override void Dispose(bool disposing)
  89.         {
  90.             if (disposing && (components != null))
  91.             {
  92.                 components.Dispose();
  93.             }
  94.             base.Dispose(disposing);
  95.         }
  96.  
  97.         #region Windows Form Designer generated code
  98.  
  99.         /// <summary>
  100.         /// Required method for Designer support - do not modify
  101.         /// the contents of this method with the code editor.
  102.         /// </summary>
  103.         private void InitializeComponent()
  104.         {
  105.             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserLogin));
  106.             this.label1 = new System.Windows.Forms.Label();
  107.             this.label2 = new System.Windows.Forms.Label();
  108.             this.userNameBox = new System.Windows.Forms.TextBox();
  109.             this.label3 = new System.Windows.Forms.Label();
  110.             this.passwordBox = new System.Windows.Forms.TextBox();
  111.             this.label4 = new System.Windows.Forms.Label();
  112.             this.password2Box = new System.Windows.Forms.TextBox();
  113.             this.loginButton = new System.Windows.Forms.Button();
  114.             this.SuspendLayout();
  115.             //
  116.             // label1
  117.             //
  118.             this.label1.AutoSize = true;
  119.             this.label1.Location = new System.Drawing.Point(13, 13);
  120.             this.label1.Name = "label1";
  121.             this.label1.Size = new System.Drawing.Size(257, 13);
  122.             this.label1.TabIndex = 0;
  123.             this.label1.Text = "Please input your Battle.net username and password.";
  124.             //
  125.             // label2
  126.             //
  127.             this.label2.AutoSize = true;
  128.             this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  129.             this.label2.Location = new System.Drawing.Point(12, 54);
  130.             this.label2.Name = "label2";
  131.             this.label2.Size = new System.Drawing.Size(104, 13);
  132.             this.label2.TabIndex = 1;
  133.             this.label2.Text = "Username (email)";
  134.             //
  135.             // userNameBox
  136.             //
  137.             this.userNameBox.Location = new System.Drawing.Point(131, 51);
  138.             this.userNameBox.Name = "userNameBox";
  139.             this.userNameBox.Size = new System.Drawing.Size(135, 20);
  140.             this.userNameBox.TabIndex = 2;
  141.             this.userNameBox.TextChanged += new System.EventHandler(this.userNameBox_TextChanged);
  142.             //
  143.             // label3
  144.             //
  145.             this.label3.AutoSize = true;
  146.             this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  147.             this.label3.Location = new System.Drawing.Point(12, 82);
  148.             this.label3.Name = "label3";
  149.             this.label3.Size = new System.Drawing.Size(61, 13);
  150.             this.label3.TabIndex = 3;
  151.             this.label3.Text = "Password";
  152.             //
  153.             // passwordBox
  154.             //
  155.             this.passwordBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  156.             this.passwordBox.Location = new System.Drawing.Point(131, 79);
  157.             this.passwordBox.Name = "passwordBox";
  158.             this.passwordBox.PasswordChar = '*';
  159.             this.passwordBox.Size = new System.Drawing.Size(135, 20);
  160.             this.passwordBox.TabIndex = 4;
  161.             this.passwordBox.TextChanged += new System.EventHandler(this.passwordBox_TextChanged);
  162.             //
  163.             // label4
  164.             //
  165.             this.label4.AutoSize = true;
  166.             this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  167.             this.label4.Location = new System.Drawing.Point(12, 107);
  168.             this.label4.Name = "label4";
  169.             this.label4.Size = new System.Drawing.Size(113, 13);
  170.             this.label4.TabIndex = 5;
  171.             this.label4.Text = "Re-enter password";
  172.             //
  173.             // password2Box
  174.             //
  175.             this.password2Box.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  176.             this.password2Box.Location = new System.Drawing.Point(131, 104);
  177.             this.password2Box.Name = "password2Box";
  178.             this.password2Box.PasswordChar = '*';
  179.             this.password2Box.Size = new System.Drawing.Size(135, 20);
  180.             this.password2Box.TabIndex = 6;
  181.             this.password2Box.TextChanged += new System.EventHandler(this.password2Box_TextChanged);
  182.             //
  183.             // loginButton
  184.             //
  185.             this.loginButton.Enabled = false;
  186.             this.loginButton.Location = new System.Drawing.Point(12, 132);
  187.             this.loginButton.Name = "loginButton";
  188.             this.loginButton.Size = new System.Drawing.Size(274, 23);
  189.             this.loginButton.TabIndex = 7;
  190.             this.loginButton.Text = "Validate";
  191.             this.loginButton.UseVisualStyleBackColor = true;
  192.             this.loginButton.Click += new System.EventHandler(this.loginButton_Click);
  193.             //
  194.             // UserLogin
  195.             //
  196.             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  197.             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  198.             this.ClientSize = new System.Drawing.Size(298, 167);
  199.             this.ControlBox = false;
  200.             this.Controls.Add(this.loginButton);
  201.             this.Controls.Add(this.password2Box);
  202.             this.Controls.Add(this.label4);
  203.             this.Controls.Add(this.passwordBox);
  204.             this.Controls.Add(this.label3);
  205.             this.Controls.Add(this.userNameBox);
  206.             this.Controls.Add(this.label2);
  207.             this.Controls.Add(this.label1);
  208.             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
  209.             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  210.             this.Name = "UserLogin";
  211.             this.ShowInTaskbar = false;
  212.             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  213.             this.Text = "Battle.Net Validation";
  214.             this.ResumeLayout(false);
  215.             this.PerformLayout();
  216.  
  217.         }
  218.  
  219.         #endregion
  220.  
  221.         private System.Windows.Forms.Label label1;
  222.         private System.Windows.Forms.Label label2;
  223.         private System.Windows.Forms.TextBox userNameBox;
  224.         private System.Windows.Forms.Label label3;
  225.         private System.Windows.Forms.TextBox passwordBox;
  226.         private System.Windows.Forms.Label label4;
  227.         private System.Windows.Forms.TextBox password2Box;
  228.         private System.Windows.Forms.Button loginButton;
  229.     }
  230. }
  231.  
  232. //--END DESIGNER GENERATED CODE--
  233.  
  234. //EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement