c# - Read serialized file associated with a program upon open -
i have finished program, serialized saving , created fileopen system open file saved application. have created file association innosetup on registry, works fine.
all want achieve is, whenever user double click on saved file program, program should read , deserialize it.
for example, when double click or open .docx or .doc file, microsoft word opened , file read , opened. presently program open, don't know how detect when opened file can start deserialization.
note: deserializing not problem, it's detecting whether or not should so.
when start program double clicking on associated file, filename passed in command line argument. specify argument occur in file extension association setup.
if set association as:
program.exe %1
double clicking file result in:
program.exe c:\folder\file.ext
this can accessed using environment.getcommandlineargs()
or main(string[] args)
method:
static void main(string[] args) { if (args.length > 0) { // argument string filelocation = args[0]; // load , deserialize // do } }
Comments
Post a Comment