Вопрос

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

Это было полезно?

Решение

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);

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top