Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ public override ZplElementBase Analyze(string zplCommand)
{
string[] zplDataParts = this.SplitCommand(zplCommand);

int tmpint;
decimal tmpdec;
int x = 0;
int y = 0;

if (zplDataParts.Length > 0 && int.TryParse(zplDataParts[0], out tmpint))
if (zplDataParts.Length > 0 &&
decimal.TryParse(zplDataParts[0], out tmpdec) &&
int.MinValue <= tmpdec && tmpdec <= int.MaxValue)
{
x = tmpint;
x = decimal.ToInt32(tmpdec);
}

if (zplDataParts.Length > 1 && int.TryParse(zplDataParts[1], out tmpint))

if (zplDataParts.Length > 1 &&
decimal.TryParse(zplDataParts[1], out tmpdec) &&
int.MinValue <= tmpdec && tmpdec <= int.MaxValue)
{
y = tmpint;
y = decimal.ToInt32(tmpdec);
}

if (zplDataParts.Length > 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public override ZplElementBase Analyze(string zplCommand)
{
string[] zplDataParts = this.SplitCommand(zplCommand);

int tmpint;
decimal tmpdec;
int x = 0;
int y = 0;
bool useDefaultPosition = false;
Expand All @@ -25,9 +25,10 @@ public override ZplElementBase Analyze(string zplCommand)
}
else
{
if (int.TryParse(zplDataParts[0], out tmpint))
if (decimal.TryParse(zplDataParts[0], out tmpdec) &&
int.MinValue <= tmpdec && tmpdec <= int.MaxValue)
{
x = tmpint;
x = decimal.ToInt32(tmpdec);
}
else
{
Expand All @@ -38,9 +39,10 @@ public override ZplElementBase Analyze(string zplCommand)

if (zplDataParts.Length > 1 && !string.IsNullOrEmpty(zplDataParts[1]))
{
if (int.TryParse(zplDataParts[1], out tmpint))
if (decimal.TryParse(zplDataParts[1], out tmpdec) &&
int.MinValue <= tmpdec && tmpdec <= int.MaxValue)
{
y = tmpint;
y = decimal.ToInt32(tmpdec);
}
else if (!useDefaultPosition)
{
Expand Down
Loading