From 6a371105160a48420ceaaf0b99cac07e6921275c Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Thu, 14 Sep 2017 17:27:16 +0200 Subject: [PATCH] Add FrmBase64 --- VAR.Toolbox/Form1.Designer.cs | 39 ------- VAR.Toolbox/FrmBase64.Designer.cs | 136 ++++++++++++++++++++++++ VAR.Toolbox/FrmBase64.cs | 62 +++++++++++ VAR.Toolbox/FrmBase64.resx | 120 +++++++++++++++++++++ VAR.Toolbox/FrmToolbox.Designer.cs | 63 +++++++++++ VAR.Toolbox/{Form1.cs => FrmToolbox.cs} | 10 +- VAR.Toolbox/FrmToolbox.resx | 120 +++++++++++++++++++++ VAR.Toolbox/Program.cs | 2 +- VAR.Toolbox/VAR.Toolbox.csproj | 37 +++---- 9 files changed, 525 insertions(+), 64 deletions(-) delete mode 100644 VAR.Toolbox/Form1.Designer.cs create mode 100644 VAR.Toolbox/FrmBase64.Designer.cs create mode 100644 VAR.Toolbox/FrmBase64.cs create mode 100644 VAR.Toolbox/FrmBase64.resx create mode 100644 VAR.Toolbox/FrmToolbox.Designer.cs rename VAR.Toolbox/{Form1.cs => FrmToolbox.cs} (57%) create mode 100644 VAR.Toolbox/FrmToolbox.resx diff --git a/VAR.Toolbox/Form1.Designer.cs b/VAR.Toolbox/Form1.Designer.cs deleted file mode 100644 index bad0cac..0000000 --- a/VAR.Toolbox/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace VAR.Toolbox -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (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.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Text = "Form1"; - } - - #endregion - } -} - diff --git a/VAR.Toolbox/FrmBase64.Designer.cs b/VAR.Toolbox/FrmBase64.Designer.cs new file mode 100644 index 0000000..1c2573e --- /dev/null +++ b/VAR.Toolbox/FrmBase64.Designer.cs @@ -0,0 +1,136 @@ +namespace VAR.Toolbox +{ + partial class FrmBase64 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (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.txtInput = new System.Windows.Forms.TextBox(); + this.btnDecodeBase64 = new System.Windows.Forms.Button(); + this.txtOutput = new System.Windows.Forms.TextBox(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.btnEncodeBase64 = new System.Windows.Forms.Button(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // txtInput + // + this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtInput.Location = new System.Drawing.Point(12, 14); + this.txtInput.Multiline = true; + this.txtInput.Name = "txtInput"; + this.txtInput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtInput.Size = new System.Drawing.Size(353, 364); + this.txtInput.TabIndex = 0; + // + // btnDecodeBase64 + // + this.btnDecodeBase64.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnDecodeBase64.Location = new System.Drawing.Point(12, 384); + this.btnDecodeBase64.Name = "btnDecodeBase64"; + this.btnDecodeBase64.Size = new System.Drawing.Size(105, 23); + this.btnDecodeBase64.TabIndex = 1; + this.btnDecodeBase64.Text = "Decode Base64"; + this.btnDecodeBase64.UseVisualStyleBackColor = true; + this.btnDecodeBase64.Click += new System.EventHandler(this.btnDecodeBase64_Click); + // + // txtOutput + // + this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtOutput.Location = new System.Drawing.Point(3, 14); + this.txtOutput.Multiline = true; + this.txtOutput.Name = "txtOutput"; + this.txtOutput.ReadOnly = true; + this.txtOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtOutput.Size = new System.Drawing.Size(356, 364); + this.txtOutput.TabIndex = 2; + // + // splitContainer1 + // + this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.btnEncodeBase64); + this.splitContainer1.Panel1.Controls.Add(this.btnDecodeBase64); + this.splitContainer1.Panel1.Controls.Add(this.txtInput); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.txtOutput); + this.splitContainer1.Size = new System.Drawing.Size(743, 418); + this.splitContainer1.SplitterDistance = 368; + this.splitContainer1.TabIndex = 3; + this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved); + // + // btnEncodeBase64 + // + this.btnEncodeBase64.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnEncodeBase64.Location = new System.Drawing.Point(123, 384); + this.btnEncodeBase64.Name = "btnEncodeBase64"; + this.btnEncodeBase64.Size = new System.Drawing.Size(107, 23); + this.btnEncodeBase64.TabIndex = 3; + this.btnEncodeBase64.Text = "Encode Base64"; + this.btnEncodeBase64.UseVisualStyleBackColor = true; + this.btnEncodeBase64.Click += new System.EventHandler(this.btnEncodeBase64_Click); + // + // frmBase64 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(743, 417); + this.Controls.Add(this.splitContainer1); + this.Name = "frmBase64"; + this.Text = "Base64"; + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.Panel2.PerformLayout(); + this.splitContainer1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TextBox txtInput; + private System.Windows.Forms.Button btnDecodeBase64; + private System.Windows.Forms.TextBox txtOutput; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Button btnEncodeBase64; + } +} + diff --git a/VAR.Toolbox/FrmBase64.cs b/VAR.Toolbox/FrmBase64.cs new file mode 100644 index 0000000..1b8c0ed --- /dev/null +++ b/VAR.Toolbox/FrmBase64.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace VAR.Toolbox +{ + public partial class FrmBase64 : Form + { + public FrmBase64() + { + InitializeComponent(); + } + + /// + /// Codifica una cadena en base64. + /// + /// Cadena a codificar + /// Cadena codificada + static public string Base64Encode(string toEncode) + { + byte[] toEncodeAsBytes + = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode); + string returnValue + = System.Convert.ToBase64String(toEncodeAsBytes); + return returnValue; + } + + /// + /// Decodifica una cadena desde base64. + /// + /// Cadena codificada + /// Cadena decodificada + static public string Base64Decode(string encodedData) + { + byte[] encodedDataAsBytes + = System.Convert.FromBase64String(encodedData); + string returnValue = + System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes); + return returnValue; + } + + private void btnDecodeBase64_Click(object sender, EventArgs e) + { + txtOutput.Text = Base64Decode(txtInput.Text); + } + + private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) + { + + } + + private void btnEncodeBase64_Click(object sender, EventArgs e) + { + txtOutput.Text = Base64Encode(txtInput.Text); + } + } +} diff --git a/VAR.Toolbox/FrmBase64.resx b/VAR.Toolbox/FrmBase64.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/VAR.Toolbox/FrmBase64.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VAR.Toolbox/FrmToolbox.Designer.cs b/VAR.Toolbox/FrmToolbox.Designer.cs new file mode 100644 index 0000000..0f6ad43 --- /dev/null +++ b/VAR.Toolbox/FrmToolbox.Designer.cs @@ -0,0 +1,63 @@ +namespace VAR.Toolbox +{ + partial class FrmToolbox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (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.btnBase64 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // btnBase64 + // + this.btnBase64.Location = new System.Drawing.Point(12, 12); + this.btnBase64.Name = "btnBase64"; + this.btnBase64.Size = new System.Drawing.Size(209, 34); + this.btnBase64.TabIndex = 0; + this.btnBase64.Text = "Base64"; + this.btnBase64.UseVisualStyleBackColor = true; + this.btnBase64.Click += new System.EventHandler(this.btnBase64_Click); + // + // FrmToolbox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(233, 391); + this.Controls.Add(this.btnBase64); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.MaximizeBox = false; + this.Name = "FrmToolbox"; + this.Text = "Toolbox"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button btnBase64; + } +} + diff --git a/VAR.Toolbox/Form1.cs b/VAR.Toolbox/FrmToolbox.cs similarity index 57% rename from VAR.Toolbox/Form1.cs rename to VAR.Toolbox/FrmToolbox.cs index 17c85cb..c1bf0f5 100644 --- a/VAR.Toolbox/Form1.cs +++ b/VAR.Toolbox/FrmToolbox.cs @@ -10,11 +10,17 @@ using System.Windows.Forms; namespace VAR.Toolbox { - public partial class Form1 : Form + public partial class FrmToolbox : Form { - public Form1() + public FrmToolbox() { InitializeComponent(); } + + private void btnBase64_Click(object sender, EventArgs e) + { + var frmBase64 = new FrmBase64(); + frmBase64.Show(); + } } } diff --git a/VAR.Toolbox/FrmToolbox.resx b/VAR.Toolbox/FrmToolbox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/VAR.Toolbox/FrmToolbox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VAR.Toolbox/Program.cs b/VAR.Toolbox/Program.cs index 2232157..d129e39 100644 --- a/VAR.Toolbox/Program.cs +++ b/VAR.Toolbox/Program.cs @@ -16,7 +16,7 @@ namespace VAR.Toolbox { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new FrmToolbox()); } } } diff --git a/VAR.Toolbox/VAR.Toolbox.csproj b/VAR.Toolbox/VAR.Toolbox.csproj index 6c42f7f..1cf0ec4 100644 --- a/VAR.Toolbox/VAR.Toolbox.csproj +++ b/VAR.Toolbox/VAR.Toolbox.csproj @@ -46,35 +46,28 @@ - + Form - - Form1.cs + + FrmBase64.cs + + + Form + + + FrmToolbox.cs - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - + + FrmBase64.cs + + + FrmToolbox.cs +