Skip to content

Commit

Permalink
Enable ^FV command (needed for UPS) (#195)
Browse files Browse the repository at this point in the history
* Enable ^FV command

- Based off ^FD
  • Loading branch information
reportingissue authored Jan 18, 2024
1 parent ddc7cb7 commit 552973b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class FieldDataZplCommandAnalyzer : ZplCommandAnalyzerBase
private static readonly Regex qrCodeFieldDataMixedRegex = new Regex(@"^D\d{4}[0-9A-F-a-f]{2},(?<correction>[HQML])(?<input>[AM]),(?<data>.+)$", RegexOptions.Compiled);
private static readonly Regex qrCodeFieldDataModeRegex = new Regex(@"^(?:[ANK]|(?:B(?<count>\d{4})))(?<data>.+)$", RegexOptions.Compiled);

public FieldDataZplCommandAnalyzer(VirtualPrinter virtualPrinter) : base("^FD", virtualPrinter) { }
public FieldDataZplCommandAnalyzer(VirtualPrinter virtualPrinter, string prefix="^FD") : base(prefix, virtualPrinter) { }

///<inheritdoc/>
public override ZplElementBase Analyze(string zplCommand)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace BinaryKits.Zpl.Viewer.CommandAnalyzers
{
// todo: fix virtual printer, must enable the MC command
// todo: factor out common parts from FieldDataZplCommandAnalyzer so both can inherit
// This is currently just a hack to be able to visualize single ups zpl.
// The FV command is normally used with the MC command when printing multiple labels of a same pattern.
// The MC command allows us to "save" the first label as a template
// using FDs as static elements of template and FVs as variable parts.
// Subsequent labels only require FV to draw the variable parts.
public class FieldVariableZplCommandAnalyzer : FieldDataZplCommandAnalyzer
{
public FieldVariableZplCommandAnalyzer(VirtualPrinter virtualPrinter): base(virtualPrinter, "^FV") { }
}
}
1 change: 1 addition & 0 deletions src/BinaryKits.Zpl.Viewer/ZplAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public AnalyzeInfo Analyze(string zplData)
new FieldBlockZplCommandAnalyzer(this._virtualPrinter),
new FieldHexadecimalZplCommandAnalyzer(this._virtualPrinter),
new FieldNumberCommandAnalyzer(this._virtualPrinter),
new FieldVariableZplCommandAnalyzer(this._virtualPrinter),
new FieldReversePrintZplCommandAnalyzer(this._virtualPrinter),
new LabelReversePrintZplCommandAnalyzer(this._virtualPrinter),
new FieldSeparatorZplCommandAnalyzer(this._virtualPrinter, fieldDataAnalyzer),
Expand Down

0 comments on commit 552973b

Please sign in to comment.