从数据流而不是文件加载配置文件 [英] Load configuration file from stream instead of file

查看:140
本文介绍了从数据流而不是文件加载配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆