using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Text;
using System.Windows.Forms;

namespace crackme2
{
  [DesignerGenerated]
  public class Form1 : Form
  {
    private static List<WeakReference> __ENCList = new List<WeakReference>();
    private IContainer components;
    [AccessedThroughProperty("Button1")]
    private Button _Button1;
    [AccessedThroughProperty("TextBox1")]
    private TextBox _TextBox1;
    [AccessedThroughProperty("TextBox2")]
    private TextBox _TextBox2;
    [AccessedThroughProperty("Label1")]
    private Label _Label1;
    [AccessedThroughProperty("Label2")]
    private Label _Label2;

    [DebuggerNonUserCode]
    static Form1()
    {
    }

    [DebuggerNonUserCode]
    public Form1()
    {
      Form1.__ENCAddToList((object) this);
      this.InitializeComponent();
    }

    [DebuggerNonUserCode]
    private static void __ENCAddToList(object value)
    {
      lock (Form1.__ENCList)
      {
        if (Form1.__ENCList.Count == Form1.__ENCList.Capacity)
        {
          int index1 = 0;
          int num = checked (Form1.__ENCList.Count - 1);
          int index2 = 0;
          while (index2 <= num)
          {
            if (Form1.__ENCList[index2].IsAlive)
            {
              if (index2 != index1)
                Form1.__ENCList[index1] = Form1.__ENCList[index2];
              checked { ++index1; }
            }
            checked { ++index2; }
          }
          Form1.__ENCList.RemoveRange(index1, checked (Form1.__ENCList.Count - index1));
          Form1.__ENCList.Capacity = Form1.__ENCList.Count;
        }
        Form1.__ENCList.Add(new WeakReference(RuntimeHelpers.GetObjectValue(value)));
      }
    }

    [DebuggerNonUserCode]
    protected override void Dispose(bool disposing)
    {
      try
      {
        if (!disposing || this.components == null)
          return;
        this.components.Dispose();
      }
      finally
      {
        base.Dispose(disposing);
      }
    }

    [DebuggerStepThrough]
    private void InitializeComponent()
    {
      this.Button1 = new Button();
      this.TextBox1 = new TextBox();
      this.TextBox2 = new TextBox();
      this.Label1 = new Label();
      this.Label2 = new Label();
      this.SuspendLayout();
      Button button1_1 = this.Button1;
      Point point1 = new Point((int) sbyte.MaxValue, 95);
      Point point2 = point1;
      button1_1.Location = point2;
      this.Button1.Name = "Button1";
      Button button1_2 = this.Button1;
      Size size1 = new Size(130, 38);
      Size size2 = size1;
      button1_2.Size = size2;
      this.Button1.TabIndex = 0;
      this.Button1.Text = "Se connecter";
      this.Button1.UseVisualStyleBackColor = true;
      TextBox textBox1_1 = this.TextBox1;
      point1 = new Point((int) sbyte.MaxValue, 28);
      Point point3 = point1;
      textBox1_1.Location = point3;
      this.TextBox1.Name = "TextBox1";
      TextBox textBox1_2 = this.TextBox1;
      size1 = new Size(223, 20);
      Size size3 = size1;
      textBox1_2.Size = size3;
      this.TextBox1.TabIndex = 1;
      TextBox textBox2_1 = this.TextBox2;
      point1 = new Point((int) sbyte.MaxValue, 69);
      Point point4 = point1;
      textBox2_1.Location = point4;
      this.TextBox2.Name = "TextBox2";
      TextBox textBox2_2 = this.TextBox2;
      size1 = new Size(223, 20);
      Size size4 = size1;
      textBox2_2.Size = size4;
      this.TextBox2.TabIndex = 2;
      this.Label1.AutoSize = true;
      Label label1_1 = this.Label1;
      point1 = new Point(27, 31);
      Point point5 = point1;
      label1_1.Location = point5;
      this.Label1.Name = "Label1";
      Label label1_2 = this.Label1;
      size1 = new Size(87, 13);
      Size size5 = size1;
      label1_2.Size = size5;
      this.Label1.TabIndex = 3;
      this.Label1.Text = "Nom d'utilisateur:";
      this.Label2.AutoSize = true;
      Label label2_1 = this.Label2;
      point1 = new Point(27, 72);
      Point point6 = point1;
      label2_1.Location = point6;
      this.Label2.Name = "Label2";
      Label label2_2 = this.Label2;
      size1 = new Size(74, 13);
      Size size6 = size1;
      label2_2.Size = size6;
      this.Label2.TabIndex = 4;
      this.Label2.Text = "Mot de passe:";
      this.AutoScaleDimensions = new SizeF(6f, 13f);
      this.AutoScaleMode = AutoScaleMode.Font;
      size1 = new Size(395, 145);
      this.ClientSize = size1;
      this.Controls.Add((Control) this.Label2);
      this.Controls.Add((Control) this.Label1);
      this.Controls.Add((Control) this.TextBox2);
      this.Controls.Add((Control) this.TextBox1);
      this.Controls.Add((Control) this.Button1);
      this.Name = nameof (Form1);
      this.Text = "CrackMe";
      this.ResumeLayout(false);
      this.PerformLayout();
    }

    internal virtual Button Button1
    {
      [DebuggerNonUserCode] get => this._Button1;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set
      {
        EventHandler eventHandler = new EventHandler(this.Button1_Click);
        if (this._Button1 != null)
          this._Button1.Click -= eventHandler;
        this._Button1 = value;
        if (this._Button1 == null)
          return;
        this._Button1.Click += eventHandler;
      }
    }

    internal virtual TextBox TextBox1
    {
      [DebuggerNonUserCode] get => this._TextBox1;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set => this._TextBox1 = value;
    }

    internal virtual TextBox TextBox2
    {
      [DebuggerNonUserCode] get => this._TextBox2;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set => this._TextBox2 = value;
    }

    internal virtual Label Label1
    {
      [DebuggerNonUserCode] get => this._Label1;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set => this._Label1 = value;
    }

    internal virtual Label Label2
    {
      [DebuggerNonUserCode] get => this._Label2;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set => this._Label2 = value;
    }

    private void Button1_Click(object sender, EventArgs e)
    {
      ASCIIEncoding asciiEncoding = new ASCIIEncoding();
      asciiEncoding.GetBytes(this.TextBox2.Text);
      if (Operators.CompareString(this.TextBox1.Text, "admin", false) == 0)
      {
        string s = this.ESAB46_Encode(this.TextBox2.Text);
        if (Operators.CompareString(Convert.ToBase64String(asciiEncoding.GetBytes(s)), "TG0wVnZUQmQ3bndWdlRCVU15MGl2NEJSOG5OVjZ6NWdNS05rNno1ZzhtVmQ4c2hW", false) == 0)
        {
          int num1 = (int) Interaction.MsgBox((object) "Vous êtes bien loggué, bienvenue");
        }
        else
        {
          int num2 = (int) Interaction.MsgBox((object) "Mauvais mot de passe");
        }
      }
      else
      {
        int num = (int) Interaction.MsgBox((object) "Utilisateur inconnu !");
      }
    }

    public string ESAB46_Encode(string input)
    {
      input = Uri.EscapeDataString(input);
      string str = "ABCDqrs456tuvNOPwxyz012KLM3789=+QRSTUVWXYZabcdefghijklmnopEFGHIJ/";
      StringBuilder stringBuilder = new StringBuilder();
      int index1;
      do
      {
        int[] numArray1 = new int[4];
        int[] numArray2 = new int[3]{ 0, 0, 0 };
        int index2 = 0;
        do
        {
          if (index1 < input.Length)
            numArray2[index2] = Strings.Asc(input[index1]);
          checked { ++index1; }
          checked { ++index2; }
        }
        while (index2 <= 2);
        numArray1[0] = numArray2[0] >> 2;
        numArray1[1] = (numArray2[0] & 3) << 4 | numArray2[1] >> 4;
        numArray1[2] = (numArray2[1] & 15) << 2 | numArray2[2] >> 6;
        numArray1[3] = numArray2[2] & 63;
        if (numArray2[1] == 0)
        {
          numArray1[2] = 64;
          numArray1[3] = 64;
        }
        if (numArray2[2] == 0)
          numArray1[3] = 64;
        int[] numArray3 = numArray1;
        int index3 = 0;
        while (index3 < numArray3.Length)
        {
          int index4 = numArray3[index3];
          stringBuilder.Append(str[index4]);
          checked { ++index3; }
        }
      }
      while (index1 < input.Length);
      return stringBuilder.ToString();
    }

    public string ESAB46_Decode(string input)
    {
      string str = "ABCDqrs456tuvNOPwxyz012KLM3789=+QRSTUVWXYZabcdefghijklmnopEFGHIJ/";
      StringBuilder stringBuilder = new StringBuilder();
      int index1;
      do
      {
        int[] numArray1 = new int[4];
        int[] numArray2 = new int[3]{ 0, 0, 0 };
        int index2 = 0;
        do
        {
          numArray1[index2] = str.IndexOf(input[index1]);
          checked { ++index1; }
          checked { ++index2; }
        }
        while (index2 <= 3);
        numArray2[0] = numArray1[0] << 2 | numArray1[1] >> 4;
        numArray2[1] = (numArray1[1] & 15) << 4 | numArray1[2] >> 2;
        numArray2[2] = (numArray1[2] & 3) << 6 | numArray1[3];
        stringBuilder.Append(Strings.Chr(numArray2[0]));
        if (numArray1[2] != 64)
          stringBuilder.Append(Strings.Chr(numArray2[1]));
        if (numArray1[3] != 64)
          stringBuilder.Append(Strings.Chr(numArray2[2]));
      }
      while (index1 < input.Length);
      return stringBuilder.ToString();
    }
  }
}
 

C Sharp Online Compiler

Write, Run & Share C# code online using OneCompiler's C# online compiler for free. It's one of the robust, feature-rich online compilers for C# language, running on the latest version 8.0. Getting started with the OneCompiler's C# compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C# and start coding.

Read inputs from stdin

OneCompiler's C# online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.

using System;
 
namespace Sample
{
  class Test
    {
      public static void Main(string[] args)
       {
         string name;
         name = Console.ReadLine();
         Console.WriteLine("Hello {0} ", name);
	}
     }
}

About C Sharp

C# is a general purpose object-oriented programming language by Microsoft. Though initially it was developed as part of .net but later it was approved by ECMA and ISO standards.

You can use C# to create variety of applications, like web, windows, mobile, console applications and much more using Visual studio.

Syntax help

Data types

Data TypeDescriptionRangesize
intTo store integers-2,147,483,648 to 2,147,483,6474 bytes
doubleto store large floating point numbers with decimalscan store 15 decimal digits8 bytes
floatto store floating point numbers with decimalscan store upto 7 decimal digits4 bytes
charto store single characters-2 bytes
stringto stores text-2 bytes per character
boolto stores either true or false-1 bit

Variables

Syntax

datatype variable-name = value;

Loops

1. If-Else:

When ever you want to perform a set of operations based on a condition or set of few conditions IF-ELSE is used.

if(conditional-expression) {
   // code
} 
else {
   // code
}

You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.

2. Switch:

Switch is an alternative to If-Else-If ladder.

switch(conditional-expression) {    
case value1:    
 // code    
 break;  // optional  
case value2:    
 // code    
 break;  // optional  
...    
    
default:     
 // code to be executed when all the above cases are not matched;    
} 

3. For:

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement) {
  // code  
} 

4. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while(condition) {
 // code 
}

5. Do-While:

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {
  // code 
} while (condition);

Arrays

Array is a collection of similar data which is stored in continuous memory addresses. Array values can be fetched using index. Index starts from 0 to size-1.

Syntax

data-type[] array-name;

Methods

Method is a set of statements which gets executed only when they are called. Call the method name in the main function to execute the method.

Syntax

static void method-name() 
{
  // code to be executed
}