简体   繁体   English

在应用程序设置中写入10mb?

[英]writing 10mb to application settings?

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? 如果文字小于10mb,可以吗?

what would be the best way of implementing this? 实施此方法的最佳方法是什么?

You can add just about anything to the Resources, including (text) files. 您几乎可以向资源中添加任何内容,包括(文本)文件。 They will be embedded in your EXE. 它们将嵌入在您的EXE中。 You can access file-resources as byte[] and read them using a MemoryStream. 您可以将文件资源作为byte []访问,并使用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. 如果要从您的应用程序编写,则需要使用U64编码或类似格式格式化字节流,通常使字节流大小增大一倍。

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. 我建议您使用文件流并打开一个外部文件并以这种方式获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM