Using files
-
Hello, I am designing an application where data is stored in files. My file is in XML format so that I can easily manipulate it's data. Everything worked really well so far. Recently we are getting many support mails which says the program showing some weird errors. We have found that it is mainly because people open the file in a text editor and edited the XML data manually. I am looking for a method which will prevent users from editing it. How do you guys usually manage it ? Any suggestions ?
-
Hello, I am designing an application where data is stored in files. My file is in XML format so that I can easily manipulate it's data. Everything worked really well so far. Recently we are getting many support mails which says the program showing some weird errors. We have found that it is mainly because people open the file in a text editor and edited the XML data manually. I am looking for a method which will prevent users from editing it. How do you guys usually manage it ? Any suggestions ?
Hide the files.
Giorgi Dalakishvili #region signature my articles #endregion
-
Hide the files.
Giorgi Dalakishvili #region signature my articles #endregion
Thanks, But that's not a reliable way as it can be made visible by the user. Any other suggestions ? How about writing the XML content into a binary file ?
-
Hello, I am designing an application where data is stored in files. My file is in XML format so that I can easily manipulate it's data. Everything worked really well so far. Recently we are getting many support mails which says the program showing some weird errors. We have found that it is mainly because people open the file in a text editor and edited the XML data manually. I am looking for a method which will prevent users from editing it. How do you guys usually manage it ? Any suggestions ?
In the past I've used xml in memory and used simple encryption/decryption for writing to disk. This can slow stuff down a little though. Alternatively, encrypt just the tag contents rather than the xml file - but make sure the encryption only uses characters that are going to be valid.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog) -
Thanks, But that's not a reliable way as it can be made visible by the user. Any other suggestions ? How about writing the XML content into a binary file ?
Hi ! is your xml file large? Do you load it entierly when executing your program? if you load your xml file into an object you can do a binary serialization. You save your object or array of objects into a binay file. When executing your program you can load this file at start up.
-
Hi ! is your xml file large? Do you load it entierly when executing your program? if you load your xml file into an object you can do a binary serialization. You save your object or array of objects into a binay file. When executing your program you can load this file at start up.
That's a brilliant suggestion. I will check it.
-
That's a brilliant suggestion. I will check it.
Hi ! Just you have to be sure that when you serialize or deserialize your object you MUST keep the same class structure (same fields, same names, sames types) regards :)