using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace CrackMe2 { public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Button registerButton; private System.Windows.Forms.TextBox registerCode; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.TextBox coolBox; private System.Windows.Forms.Button reverseButton; private System.Windows.Forms.GroupBox registeredGroup; private System.ComponentModel.Container components = null; public Form1() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.registerButton = new System.Windows.Forms.Button(); this.registerCode = new System.Windows.Forms.TextBox(); this.registeredGroup = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.coolBox = new System.Windows.Forms.TextBox(); this.reverseButton = new System.Windows.Forms.Button(); this.registeredGroup.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // registerButton // this.registerButton.Location = new System.Drawing.Point(176, 24); this.registerButton.Name = "registerButton"; this.registerButton.TabIndex = 0; this.registerButton.Text = "Register"; this.registerButton.Click += new System.EventHandler(this.registerButton_Click); // // registerCode // this.registerCode.Location = new System.Drawing.Point(8, 24); this.registerCode.Name = "registerCode"; this.registerCode.Size = new System.Drawing.Size(152, 20); this.registerCode.TabIndex = 1; this.registerCode.Text = ""; // // registeredGroup // this.registeredGroup.Controls.Add(this.reverseButton); this.registeredGroup.Controls.Add(this.coolBox); this.registeredGroup.Location = new System.Drawing.Point(8, 80); this.registeredGroup.Name = "registeredGroup"; this.registeredGroup.Size = new System.Drawing.Size(312, 72); this.registeredGroup.TabIndex = 2; this.registeredGroup.TabStop = false; this.registeredGroup.Text = "Registered User Features"; // // groupBox2 // this.groupBox2.Controls.Add(this.registerCode); this.groupBox2.Controls.Add(this.registerButton); this.groupBox2.Location = new System.Drawing.Point(8, 8); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(312, 64); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "Register to win cool prizes"; // // coolBox // this.coolBox.Location = new System.Drawing.Point(8, 24); this.coolBox.Name = "coolBox"; this.coolBox.ReadOnly = true; this.coolBox.Size = new System.Drawing.Size(152, 20); this.coolBox.TabIndex = 0; this.coolBox.Text = ""; // // reverseButton // this.reverseButton.Location = new System.Drawing.Point(176, 24); this.reverseButton.Name = "reverseButton"; this.reverseButton.Size = new System.Drawing.Size(88, 23); this.reverseButton.TabIndex = 1; this.reverseButton.Text = "Reverse Text"; this.reverseButton.Click += new System.EventHandler(this.reverseButton_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(328, 166); this.Controls.Add(this.groupBox2); this.Controls.Add(this.registeredGroup); this.Name = "Form1"; this.Text = "Crack Me 2"; this.registeredGroup.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); } #endregion [STAThread] static void Main() { Application.Run(new Form1()); } private void registerButton_Click(object sender, System.EventArgs e) { int serial; try { serial = int.Parse(this.registerCode.Text); } catch { MessageBox.Show(this, "Invalid serial."); return; } if ((serial & 1) == 1) { MessageBox.Show(this, "Invalid serial."); } else { this.coolBox.ReadOnly = false; MessageBox.Show(this, "Thank you for registering."); } } private void reverseButton_Click(object sender, System.EventArgs e) { char[] chars = this.coolBox.Text.ToCharArray(); Array.Reverse(chars); this.coolBox.Text = new string(chars); } } }