Use a PAK file with CefSharp?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Use a PAK file with CefSharp?

Postby bPlaTyPuS » Wed Jun 13, 2018 7:20 am

Hi,

Is it possible to use a PAK (.pak) file with CefSharp? (the pak file contains all my html pages I have to use in my C# app)

How can I do that?

In Awesomium, my code was like this:
Code: Select all
    <UserControl.Resources>
        <awe:WebSessionProvider x:Key="WebSessionProvider"
                                DataPath=".\Cache">
            <awe:WebSessionProvider.DataSources>
                <data:DataPakSourceProvider x:Key="dpsp"
                                            PakPath="{Binding DataContext.PathToPakFile, Source={x:Reference XnameOfTheCurrentControl}}" /> <!-- PathToPakFile is the full path to the .pak file! -->
            </awe:WebSessionProvider.DataSources>
            <core:WebPreferences SmoothScrolling="True"
                                 EnableGPUAcceleration="True" />
        </awe:WebSessionProvider>
    </UserControl.Resources>

    <awe:WebControl x:Name="WebControl"
                        WebSession="{Binding Source={StaticResource WebSessionProvider}}"
                        Source="{Binding SourcePath}" /> <!-- SourcePath is something like "asset://dpsp/index.html" -> where index.html is located at the root of the .pak file. -->


Thank for your help :-).
bPlaTyPuS
Newbie
 
Posts: 3
Joined: Wed Jun 13, 2018 7:11 am

Re: Use a PAK file with CefSharp?

Postby magreenblatt » Wed Jun 13, 2018 10:49 am

CEF does not support loading of arbitrary PAK files. You can use ZIP files instead, or just include the files individually as application resources.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Use a PAK file with CefSharp?

Postby bPlaTyPuS » Mon Jun 18, 2018 2:58 am

magreenblatt wrote:CEF does not support loading of arbitrary PAK files. You can use ZIP files instead, or just include the files individually as application resources.


thanks for your reply! Do you have a sample using a zip file?
bPlaTyPuS
Newbie
 
Posts: 3
Joined: Wed Jun 13, 2018 7:11 am

Re: Use a PAK file with CefSharp?

Postby bPlaTyPuS » Mon Jun 18, 2018 4:31 am

just understood how to achieve it. Will use a custom SchemeHandler which will search through my zip file and extract the requested file.

thanks.
bPlaTyPuS
Newbie
 
Posts: 3
Joined: Wed Jun 13, 2018 7:11 am

Re: Use a PAK file with CefSharp?

Postby magreenblatt » Mon Jun 18, 2018 11:04 am

You can also use CefResourceManager to read ZIP files. You can see an example here: https://bitbucket.org/chromiumembedded/ ... e_manager/
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 25 guests