diff --git a/src/BinaryKits.Zpl.Viewer/CommandAnalyzers/FieldDataZplCommandAnalyzer.cs b/src/BinaryKits.Zpl.Viewer/CommandAnalyzers/FieldDataZplCommandAnalyzer.cs index 84a3faf..0121a75 100644 --- a/src/BinaryKits.Zpl.Viewer/CommandAnalyzers/FieldDataZplCommandAnalyzer.cs +++ b/src/BinaryKits.Zpl.Viewer/CommandAnalyzers/FieldDataZplCommandAnalyzer.cs @@ -16,7 +16,7 @@ public class FieldDataZplCommandAnalyzer : ZplCommandAnalyzerBase private static readonly Regex qrCodeFieldDataMixedRegex = new Regex(@"^D\d{4}[0-9A-F-a-f]{2},(?[HQML])(?[AM]),(?.+)$", RegexOptions.Compiled); private static readonly Regex qrCodeFieldDataModeRegex = new Regex(@"^(?:[ANK]|(?:B(?\d{4})))(?.+)$", RegexOptions.Compiled); - public FieldDataZplCommandAnalyzer(VirtualPrinter virtualPrinter) : base("^FD", virtualPrinter) { } + public FieldDataZplCommandAnalyzer(VirtualPrinter virtualPrinter, string prefix="^FD") : base(prefix, virtualPrinter) { } /// public override ZplElementBase Analyze(string zplCommand) diff --git a/src/BinaryKits.Zpl.Viewer/CommandAnalyzers/FieldVarialbleZplCommandAnalyzer.cs b/src/BinaryKits.Zpl.Viewer/CommandAnalyzers/FieldVarialbleZplCommandAnalyzer.cs new file mode 100644 index 0000000..581a650 --- /dev/null +++ b/src/BinaryKits.Zpl.Viewer/CommandAnalyzers/FieldVarialbleZplCommandAnalyzer.cs @@ -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") { } + } +} diff --git a/src/BinaryKits.Zpl.Viewer/ZplAnalyzer.cs b/src/BinaryKits.Zpl.Viewer/ZplAnalyzer.cs index 3fe6aa1..6083209 100644 --- a/src/BinaryKits.Zpl.Viewer/ZplAnalyzer.cs +++ b/src/BinaryKits.Zpl.Viewer/ZplAnalyzer.cs @@ -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),