mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-22 11:26:11 +00:00
545 lines
18 KiB
C#
545 lines
18 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: HexConverter.Form1
|
|||
|
// Assembly: HexConverter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|||
|
// MVID: 69C743DF-5670-4BA1-B9C9-0F7A066F699A
|
|||
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Otwycal.a-e8185cfeb5eed43452d4fc000bc9dad88c82a7d405e4cc7e61131d390a782aa2.exe
|
|||
|
|
|||
|
using System;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Drawing;
|
|||
|
using System.Text;
|
|||
|
using System.Text.RegularExpressions;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace HexConverter
|
|||
|
{
|
|||
|
public class Form1 : Form
|
|||
|
{
|
|||
|
private IContainer components;
|
|||
|
private TextBox tBoxBytes;
|
|||
|
private TextBox tBoxHex;
|
|||
|
private TextBox tBoxDecimal;
|
|||
|
private TextBox tBoxBin;
|
|||
|
private Label label1;
|
|||
|
private Label label2;
|
|||
|
private Label label3;
|
|||
|
private Label label4;
|
|||
|
private ComboBox cbBoxType;
|
|||
|
private Button butExit;
|
|||
|
private Label label5;
|
|||
|
private Button butAbout;
|
|||
|
private bool IsUserInput;
|
|||
|
|
|||
|
protected override void Dispose(bool disposing)
|
|||
|
{
|
|||
|
if (disposing && this.components != null)
|
|||
|
this.components.Dispose();
|
|||
|
base.Dispose(disposing);
|
|||
|
}
|
|||
|
|
|||
|
private void InitializeComponent()
|
|||
|
{
|
|||
|
ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (Form1));
|
|||
|
this.tBoxBytes = new TextBox();
|
|||
|
this.tBoxHex = new TextBox();
|
|||
|
this.tBoxDecimal = new TextBox();
|
|||
|
this.tBoxBin = new TextBox();
|
|||
|
this.label1 = new Label();
|
|||
|
this.label2 = new Label();
|
|||
|
this.label3 = new Label();
|
|||
|
this.label4 = new Label();
|
|||
|
this.cbBoxType = new ComboBox();
|
|||
|
this.butExit = new Button();
|
|||
|
this.label5 = new Label();
|
|||
|
this.butAbout = new Button();
|
|||
|
this.SuspendLayout();
|
|||
|
this.tBoxBytes.Location = new Point(155, 60);
|
|||
|
this.tBoxBytes.Name = "tBoxBytes";
|
|||
|
this.tBoxBytes.ReadOnly = true;
|
|||
|
this.tBoxBytes.Size = new Size(150, 20);
|
|||
|
this.tBoxBytes.TabIndex = 4;
|
|||
|
this.tBoxHex.Location = new Point(10, 60);
|
|||
|
this.tBoxHex.MaxLength = 16;
|
|||
|
this.tBoxHex.Name = "tBoxHex";
|
|||
|
this.tBoxHex.Size = new Size(135, 20);
|
|||
|
this.tBoxHex.TabIndex = 3;
|
|||
|
this.tBoxHex.TextChanged += new EventHandler(this.tBoxHex_TextChanged);
|
|||
|
this.tBoxDecimal.Location = new Point(10, 20);
|
|||
|
this.tBoxDecimal.MaxLength = 20;
|
|||
|
this.tBoxDecimal.Name = "tBoxDecimal";
|
|||
|
this.tBoxDecimal.Size = new Size(135, 20);
|
|||
|
this.tBoxDecimal.TabIndex = 0;
|
|||
|
this.tBoxDecimal.TextChanged += new EventHandler(this.tBoxDecimal_TextChanged);
|
|||
|
this.tBoxBin.Font = new Font("Microsoft Sans Serif", 7f, FontStyle.Regular, GraphicsUnit.Point, (byte) 136);
|
|||
|
this.tBoxBin.Location = new Point(10, 100);
|
|||
|
this.tBoxBin.Name = "tBoxBin";
|
|||
|
this.tBoxBin.ReadOnly = true;
|
|||
|
this.tBoxBin.Size = new Size(330, 18);
|
|||
|
this.tBoxBin.TabIndex = 6;
|
|||
|
this.label1.AutoSize = true;
|
|||
|
this.label1.Location = new Point(155, 45);
|
|||
|
this.label1.Name = "label1";
|
|||
|
this.label1.Size = new Size(72, 13);
|
|||
|
this.label1.TabIndex = 4;
|
|||
|
this.label1.Text = "位元組 Bytes";
|
|||
|
this.label2.AutoSize = true;
|
|||
|
this.label2.Location = new Point(10, 45);
|
|||
|
this.label2.Name = "label2";
|
|||
|
this.label2.Size = new Size(65, 13);
|
|||
|
this.label2.TabIndex = 5;
|
|||
|
this.label2.Text = "16進位 Hex";
|
|||
|
this.label3.AutoSize = true;
|
|||
|
this.label3.Location = new Point(10, 5);
|
|||
|
this.label3.Name = "label3";
|
|||
|
this.label3.Size = new Size(84, 13);
|
|||
|
this.label3.TabIndex = 6;
|
|||
|
this.label3.Text = "10進位 Decimal";
|
|||
|
this.label4.AutoSize = true;
|
|||
|
this.label4.Location = new Point(10, 85);
|
|||
|
this.label4.Name = "label4";
|
|||
|
this.label4.Size = new Size(69, 13);
|
|||
|
this.label4.TabIndex = 7;
|
|||
|
this.label4.Text = "2進位 Binary";
|
|||
|
this.cbBoxType.DropDownStyle = ComboBoxStyle.DropDownList;
|
|||
|
this.cbBoxType.FormattingEnabled = true;
|
|||
|
this.cbBoxType.Items.AddRange(new object[10]
|
|||
|
{
|
|||
|
(object) "Byte",
|
|||
|
(object) "Byte (signed)",
|
|||
|
(object) "2 Bytes",
|
|||
|
(object) "2 Bytes (signed)",
|
|||
|
(object) "4 Bytes",
|
|||
|
(object) "4 Bytes (signed)",
|
|||
|
(object) "8 Bytes",
|
|||
|
(object) "8 Bytes (signed)",
|
|||
|
(object) "Float",
|
|||
|
(object) "Double"
|
|||
|
});
|
|||
|
this.cbBoxType.Location = new Point(155, 20);
|
|||
|
this.cbBoxType.Name = "cbBoxType";
|
|||
|
this.cbBoxType.Size = new Size(120, 21);
|
|||
|
this.cbBoxType.TabIndex = 1;
|
|||
|
this.cbBoxType.SelectedIndexChanged += new EventHandler(this.comboBox1_SelectedIndexChanged);
|
|||
|
this.butExit.Location = new Point(280, 20);
|
|||
|
this.butExit.Name = "butExit";
|
|||
|
this.butExit.Size = new Size(60, 20);
|
|||
|
this.butExit.TabIndex = 5;
|
|||
|
this.butExit.Text = "Exit";
|
|||
|
this.butExit.UseVisualStyleBackColor = true;
|
|||
|
this.butExit.Click += new EventHandler(this.button1_Click);
|
|||
|
this.label5.AutoSize = true;
|
|||
|
this.label5.Location = new Point(155, 5);
|
|||
|
this.label5.Name = "label5";
|
|||
|
this.label5.Size = new Size(58, 13);
|
|||
|
this.label5.TabIndex = 10;
|
|||
|
this.label5.Text = "類型 Type";
|
|||
|
this.butAbout.Location = new Point(310, 60);
|
|||
|
this.butAbout.Name = "butAbout";
|
|||
|
this.butAbout.Size = new Size(30, 20);
|
|||
|
this.butAbout.TabIndex = 2;
|
|||
|
this.butAbout.Text = "?";
|
|||
|
this.butAbout.UseVisualStyleBackColor = true;
|
|||
|
this.butAbout.Click += new EventHandler(this.button2_Click);
|
|||
|
this.AutoScaleDimensions = new SizeF(6f, 13f);
|
|||
|
this.AutoScaleMode = AutoScaleMode.Font;
|
|||
|
this.ClientSize = new Size(349, 128);
|
|||
|
this.Controls.Add((Control) this.butAbout);
|
|||
|
this.Controls.Add((Control) this.label5);
|
|||
|
this.Controls.Add((Control) this.butExit);
|
|||
|
this.Controls.Add((Control) this.cbBoxType);
|
|||
|
this.Controls.Add((Control) this.label4);
|
|||
|
this.Controls.Add((Control) this.label3);
|
|||
|
this.Controls.Add((Control) this.label2);
|
|||
|
this.Controls.Add((Control) this.label1);
|
|||
|
this.Controls.Add((Control) this.tBoxBin);
|
|||
|
this.Controls.Add((Control) this.tBoxDecimal);
|
|||
|
this.Controls.Add((Control) this.tBoxHex);
|
|||
|
this.Controls.Add((Control) this.tBoxBytes);
|
|||
|
this.FormBorderStyle = FormBorderStyle.FixedSingle;
|
|||
|
this.Icon = (Icon) componentResourceManager.GetObject("$this.Icon");
|
|||
|
this.MaximizeBox = false;
|
|||
|
this.Name = nameof (Form1);
|
|||
|
this.StartPosition = FormStartPosition.CenterScreen;
|
|||
|
this.Text = "Hex Converter";
|
|||
|
this.Load += new EventHandler(this.Form1_Load);
|
|||
|
this.ResumeLayout(false);
|
|||
|
this.PerformLayout();
|
|||
|
}
|
|||
|
|
|||
|
public Form1() => this.InitializeComponent();
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e) => Application.Exit();
|
|||
|
|
|||
|
private void Form1_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.cbBoxType.SelectedIndex = 4;
|
|||
|
this.IsUserInput = true;
|
|||
|
}
|
|||
|
|
|||
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.tBoxBytes.Text = "";
|
|||
|
this.tBoxHex.Text = "";
|
|||
|
this.tBoxDecimal.Text = "";
|
|||
|
this.tBoxBin.Text = "";
|
|||
|
}
|
|||
|
|
|||
|
private void tBoxDecimal_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!this.IsUserInput)
|
|||
|
return;
|
|||
|
this.IsUserInput = false;
|
|||
|
int num1 = this.tBoxDecimal.SelectionStart;
|
|||
|
string text = this.tBoxDecimal.Text;
|
|||
|
byte[] b = (byte[]) null;
|
|||
|
int num2 = 1;
|
|||
|
if (text.Length != 0 && text[0] == '-')
|
|||
|
num2 = -1;
|
|||
|
string s;
|
|||
|
if (this.cbBoxType.SelectedIndex == 0)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (s.Length == 0)
|
|||
|
{
|
|||
|
b = (byte[]) null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 3)
|
|||
|
s = s.Substring(0, 3);
|
|||
|
if (s.Length == 3 && s.CompareTo("255") > 0)
|
|||
|
s = "255";
|
|||
|
b = new byte[1]{ (byte) Convert.ToUInt16(s) };
|
|||
|
}
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 1)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (num2 < 0)
|
|||
|
s = '-'.ToString() + s;
|
|||
|
if (s.Length == 0 || s.Equals("-"))
|
|||
|
b = (byte[]) null;
|
|||
|
else if (num2 > 0)
|
|||
|
{
|
|||
|
if (s.Length > 3)
|
|||
|
s = s.Substring(0, 3);
|
|||
|
if (s.Length == 3 && s.CompareTo("127") > 0)
|
|||
|
s = "127";
|
|||
|
b = new byte[1]{ (byte) Convert.ToInt16(s) };
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 4)
|
|||
|
s = s.Substring(0, 4);
|
|||
|
if (s.Length == 4 && s.CompareTo("-128") > 0)
|
|||
|
s = "-128";
|
|||
|
b = new byte[1]{ (byte) Convert.ToInt16(s) };
|
|||
|
}
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 2)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (s.Length == 0)
|
|||
|
{
|
|||
|
b = (byte[]) null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 5)
|
|||
|
s = s.Substring(0, 5);
|
|||
|
if (s.Length == 5 && s.CompareTo("65535") > 0)
|
|||
|
s = "65535";
|
|||
|
b = BitConverter.GetBytes(Convert.ToUInt16(s));
|
|||
|
}
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 3)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (num2 < 0)
|
|||
|
s = '-'.ToString() + s;
|
|||
|
if (s.Length == 0 || s.Equals("-"))
|
|||
|
b = (byte[]) null;
|
|||
|
else if (num2 > 0)
|
|||
|
{
|
|||
|
if (s.Length > 5)
|
|||
|
s = s.Substring(0, 5);
|
|||
|
if (s.Length == 5 && s.CompareTo("32767") > 0)
|
|||
|
s = "32767";
|
|||
|
b = BitConverter.GetBytes(Convert.ToInt16(s));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 6)
|
|||
|
s = s.Substring(0, 6);
|
|||
|
if (s.Length == 6 && s.CompareTo("-32768") > 0)
|
|||
|
s = "-32768";
|
|||
|
b = BitConverter.GetBytes(Convert.ToInt16(s));
|
|||
|
}
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 4)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (s.Length == 0)
|
|||
|
{
|
|||
|
b = (byte[]) null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 10)
|
|||
|
s = s.Substring(0, 10);
|
|||
|
if (s.Length == 10 && s.CompareTo("4294967295") > 0)
|
|||
|
s = "4294967295";
|
|||
|
b = BitConverter.GetBytes(Convert.ToUInt32(s));
|
|||
|
}
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 5)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (num2 < 0)
|
|||
|
s = '-'.ToString() + s;
|
|||
|
if (s.Length == 0 || s.Equals("-"))
|
|||
|
b = (byte[]) null;
|
|||
|
else if (num2 > 0)
|
|||
|
{
|
|||
|
if (s.Length > 10)
|
|||
|
s = s.Substring(0, 10);
|
|||
|
if (s.Length == 10 && s.CompareTo("2147483647") > 0)
|
|||
|
s = "2147483647";
|
|||
|
b = BitConverter.GetBytes(Convert.ToInt32(s));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 11)
|
|||
|
s = s.Substring(0, 11);
|
|||
|
if (s.Length == 11 && s.CompareTo("-2147483648") > 0)
|
|||
|
s = "-2147483648";
|
|||
|
b = BitConverter.GetBytes(Convert.ToInt32(s));
|
|||
|
}
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 6)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (s.Length == 0)
|
|||
|
{
|
|||
|
b = (byte[]) null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 19 && s.CompareTo("18446744073709551615") > 0)
|
|||
|
s = "18446744073709551615";
|
|||
|
b = BitConverter.GetBytes(Convert.ToUInt64(s));
|
|||
|
}
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 7)
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^0-9]", "");
|
|||
|
if (num2 < 0)
|
|||
|
s = '-'.ToString() + s;
|
|||
|
if (s.Length == 0 || s.Equals("-"))
|
|||
|
b = (byte[]) null;
|
|||
|
else if (num2 > 0)
|
|||
|
{
|
|||
|
if (s.Length > 19 && s.CompareTo("9223372036854775807") > 0)
|
|||
|
s = "9223372036854775807";
|
|||
|
b = BitConverter.GetBytes(Convert.ToInt64(s));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (s.Length > 19 && s.CompareTo("-9223372036854775808") > 0)
|
|||
|
s = "-9223372036854775808";
|
|||
|
b = BitConverter.GetBytes(Convert.ToInt64(s));
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
s = Regex.Replace(text, "[^.0-9]", "");
|
|||
|
int index1 = 0;
|
|||
|
while (index1 < s.Length && s[index1] != '.')
|
|||
|
++index1;
|
|||
|
for (int index2 = index1 + 1; index2 < s.Length; ++index2)
|
|||
|
{
|
|||
|
if (s[index2] == '.')
|
|||
|
s = s.Remove(index2--, 1);
|
|||
|
}
|
|||
|
if (num2 < 0)
|
|||
|
s = '-'.ToString() + s;
|
|||
|
if (s.Length > 20)
|
|||
|
s = s.Substring(0, 20);
|
|||
|
if (s.Length == 0 || s.Equals(".") || s.Equals("-") || s.Equals("-."))
|
|||
|
b = (byte[]) null;
|
|||
|
else if (this.cbBoxType.SelectedIndex == 8)
|
|||
|
b = BitConverter.GetBytes(float.Parse(s));
|
|||
|
else if (this.cbBoxType.SelectedIndex == 9)
|
|||
|
b = BitConverter.GetBytes(double.Parse(s));
|
|||
|
}
|
|||
|
this.tBoxHex.Text = this.ToHex(b);
|
|||
|
this.tBoxBin.Text = this.ToBin(b);
|
|||
|
this.tBoxBytes.Text = this.ToRevHex(b);
|
|||
|
this.tBoxDecimal.Text = s;
|
|||
|
if (num1 < 0)
|
|||
|
num1 = 0;
|
|||
|
this.tBoxDecimal.SelectionStart = num1;
|
|||
|
this.IsUserInput = true;
|
|||
|
}
|
|||
|
|
|||
|
private void tBoxHex_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!this.IsUserInput)
|
|||
|
return;
|
|||
|
this.IsUserInput = false;
|
|||
|
int num = this.tBoxHex.SelectionStart;
|
|||
|
byte[] b = (byte[]) null;
|
|||
|
string s = Regex.Replace(this.tBoxHex.Text.ToUpper(), "[^0-9A-F]", "");
|
|||
|
if (s.Length == 0)
|
|||
|
{
|
|||
|
b = (byte[]) null;
|
|||
|
this.tBoxDecimal.Text = "";
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 0)
|
|||
|
{
|
|||
|
if (s.Length > 2)
|
|||
|
s = s.Substring(0, 2);
|
|||
|
b = this.HexToByteArray(s, 1);
|
|||
|
this.tBoxDecimal.Text = b[0].ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 1)
|
|||
|
{
|
|||
|
if (s.Length > 2)
|
|||
|
s = s.Substring(0, 2);
|
|||
|
b = this.HexToByteArray(s, 1);
|
|||
|
this.tBoxDecimal.Text = ((sbyte) b[0]).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 2)
|
|||
|
{
|
|||
|
if (s.Length > 4)
|
|||
|
s = s.Substring(0, 4);
|
|||
|
b = this.HexToByteArray(s, 2);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToUInt16(b, 0).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 3)
|
|||
|
{
|
|||
|
if (s.Length > 4)
|
|||
|
s = s.Substring(0, 4);
|
|||
|
b = this.HexToByteArray(s, 2);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToInt16(b, 0).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 4)
|
|||
|
{
|
|||
|
if (s.Length > 8)
|
|||
|
s = s.Substring(0, 8);
|
|||
|
b = this.HexToByteArray(s, 4);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToUInt32(b, 0).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 5)
|
|||
|
{
|
|||
|
if (s.Length > 8)
|
|||
|
s = s.Substring(0, 8);
|
|||
|
b = this.HexToByteArray(s, 4);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToInt32(b, 0).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 6)
|
|||
|
{
|
|||
|
if (s.Length > 16)
|
|||
|
s = s.Substring(0, 16);
|
|||
|
b = this.HexToByteArray(s, 8);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToUInt64(b, 0).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 7)
|
|||
|
{
|
|||
|
if (s.Length > 16)
|
|||
|
s = s.Substring(0, 16);
|
|||
|
b = this.HexToByteArray(s, 8);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToInt64(b, 0).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 8)
|
|||
|
{
|
|||
|
if (s.Length > 8)
|
|||
|
s = s.Substring(0, 8);
|
|||
|
b = this.HexToByteArray(s, 4);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToSingle(b, 0).ToString();
|
|||
|
}
|
|||
|
else if (this.cbBoxType.SelectedIndex == 9)
|
|||
|
{
|
|||
|
if (s.Length > 16)
|
|||
|
s = s.Substring(0, 16);
|
|||
|
b = this.HexToByteArray(s, 8);
|
|||
|
this.tBoxDecimal.Text = BitConverter.ToDouble(b, 0).ToString();
|
|||
|
}
|
|||
|
this.tBoxBin.Text = this.ToBin(b);
|
|||
|
this.tBoxBytes.Text = this.ToRevHex(b);
|
|||
|
this.tBoxHex.Text = s;
|
|||
|
if (num < 0)
|
|||
|
num = 0;
|
|||
|
this.tBoxHex.SelectionStart = num;
|
|||
|
this.IsUserInput = true;
|
|||
|
}
|
|||
|
|
|||
|
private byte[] HexToByteArray(string s, int size)
|
|||
|
{
|
|||
|
byte[] byteArray = new byte[size];
|
|||
|
int num1 = 0;
|
|||
|
for (int index = s.Length - 1; index >= 0; --index)
|
|||
|
{
|
|||
|
byte num2 = (byte) s[index];
|
|||
|
byte num3 = num2 >= (byte) 58 ? (byte) ((uint) num2 - 55U) : (byte) ((uint) num2 - 48U);
|
|||
|
if (num1 % 2 == 1)
|
|||
|
num3 *= (byte) 16;
|
|||
|
byteArray[num1 / 2] += num3;
|
|||
|
++num1;
|
|||
|
}
|
|||
|
return byteArray;
|
|||
|
}
|
|||
|
|
|||
|
private string ToRevHex(byte[] b)
|
|||
|
{
|
|||
|
if (b == null)
|
|||
|
return "";
|
|||
|
string str = "0123456789ABCDEF";
|
|||
|
StringBuilder stringBuilder = new StringBuilder();
|
|||
|
for (int index = 0; index < b.Length; ++index)
|
|||
|
{
|
|||
|
stringBuilder.Append(str[(int) b[index] >> 4]);
|
|||
|
stringBuilder.Append(str[(int) b[index] & 15]);
|
|||
|
stringBuilder.Append(' ');
|
|||
|
}
|
|||
|
return stringBuilder.ToString();
|
|||
|
}
|
|||
|
|
|||
|
private string ToHex(byte[] b)
|
|||
|
{
|
|||
|
if (b == null)
|
|||
|
return "";
|
|||
|
string str = "0123456789ABCDEF";
|
|||
|
StringBuilder stringBuilder = new StringBuilder();
|
|||
|
for (int index = b.Length - 1; index >= 0; --index)
|
|||
|
{
|
|||
|
stringBuilder.Append(str[(int) b[index] >> 4]);
|
|||
|
stringBuilder.Append(str[(int) b[index] & 15]);
|
|||
|
}
|
|||
|
return stringBuilder.ToString();
|
|||
|
}
|
|||
|
|
|||
|
private string ToBin(byte[] b)
|
|||
|
{
|
|||
|
if (b == null)
|
|||
|
return "";
|
|||
|
StringBuilder stringBuilder = new StringBuilder();
|
|||
|
for (int index1 = 0; index1 < b.Length; ++index1)
|
|||
|
{
|
|||
|
byte num = b[index1];
|
|||
|
for (int index2 = 0; index2 < 8; ++index2)
|
|||
|
{
|
|||
|
stringBuilder.Insert(0, (int) num & 1);
|
|||
|
num >>= 1;
|
|||
|
}
|
|||
|
}
|
|||
|
return stringBuilder.ToString();
|
|||
|
}
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
int num = (int) new DialogBox().ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|