We help IT Professionals succeed at work.

DEF files in VB.Net

Medium Priority
Last Modified: 2012-05-12
Hi. I am wondering what is the best way to create DEF file or something like that to use it for printer definitions.

I am using RawPrinterHelper with escape codes, Cutter, Double Font, Codepage...etc

For the moment i have all these definitions hardcoded for three different POS printers but I want another way of adding new definitions that won't be dependant on the exe file.

For example, Create new definition file, Copy in certain directory and exe will find all files in that directory, user will select the one that match her/his printer and then exe reads that definition file so that new printer can use all the options that needs.

I need some pointers, and I want to avoid INI or XML files. If I can compile that, but use it in my exe that would be great.  I don't want to be able to read that file in Notepad.

Thank you for your hekp.
Watch Question

Not sure ifthis is what you are looking for, but may be of some help towards compiling your definition file:


Thank you for your reply. I don't think that is what I need.  Let's forget about printers for the moment (i don't want to write new driver) just to load some variables. Let's say that I have some variables:

Dim Var1 as String
Dim Var2 as String

Var1= (something from selected file)
Var1= (something from selected file)

I know how to load those things, but I was wondering if it's possible to "compile" that file and read it when  that file is "compiled". Something like external resource. That can be used without recompiling main exe but main exe is hardcoded to load certain values like Var1,Var2...

Sorry but I don't know if this is even possible, so I am not sure what exactly I want.

Easiest option would be to use files in XML format.

But you say that you "want to avoid INI or XML files".

If the reason for this is that you don't want your end users to be able to read (or perhaps create new) definition files directly, then you could use XML files which have been obfuscated or encrypted in some fashion; then your application would just need to reverse this obfuscation and/or encryption back to a XML-format resource, which your application could parse using widely available library routines (depending on programming language).

You'd need a separate in-house utility to generate the obfuscated files.

... or you could just design your own binary file format, with appropriate code to read this (in your application) and write it (in some other private in-house application).


Thank you, i like binary file format idea.