Destruktion
Programmer
Hey, I have a program Im working on that allows user to save contents (treeview streams) to one file to disk, then they can reload the program and open the saved file (just like excel, word, delphi project files etc).
That all works great, but I need to detect if the file has been tampered (modified) with. For example if I open a file I created from my app in Notepad - and see the usual stream characters, if I delete some text or rename portions (which will break the stream), when I load the file it will not error, but nothing will be displayed (treeview stream). The treeview will just be empty because it could not read the stream file.
Even with Try..Except on E: Exception statement in place it will not detect the errors.
So basically, is there a way (hash check, CRC? etc) that will know that the file created from my program is not valid or corrupt? I dont want my program to be able to read files it has created that may not be valid or corrupt.
Imagine renaming a word document file (mynotes.doc) to (mynotes.xsl) and opening mynotes.xsl in word, it would error and know it is not correct file.
How can I implement this in my programs so that I can know the files are valid?
Many Thanks!
That all works great, but I need to detect if the file has been tampered (modified) with. For example if I open a file I created from my app in Notepad - and see the usual stream characters, if I delete some text or rename portions (which will break the stream), when I load the file it will not error, but nothing will be displayed (treeview stream). The treeview will just be empty because it could not read the stream file.
Even with Try..Except on E: Exception statement in place it will not detect the errors.
So basically, is there a way (hash check, CRC? etc) that will know that the file created from my program is not valid or corrupt? I dont want my program to be able to read files it has created that may not be valid or corrupt.
Imagine renaming a word document file (mynotes.doc) to (mynotes.xsl) and opening mynotes.xsl in word, it would error and know it is not correct file.
How can I implement this in my programs so that I can know the files are valid?
Many Thanks!