views:

67

answers:

2

is this a good idea or not really?

instead of having to open a file through filestream, i would like to just save text in an encrypted format in application settings.

is this OK if the text is under 10mb?

what would be the best way of implementing this?

+1  A: 

Sure, anything is ok if it works. But I wouldn't recommend it. You are going to add a lot of noise to your configuration file. I would recommend you use the filestream and open an external file and get the data that way.

NerdFury
Um, I think "anything is ok if it works" is the formal definition of fascism. :)
MusiGenesis
+2  A: 

You can add just about anything to the Resources, including (text) files. They will be embedded in your EXE. You can access file-resources as byte[] and read them using a MemoryStream.

I take it that with 'Application Settings' you mean Application-scoped settings, eg readonly. If you want to write from your App, that would require formatting the bytestream with U64 encoding or something, usually making it twice as big.

Henk Holterman
I think the poster is talking about saving this big mess of text in the registry using GetSetting and SaveSetting.
MusiGenesis
hey henk, is this the error to which you were referring? http://stackoverflow.com/questions/1301980/dpapi-encryption-not-working-so-well-with-my-settings
I__
musi, nope im not doing registry stuff just storing some old plain strings
I__
I wasn't referring to any error.
Henk Holterman
@avrohom: but storing them where, exactly? In your application's config file?
MusiGenesis
yes exactly
I__