Forgot pad left

This commit is contained in:
2022-09-24 21:41:50 -07:00
parent 751a61529c
commit d789f295c6
13 changed files with 303 additions and 247 deletions

View File

@ -52,9 +52,9 @@ internal abstract class Location
{
int result;
Check(bottom, height, left, right, top, width, zCount);
long check;
int checksum;
decimal center = 2m;
string xCenterPadded;
string yCenterPadded;
decimal factor = locationFactor;
// int.MaxPercentage = 21 4748 3647;
@ -73,15 +73,14 @@ internal abstract class Location
decimal yCenterPercentageFactored = yCenterValue / height * factor;
int xCenterRounded = (int)Math.Round(xCenterPercentageFactored, 0);
int yCenterRounded = (int)Math.Round(yCenterPercentageFactored, 0);
if (xCenterRounded != factor)
xCenterPadded = ILocation.GetLeftPadded(length, xCenterRounded);
else
xCenterPadded = ILocation.GetLeftPadded(length, xCenterRounded - 1);
if (yCenterRounded != factor)
yCenterPadded = ILocation.GetLeftPadded(length, yCenterRounded);
else
yCenterPadded = ILocation.GetLeftPadded(length, yCenterRounded - 1);
long check = long.Parse(string.Concat(xCenterPadded, yCenterPadded, checksum));
if (xCenterRounded != factor)
check = long.Parse(string.Concat(xCenterRounded, yCenterPadded, checksum));
else
check = long.Parse(string.Concat(xCenterRounded - 1, yCenterPadded, checksum));
if (check > int.MaxValue)
throw new Exception();
result = (int)check;