SupinePandora43 / UltralightNet

.NET bindings for Ultralight next-gen HTML renderer
https://github.com/SupinePandora43/UltralightNet
MIT License
62 stars 10 forks source link

Cannot load local file #80

Closed meznoos closed 1 month ago

meznoos commented 1 month ago

Hi, I tried to load local html, but nothing loaded, no log too.

AppCoreMethods.SetPlatformFontLoader(); AppCoreMethods.ulEnableDefaultLogger("./ullog.txt"); ULPlatform.FileSystem = ULPlatform.DefaultFileSystem; ULPlatform.Logger = ULPlatform.DefaultLogger;

    var cfg = new ULConfig
    {
        ForceRepaint = false,
        CachePath = "/cache",
    };
    var setting = new ULSettings
    {
        ForceCPURenderer = false,
    };
    _app = ULApp.Create(setting,cfg);
    _scale = ScreenHelper.GetScaleFactor(Screen);

    var viewConfig = new ULViewConfig()
    {
        // IsAccelerated = false,
        IsTransparent = false,
        InitialDeviceScale = _scale,

    };

    _view = _app.Renderer.CreateView(1920, 1080, viewConfig, _app.Renderer.CreateSession(true, "thecookies"));

    _view.URL ="file:///index.html";
    // _view.URL = "https://docs.ultralig.ht/docs/logging-console-messages";
SupinePandora43 commented 1 month ago

Sorry for the misconception, but the "DefaultFileSystem" is actually "DefaultResourceOnlyFileSystem". Term resources in this case refers to the two most important files that are required for Ultralight's comfortable usage: cacert.pem for loading https pages, and icu.something.dt for not straight-up crashing and iirc localization/UTF/Unicode support.

SupinePandora43 commented 1 month ago

Use AppCoreMethods.ulEnablePlatformFileSystem