Page 1 of 1
protect text file
Posted: Wed Aug 22, 2012 9:55 am
by jon
Hi
Can I protect a txt file thats outside of my standalone so it can't be altered by the user?
Any advice welcome
Many thanks, Jon.
Re: protect text file
Posted: Wed Aug 22, 2012 10:07 am
by shaosean
Most operating systems will allow you to make the file read-only, but you would have to configure it on each system.. The other option is to include it in the application..
Re: protect text file
Posted: Wed Aug 22, 2012 3:06 pm
by FourthWorld
You might consider using the encrypt and decrypt functions.
Re: protect text file
Posted: Wed Aug 22, 2012 3:17 pm
by jon
Thank you both,
I'll look at both options
Regards, Jon
Re: protect text file
Posted: Wed Aug 22, 2012 4:51 pm
by bangkok
jon wrote:Hi
Can I protect a txt file thats outside of my standalone so it can't be altered by the user?
Any advice welcome
What is inside this text file ?
Internal data used by your app ?
If it's the case, do you really need a text file ? You could put those data in a custom property, within a sub stack (that way, your app could "save" the data).
Re: protect text file
Posted: Wed Aug 22, 2012 4:57 pm
by FourthWorld
bangkok wrote:jon wrote:You could put those data in a custom property, within a sub stack (that way, your app could "save" the data).
Roger that.
Stack files make a great storage container, since the syntax for working with custom props is simple and robust, and you'll never have to worry about parsing.
Re: protect text file
Posted: Wed Aug 22, 2012 5:27 pm
by jon
Thanks guys
custom props are a bit over my head at the moment, but I would like some ideas of how please
I am simply needing to save 3 flds with text in them so they appear when I re-start my stand alone game.
Any pointers or psuedo code would be most welcome, thanks for taking your time to help.
By the way I got my txt file to encrypt, but I can't seem to get it to decrypt on import.
Regards, Jon.
Re: protect text file
Posted: Wed Aug 22, 2012 5:45 pm
by mwieder
Jon- np: here's an development-time example example of putting text into a custom property which I'll call uGreeting.
Code: Select all
put "hello, sailor" into field 1
set the uGreeting of this stack to field 1
then at runtime in your code when you need the text, just retrieve it from the custom property:
Code: Select all
put the uGreeting of this stack into field 1
Re: protect text file
Posted: Wed Aug 22, 2012 5:52 pm
by jon
Hey thanks mwieder
You just made my day, I had no idea it was so straightforward, the flippin dictionary should be re written by you guys
Many thanks again, Jon
PS. How did you know I was a sailor

Re: protect text file
Posted: Wed Aug 22, 2012 11:39 pm
by jacque
Except be careful if the text will change. Standalones can't save changes to themselves so anything you put into that property during run time will be lost. If the text is static and is only set during development, you're fine.
Re: protect text file
Posted: Thu Aug 23, 2012 2:19 am
by FourthWorld
...or just use a stack file not attached to your standalone.
Re: protect text file
Posted: Thu Aug 23, 2012 12:03 pm
by LittleGreyMan
jon wrote:You just made my day, I had no idea it was so straightforward, the flippin dictionary should be re written by you guys

Hi Jon,
The Dictionary is not so bad, but it won't help you catching the spirit of LC and discovering this kind of feature.
Reading the user manual (from the help menu) is really useful.
Re: protect text file
Posted: Thu Aug 23, 2012 4:57 pm
by jon
Thanks for your advice
I have decided to go with the external stack, password protected because the data in the flds changes all the time.
I allways learn and sometimes get side tracked after the advice i get on here, but in a good way.
Thanks again all, Jon
Re: protect text file
Posted: Thu Aug 23, 2012 5:13 pm
by Klaus