diff --git a/.vs/BaseConverter/FileContentIndex/39f90cb6-50fa-48af-a8cc-ff8fef254c4e.vsidx b/.vs/BaseConverter/FileContentIndex/39f90cb6-50fa-48af-a8cc-ff8fef254c4e.vsidx
new file mode 100755
index 0000000..6ea94ec
Binary files /dev/null and b/.vs/BaseConverter/FileContentIndex/39f90cb6-50fa-48af-a8cc-ff8fef254c4e.vsidx differ
diff --git a/.vs/BaseConverter/FileContentIndex/b81a1075-faf4-47c3-9183-e6ce5252611d.vsidx b/.vs/BaseConverter/FileContentIndex/b81a1075-faf4-47c3-9183-e6ce5252611d.vsidx
deleted file mode 100755
index 68a09eb..0000000
Binary files a/.vs/BaseConverter/FileContentIndex/b81a1075-faf4-47c3-9183-e6ce5252611d.vsidx and /dev/null differ
diff --git a/.vs/BaseConverter/v17/.suo b/.vs/BaseConverter/v17/.suo
index 4ebf1c9..29a7365 100755
Binary files a/.vs/BaseConverter/v17/.suo and b/.vs/BaseConverter/v17/.suo differ
diff --git a/BaseConverter/Form1.cs b/BaseConverter/Form1.cs
index 9faf280..b921af9 100644
--- a/BaseConverter/Form1.cs
+++ b/BaseConverter/Form1.cs
@@ -23,6 +23,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Windows.Forms;
@@ -37,25 +38,27 @@ namespace WindowsFormsApplication1
toolTip.SetToolTip(autoCompute, "Automatically computes input based on changes made to textbox contents.");
}
-
- private void compute()
+ int paddingOffset = 0, spacingOffset = 0, i = 0;
+ public void compute()
{
// Define variables
long decimalNum = 0, hexNum = 0, binNum = 0, octalNum = 0;
- int paddingOffset = 0,spacingOffset = 0, i = 0;
+ //int paddingOffset = 0,spacingOffset = 0, i = 0;
try
{ // Extract data from text boxes.
+
decimalNum = long.Parse(decimalTextBox.Text);
- hexNum = Convert.ToInt64(hexTextBox.Text, 16);
- // Remove spacing from binaryTextBox before parsing it
- binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
+
+
binNum = Convert.ToInt64(binaryTextBox.Text, 2);
+
+ hexNum = Convert.ToInt64(hexTextBox.Text, 16);
octalNum = Convert.ToInt64(octalTextBox.Text, 8);
paddingOffset = int.Parse(paddingOffsetTextBox.Text);
- spacingOffset = int.Parse(spacingOffsetTextBox.Text);
+
}
- catch (Exception Ex)
+ catch
{
clearTextboxes();
MessageBox.Show("Invalid number entered into one of the textboxes!");
@@ -120,9 +123,17 @@ namespace WindowsFormsApplication1
{
binaryTextBox.Text = Convert.ToString(binNum, 2);
}
- try
- {
- if (spacingToggle.Checked)
+
+ hexTextBox.Text = hexNum.ToString("X");
+ octalTextBox.Text = Convert.ToString(octalNum, 8);
+ decimalTextBox.Text = decimalNum.ToString();
+ }
+ public void spacing()
+ {
+ spacingOffset = int.Parse(spacingOffsetTextBox.Text);
+ try
+ {
+ if (spacingToggle.Checked)
{
string binaryString = binaryTextBox.Text; // Define string to offset
int binarySize = binaryString.Length; //count the length of the string.
@@ -144,15 +155,14 @@ namespace WindowsFormsApplication1
}
}
binaryTextBox.Text = builder.ToString();
- builder = null; // null out builder when done
+ //builder = null; // null out builder when done
//binaryTextBox.Text = binaryString;
}
- } catch (Exception Ex) {
+ }
+ catch
+ {
MessageBox.Show("Divide by zero");
}
- hexTextBox.Text = hexNum.ToString("X");
- octalTextBox.Text = Convert.ToString(octalNum, 8);
- decimalTextBox.Text = decimalNum.ToString();
}
private void currentFocus(string focusOn)
{
@@ -185,8 +195,13 @@ namespace WindowsFormsApplication1
}
private void computeButton_Click(object sender, EventArgs e)
- {
- compute();
+ {
+ // Remove commas from decimalTextBox before parsing it
+ decimalTextBox.Text = decimalTextBox.Text.Replace(",", "");
+ // Remove spacing from binaryTextBox before parsing it
+ binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
+ compute();
+ spacing();
}
private void clearButton_Click(object sender, EventArgs e)
@@ -233,29 +248,62 @@ namespace WindowsFormsApplication1
private void binaryTextBox_TextChanged(object sender, EventArgs e)
{
//debugLabel.Text = sender.GetType().ToString();
- if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
- compute();
+ if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
+ {
+ // Remove commas from decimalTextBox before parsing it
+ //decimalTextBox.Text = decimalTextBox.Text.Replace(",", "");
+ // Remove spacing from binaryTextBox before parsing it
+ binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
+ compute();
+ //spacing();
+ }
+
}
private void hexTextBox_TextChanged(object sender, EventArgs e)
{
//debugLabel.Text = sender.GetType().ToString();
- if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
- compute();
- }
-
- private void octalTextBox_TextChanged(object sender, EventArgs e)
+ if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
+ {
+ // Remove commas from decimalTextBox before parsing it
+ decimalTextBox.Text = decimalTextBox.Text.Replace(",", "");
+ // Remove spacing from binaryTextBox before parsing it
+ binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
+
+ compute();
+ spacing();
+ }
+ }
+ private void octalTextBox_TextChanged(object sender, EventArgs e)
{
//debugLabel.Text = sender.GetType().ToString();
- if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
- compute();
+ if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
+ {
+ // Remove commas from decimalTextBox before parsing it
+ decimalTextBox.Text = decimalTextBox.Text.Replace(",", "");
+ // Remove spacing from binaryTextBox before parsing it
+ binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
+
+ compute();
+ spacing();
+ }
+
}
private void decimalTextBox_TextChanged(object sender, EventArgs e)
{
//debugLabel.Text = sender.GetType().ToString();
- if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
- compute();
+ if (autoCompute.Checked & (sender.GetType().ToString().Equals("System.Windows.Forms.TextBox")))
+ {
+ // Remove commas from decimalTextBox before parsing it
+ //decimalTextBox.Text = decimalTextBox.Text.Replace(",", "");
+ // Remove spacing from binaryTextBox before parsing it
+ binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
+
+ compute();
+ Thread.Sleep(250);
+ spacing();
+ }
}
private void paddingToggle_CheckedChanged(object sender, EventArgs e)
diff --git a/BaseConverter/bin/Debug/BaseConverter.application b/BaseConverter/bin/Debug/BaseConverter.application
index 7eaf541..aead226 100644
--- a/BaseConverter/bin/Debug/BaseConverter.application
+++ b/BaseConverter/bin/Debug/BaseConverter.application
@@ -14,7 +14,7 @@
- +eVmyDX1lwJUsnddCl2hkVC6D4eeY+s8n2S8KLtoftQ=
+ FLb7o5PmMolOEu475l0smDzDYPLdyAdRY/RzK0kEIiY=
diff --git a/BaseConverter/bin/Debug/BaseConverter.exe b/BaseConverter/bin/Debug/BaseConverter.exe
index 936a226..0685326 100644
Binary files a/BaseConverter/bin/Debug/BaseConverter.exe and b/BaseConverter/bin/Debug/BaseConverter.exe differ
diff --git a/BaseConverter/bin/Debug/BaseConverter.exe.manifest b/BaseConverter/bin/Debug/BaseConverter.exe.manifest
index bb62fad..fee02c8 100644
--- a/BaseConverter/bin/Debug/BaseConverter.exe.manifest
+++ b/BaseConverter/bin/Debug/BaseConverter.exe.manifest
@@ -42,14 +42,14 @@
-
+
- TxQfGOwVK3JijOUZcPt71v1L4N47JI7LyWnfoesT0EQ=
+ RykjKwuxJc8SDlNEdmViyEwnW/WDjfua+galOLDEBps=
diff --git a/BaseConverter/bin/Debug/BaseConverter.pdb b/BaseConverter/bin/Debug/BaseConverter.pdb
index d04f3a5..0c06cd0 100644
Binary files a/BaseConverter/bin/Debug/BaseConverter.pdb and b/BaseConverter/bin/Debug/BaseConverter.pdb differ
diff --git a/BaseConverter/bin/Debug/app.publish/BaseConverter.exe b/BaseConverter/bin/Debug/app.publish/BaseConverter.exe
index 7f7f69e..72f2a45 100755
Binary files a/BaseConverter/bin/Debug/app.publish/BaseConverter.exe and b/BaseConverter/bin/Debug/app.publish/BaseConverter.exe differ
diff --git a/BaseConverter/obj/Debug/BaseConverter.application b/BaseConverter/obj/Debug/BaseConverter.application
index 7eaf541..aead226 100644
--- a/BaseConverter/obj/Debug/BaseConverter.application
+++ b/BaseConverter/obj/Debug/BaseConverter.application
@@ -14,7 +14,7 @@
- +eVmyDX1lwJUsnddCl2hkVC6D4eeY+s8n2S8KLtoftQ=
+ FLb7o5PmMolOEu475l0smDzDYPLdyAdRY/RzK0kEIiY=
diff --git a/BaseConverter/obj/Debug/BaseConverter.exe b/BaseConverter/obj/Debug/BaseConverter.exe
index 936a226..0685326 100644
Binary files a/BaseConverter/obj/Debug/BaseConverter.exe and b/BaseConverter/obj/Debug/BaseConverter.exe differ
diff --git a/BaseConverter/obj/Debug/BaseConverter.exe.manifest b/BaseConverter/obj/Debug/BaseConverter.exe.manifest
index bb62fad..fee02c8 100644
--- a/BaseConverter/obj/Debug/BaseConverter.exe.manifest
+++ b/BaseConverter/obj/Debug/BaseConverter.exe.manifest
@@ -42,14 +42,14 @@
-
+
- TxQfGOwVK3JijOUZcPt71v1L4N47JI7LyWnfoesT0EQ=
+ RykjKwuxJc8SDlNEdmViyEwnW/WDjfua+galOLDEBps=
diff --git a/BaseConverter/obj/Debug/BaseConverter.pdb b/BaseConverter/obj/Debug/BaseConverter.pdb
index d04f3a5..0c06cd0 100644
Binary files a/BaseConverter/obj/Debug/BaseConverter.pdb and b/BaseConverter/obj/Debug/BaseConverter.pdb differ