You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement my own FileSystem code, but I am not able to get the assets/index.html file to be displayed properly. The UltralightSharp.SafeDemo runs well when the default AppCore.EnablePlatformFileSystem is used. Next I try to use my own by setting the FileSystem:
var assetsPath = Path.Combine(asmDir, "assets");
//Safe.AppCore.EnablePlatformFileSystem(assetsPath);
Ultralight.SetFileSystem(MyFileSystem.GetFileSystem(assetsPath));
When my own implementation of the FileSystem is set (basically, just my own implementation of the callback methods) , then nothing is shown in the UI for the URL "file:///index.html" and the view.SetFailLoadingCallback method reports:
See the attached file for details on how the MyFileSystem class is currently implemented. MyFileSystem.zip
Breakpoints in my code show that the FileSystemReadFromFileCallback is called as it is supposed to. I am able to load the data as UTF8 byte array and return the data (the test code that is commented out below shows that the data is loaded from the file into the string s) :
fs.ReadFromFile = new FileSystemReadFromFileCallback((handle, data) =>
{
uint nRead;
byte[] bytes = new byte[data.Length];
if (ReadFile(handle, bytes, (uint)data.Length, out nRead, IntPtr.Zero))
{
data = new ReadOnlySpan<byte>(bytes);
//string s = Encoding.UTF8.GetString(data.ToArray());
return (long)data.Length;
}
return -1;
});
After this method is done the FileSystemGetFileMimeTypeCallback method is called, where I set the returned result to the hardcoded mime type: "text/html" and return true.
After that the next thing that is logged is the reported error message. Is there some sample code that demonstrates how to build a custom FileSystem instance in c#? What is the problem causing the reported error message?
I am currently using ultralight-sdk-1.2.0-win-x64-min with the latest version of UltralightSharp from the master branch.
The text was updated successfully, but these errors were encountered:
Tested with UL v1.2.0-beta.2. Same behaviour and error as with the stable version.
Please note that when I try to test with the binaries distributed with the UltralightSharp SDK in the folder UltralightSharp-master\UltralightSharp.Core.WinX64\runtimes\win-x64\native, it seems that these are built for the AMD processor (or something else) so I get an error message when I try to use them:
System.BadImageFormatException: ' is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)'
I am trying to implement my own FileSystem code, but I am not able to get the assets/index.html file to be displayed properly. The UltralightSharp.SafeDemo runs well when the default AppCore.EnablePlatformFileSystem is used. Next I try to use my own by setting the FileSystem:
When my own implementation of the FileSystem is set (basically, just my own implementation of the callback methods) , then nothing is shown in the UI for the URL "file:///index.html" and the view.SetFailLoadingCallback method reports:
See the attached file for details on how the MyFileSystem class is currently implemented.
MyFileSystem.zip
Breakpoints in my code show that the FileSystemReadFromFileCallback is called as it is supposed to. I am able to load the data as UTF8 byte array and return the data (the test code that is commented out below shows that the data is loaded from the file into the string s) :
After this method is done the FileSystemGetFileMimeTypeCallback method is called, where I set the returned result to the hardcoded mime type: "text/html" and return true.
After that the next thing that is logged is the reported error message. Is there some sample code that demonstrates how to build a custom FileSystem instance in c#? What is the problem causing the reported error message?
I am currently using ultralight-sdk-1.2.0-win-x64-min with the latest version of UltralightSharp from the master branch.
The text was updated successfully, but these errors were encountered: