using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ArrayToHex
{
    public partial class frm11ArrayToHex : Form
    {
        public frm11ArrayToHex()
        {
            InitializeComponent();
        }

        private void frm11ArrayToHex_Load(object sender, EventArgs e)
        {
            // Convert the string into a byte array.
            byte[] bytes = originalTextBox.Text.UnicodeBytes();

            // Display the bytes as a hex string.
            hexTextBox.Text = bytes.ToHex(' ');

            // Convert the hex string back into an array of bytes.
            bytes = hexTextBox.Text.ToBytes();

            // Convert the byte array back into a string and display it.
            restoredTextBox.Text = bytes.ToUnicodeString();
        }


        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.restoredTextBox = new System.Windows.Forms.TextBox();
            this.hexTextBox = new System.Windows.Forms.TextBox();
            this.originalTextBox = new System.Windows.Forms.TextBox();
            this.Label4 = new System.Windows.Forms.Label();
            this.Label2 = new System.Windows.Forms.Label();
            this.Label1 = new System.Windows.Forms.Label();
            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
            this.tableLayoutPanel1.SuspendLayout();
            this.SuspendLayout();
            // 
            // restoredTextBox
            // 
            this.restoredTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left)));
            this.restoredTextBox.Location = new System.Drawing.Point(388, 22);
            this.restoredTextBox.Margin = new System.Windows.Forms.Padding(0, 2, 3, 3);
            this.restoredTextBox.Multiline = true;
            this.restoredTextBox.Name = "restoredTextBox";
            this.restoredTextBox.ReadOnly = true;
            this.restoredTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.restoredTextBox.Size = new System.Drawing.Size(193, 136);
            this.restoredTextBox.TabIndex = 119;
            // 
            // hexTextBox
            // 
            this.hexTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left)));
            this.hexTextBox.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.hexTextBox.Location = new System.Drawing.Point(194, 22);
            this.hexTextBox.Margin = new System.Windows.Forms.Padding(0, 2, 3, 3);
            this.hexTextBox.Multiline = true;
            this.hexTextBox.Name = "hexTextBox";
            this.hexTextBox.ReadOnly = true;
            this.hexTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.hexTextBox.Size = new System.Drawing.Size(191, 136);
            this.hexTextBox.TabIndex = 118;
            // 
            // originalTextBox
            // 
            this.originalTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left)));
            this.originalTextBox.Location = new System.Drawing.Point(3, 22);
            this.originalTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 3);
            this.originalTextBox.Multiline = true;
            this.originalTextBox.Name = "originalTextBox";
            this.originalTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.originalTextBox.Size = new System.Drawing.Size(188, 136);
            this.originalTextBox.TabIndex = 117;
            this.originalTextBox.Text = "To encrypt data, attach a CryptoStream object to a stream. As you write data into" +
    " the CryptoStream, it encrypts or decrypts the data and sends it on to the outpu" +
    "t stream.";
            // 
            // Label4
            // 
            this.Label4.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Label4.Location = new System.Drawing.Point(391, 3);
            this.Label4.Margin = new System.Windows.Forms.Padding(3, 3, 2, 1);
            this.Label4.Name = "Label4";
            this.Label4.Size = new System.Drawing.Size(191, 16);
            this.Label4.TabIndex = 116;
            this.Label4.Text = "Restored";
            this.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // Label2
            // 
            this.Label2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Label2.Location = new System.Drawing.Point(197, 3);
            this.Label2.Margin = new System.Windows.Forms.Padding(3, 3, 2, 1);
            this.Label2.Name = "Label2";
            this.Label2.Size = new System.Drawing.Size(189, 16);
            this.Label2.TabIndex = 113;
            this.Label2.Text = "Hexadecimal";
            this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // Label1
            // 
            this.Label1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Label1.Location = new System.Drawing.Point(3, 3);
            this.Label1.Margin = new System.Windows.Forms.Padding(3, 3, 2, 1);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(189, 16);
            this.Label1.TabIndex = 112;
            this.Label1.Text = "Original String";
            this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // tableLayoutPanel1
            // 
            this.tableLayoutPanel1.ColumnCount = 3;
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tableLayoutPanel1.Controls.Add(this.Label1, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.restoredTextBox, 2, 1);
            this.tableLayoutPanel1.Controls.Add(this.Label2, 1, 0);
            this.tableLayoutPanel1.Controls.Add(this.hexTextBox, 1, 1);
            this.tableLayoutPanel1.Controls.Add(this.Label4, 2, 0);
            this.tableLayoutPanel1.Controls.Add(this.originalTextBox, 0, 1);
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
            this.tableLayoutPanel1.RowCount = 2;
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanel1.Size = new System.Drawing.Size(584, 161);
            this.tableLayoutPanel1.TabIndex = 120;
            // 
            // frm11ArrayToHex
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(584, 161);
            this.Controls.Add(this.tableLayoutPanel1);
            this.Name = "frm11ArrayToHex";
            this.Text = "ArrayToHex";
            this.Load += new System.EventHandler(this.frm11ArrayToHex_Load);
            this.tableLayoutPanel1.ResumeLayout(false);
            this.tableLayoutPanel1.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        internal System.Windows.Forms.TextBox restoredTextBox;
        internal System.Windows.Forms.TextBox hexTextBox;
        internal System.Windows.Forms.TextBox originalTextBox;
        internal System.Windows.Forms.Label Label4;
        internal System.Windows.Forms.Label Label2;
        internal System.Windows.Forms.Label Label1;
        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
    }
}