从数据流而不是文件加载配置文件 [英] Load configuration file from stream instead of file
问题描述
我用OpenMappedExeConfiguration与ExeConfigurationFileMap加载配置文件。他们的重载建议他们只与文件名的工作。有没有办法从流加载配置文件?
I use OpenMappedExeConfiguration with ExeConfigurationFileMap to load configuration files. Their overloads suggest that they only work with filenames. Is there a way to load a configuration file from a stream?
背景:我要加载的嵌入资源存储的配置文件。有重presentation没有文件!
Background: I want to load configuration files that are stored as embedded resources. There is no file representation!
推荐答案
否。的问题是,这一类本身不读取配置。文件路径本身是最终使用的配置
类加载配置,该类真正想要的物理路径。
No. The problem is that this class itself do not read the configuration. The file path itself is eventually used by the Configuration
class to load the configuration, and this class actually wants a physical path.
我认为唯一的解决办法是把文件保存到临时路径,并从那里阅读。
I think the only solution is to store the file to a temporary path and read it from there.
这篇关于从数据流而不是文件加载配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!