code improvements

This commit is contained in:
Manuel Kamper 2024-01-15 10:42:22 +01:00
parent 4776764b46
commit 74cf26ac60

View File

@ -103,36 +103,19 @@ namespace Mk0.Software.ImageSorter
{
uint numer = BitConverter.ToUInt32(value, i);
uint denom = BitConverter.ToUInt32(value, i + BYTEJUMP_LONG);
//if (formatInstr == FormatInstr.FRACTION)
if(false)
{
UFraction frac = new UFraction(numer, denom);
ev += frac.ToString();
}
double dbl;
if (denom == 0)
dbl = 0.0;
else
{
double dbl;
if (denom == 0)
dbl = 0.0;
else
dbl = (double)numer / (double)denom;
ev += dbl.ToString(DOUBLETYPE_FORMAT);
}
dbl = (double)numer / (double)denom;
ev += dbl.ToString(DOUBLETYPE_FORMAT);
if (i + BYTEJUMP_RATIONAL < len)
ev += " ";
}
}
else if (type == 6)
{
//if (formatInstr == FormatInstr.ALLCHAR)
if (false)
{
ev = encoding.GetString(value, 0, len);
}
else
{
ev = BitConverter.ToString(value, 0, len);
}
ev = BitConverter.ToString(value, 0, len);
}
else if (type == 7)
{
@ -157,21 +140,12 @@ namespace Mk0.Software.ImageSorter
{
int numer = BitConverter.ToInt32(value, i);
int denom = BitConverter.ToInt32(value, i + BYTEJUMP_SLONG);
//if (formatInstr == FormatInstr.FRACTION)
if (false)
{
Fraction frac = new Fraction(numer, denom);
ev += frac.ToString();
}
double dbl;
if (denom == 0)
dbl = 0.0;
else
{
double dbl;
if (denom == 0)
dbl = 0.0;
else
dbl = (double)numer / (double)denom;
ev += dbl.ToString(DOUBLETYPE_FORMAT);
}
dbl = (double)numer / (double)denom;
ev += dbl.ToString(DOUBLETYPE_FORMAT);
if (i + BYTEJUMP_SRATIONAL < len)
ev += " ";
}