Remove trailing space left at the end of the binary string

master
Chloe Fontenot 🏳️‍⚧️ 2022-10-10 17:26:28 +07:00
parent afc7c92f22
commit 9e8bee43c8
12 changed files with 17 additions and 12 deletions

@ -302,6 +302,7 @@ namespace WindowsFormsApplication1
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(7, 39);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(76, 14);

@ -48,10 +48,7 @@ namespace WindowsFormsApplication1
decimalNum = long.Parse(decimalTextBox.Text);
hexNum = Convert.ToInt64(hexTextBox.Text, 16);
// 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);
octalNum = Convert.ToInt64(octalTextBox.Text, 8);
paddingOffset = int.Parse(paddingOffsetTextBox.Text);
@ -131,11 +128,18 @@ namespace WindowsFormsApplication1
var builder = new StringBuilder(binaryString); // String builder
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();
builder = null; // null out builder when done

@ -11,7 +11,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>is8iki4tHpHxcj7xk6PtMOGvK6g=</dsig:DigestValue>
<dsig:DigestValue>iQndC8edrYzQfW1up66sZRa2OHI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -59,7 +59,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>TKjFfY6QSkvgFQb19kmMEE77U3c=</dsig:DigestValue>
<dsig:DigestValue>wI+p03vYZj52eZR1ghmskX9GKkg=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -11,7 +11,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>is8iki4tHpHxcj7xk6PtMOGvK6g=</dsig:DigestValue>
<dsig:DigestValue>iQndC8edrYzQfW1up66sZRa2OHI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -11,7 +11,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>is8iki4tHpHxcj7xk6PtMOGvK6g=</dsig:DigestValue>
<dsig:DigestValue>iQndC8edrYzQfW1up66sZRa2OHI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -59,7 +59,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>TKjFfY6QSkvgFQb19kmMEE77U3c=</dsig:DigestValue>
<dsig:DigestValue>wI+p03vYZj52eZR1ghmskX9GKkg=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>