mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
add CefService
This commit is contained in:
60
CefService.cs
Normal file
60
CefService.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace VRCX
|
||||
{
|
||||
public static class CefService
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var cefSettings = new CefSettings
|
||||
{
|
||||
CachePath = Path.Combine(Program.BaseDirectory, "cache"),
|
||||
UserDataPath = Path.Combine(Program.BaseDirectory, "userdata"),
|
||||
IgnoreCertificateErrors = true,
|
||||
LogSeverity = LogSeverity.Disable,
|
||||
WindowlessRenderingEnabled = true,
|
||||
PersistSessionCookies = true,
|
||||
PersistUserPreferences = true
|
||||
};
|
||||
|
||||
/*cefSettings.RegisterScheme(new CefCustomScheme
|
||||
{
|
||||
SchemeName = "vrcx",
|
||||
DomainName = "app",
|
||||
SchemeHandlerFactory = new FolderSchemeHandlerFactory(Application.StartupPath + "/../../../html")
|
||||
});*/
|
||||
|
||||
cefSettings.CefCommandLineArgs.Add("ignore-certificate-errors");
|
||||
cefSettings.CefCommandLineArgs.Add("disable-plugins");
|
||||
cefSettings.CefCommandLineArgs.Add("disable-spell-checking");
|
||||
cefSettings.CefCommandLineArgs.Add("disable-pdf-extension");
|
||||
cefSettings.CefCommandLineArgs.Add("disable-extensions");
|
||||
// cefSettings.CefCommandLineArgs.Add("allow-universal-access-from-files");
|
||||
// cefSettings.CefCommandLineArgs.Add("disable-web-security");
|
||||
cefSettings.CefCommandLineArgs.Add("disable-gpu");
|
||||
cefSettings.CefCommandLineArgs.Add("disable-gpu-compositing");
|
||||
cefSettings.CefCommandLineArgs.Add("disable-webgl");
|
||||
cefSettings.DisableGpuAcceleration();
|
||||
cefSettings.SetOffScreenRenderingBestPerformanceArgs();
|
||||
|
||||
CefSharpSettings.WcfEnabled = true; // TOOD: REMOVE THIS LINE YO
|
||||
CefSharpSettings.ShutdownOnExit = false;
|
||||
|
||||
// Enable High-DPI support on Windows 7 or newer
|
||||
Cef.EnableHighDPISupport();
|
||||
|
||||
if (Cef.Initialize(cefSettings) == false)
|
||||
{
|
||||
throw new Exception("Cef.Initialize()");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Exit()
|
||||
{
|
||||
Cef.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user