|
|
@ -48,10 +48,7 @@ namespace WindowsFormsApplication1
|
|
|
|
decimalNum = long.Parse(decimalTextBox.Text);
|
|
|
|
decimalNum = long.Parse(decimalTextBox.Text);
|
|
|
|
hexNum = Convert.ToInt64(hexTextBox.Text, 16);
|
|
|
|
hexNum = Convert.ToInt64(hexTextBox.Text, 16);
|
|
|
|
// Remove spacing from binaryTextBox before parsing it
|
|
|
|
// Remove spacing from binaryTextBox before parsing it
|
|
|
|
//if (spacingToggle.Checked)
|
|
|
|
binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
|
|
|
|
//{
|
|
|
|
|
|
|
|
binaryTextBox.Text = binaryTextBox.Text.Replace(" ", "");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
binNum = Convert.ToInt64(binaryTextBox.Text, 2);
|
|
|
|
binNum = Convert.ToInt64(binaryTextBox.Text, 2);
|
|
|
|
octalNum = Convert.ToInt64(octalTextBox.Text, 8);
|
|
|
|
octalNum = Convert.ToInt64(octalTextBox.Text, 8);
|
|
|
|
paddingOffset = int.Parse(paddingOffsetTextBox.Text);
|
|
|
|
paddingOffset = int.Parse(paddingOffsetTextBox.Text);
|
|
|
@ -131,11 +128,18 @@ namespace WindowsFormsApplication1
|
|
|
|
var builder = new StringBuilder(binaryString); // String builder
|
|
|
|
var builder = new StringBuilder(binaryString); // String builder
|
|
|
|
while (i != 0)
|
|
|
|
while (i != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (i % spacingOffset == 0) // If i mod spacingOffset equals zero, append a space to the offset specified by i.
|
|
|
|
if (!(i == binarySize)) // Get rid of trailing space
|
|
|
|
{
|
|
|
|
{
|
|
|
|
builder.Insert(i, " ");
|
|
|
|
if (i % spacingOffset == 0) // If i mod spacingOffset equals zero, append a space to the offset specified by i.
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
builder.Insert(i, " ");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
i--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i--;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
binaryTextBox.Text = builder.ToString();
|
|
|
|
binaryTextBox.Text = builder.ToString();
|
|
|
|
builder = null; // null out builder when done
|
|
|
|
builder = null; // null out builder when done
|
|
|
|