C# wpf html 帮助文件
C3、WPF、Windows 7、Microsoft Ribbon、Visual studio 2010、dotnet 4.5
我想用 html 编写帮助文件并将它们作为资源包含在 .exe 文件中。
有没有办法告诉资源管理器直接从 .exe 文件获取 html 页面?
如果没有,我假设归档它的唯一方法是创建一个临时目录,复制 文件并启动浏览器指向这些文件。
是否有一个神奇的调用可以获取资源目录并将其解压/复制到目录中?
喜欢
tempDir = GetTempDirectory();
WPF_MAGIC_RESOURCE_UNPACKER("/help/*", tempDir );
System.Diagnostics.Process.Start(tempDir + Path.DirectorySeparatorChar + "index.html");
问候斯特凡
C3, WPF, Windows 7, Microsoft Ribbon, Visual studio 2010, dotnet 4.5
I would like to write the help files in html and include them inside the .exe file as an resource.
Is there a way of telling the explorer to get the html pages directly from the .exe file ?
If not, I assume the only way to archive it is to create a temporary directory, copy the
files and start the browser pointing to these files.
Is there a magic call that takes a resource directory and unpack/copy it to a directory ?
Like
tempDir = GetTempDirectory();
WPF_MAGIC_RESOURCE_UNPACKER("/help/*", tempDir );
System.Diagnostics.Process.Start(tempDir + Path.DirectorySeparatorChar + "index.html");
Regards Stefan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我同意@Tigran,这些应该与二进制文件分开存储,甚至在线存储,但如果您觉得这是最好的解决方案,您可能可以使用
Pack URI
WPF 功能。这主要用于图标资源和启动屏幕等图像,但也可以用于任何类型的内容。
您应该能够提取这些资源并将它们保存到文件系统或流中,并根据需要使用。
示例:
Uri AbsoluteUri = new Uri("pack://application:,,,/help/contents.htm", UriKind.Absolute);
I agree with @Tigran, these should be stored separate to the binary or even online, but if you feel as though this is the best solution you could probably make use of the
Pack URI
functionality of WPF.This is primarily used for images such as icon resources and splash screens, but could be used for any type of content.
You should be able to extract these resources and save them to the file system or to a stream and use as you see fit.
Example:
Uri absoluteUri = new Uri("pack://application:,,,/help/contents.htm", UriKind.Absolute);