private static CefSettings GetCefSettings() { //Getting the Cache directory string CacheDirectory = @"C:\MoonByte\" + ResourceInformation.ApplicationName + @" Cache\"; // CEFSharp - Editing settings and browser Cache with CEFSHARP // cfSettings = new CefSettings(); //EditCefCommandLine("renderer-process-limit", "1"); //EditCefCommandLine("renderer-startup-dialog", "1"); //EditCefCommandLine("enable-media-stream", "1"); //Enable WebRTC //EditCefCommandLine("no-proxy-server", "1"); //Don't use a proxy server, always make direct connections. Overrides any other proxy server flag that are passed. //EditCefCommandLine("debug-plugin-loading", "1"); //Dumps extra logging about plugin loading to the log file. //EditCefCommandLine("disable-plugins-discovery", "1"); //Disable discovering third-party plugins. Effectively loading only ones shipped with the browser plus third-party ones as specified by --extra-plugin-dir and --load-plugin switches //EditCefCommandLine("enable-system-flash", "1"); //Automatically discovered and load a system-wide installation of Pepper Flash. //EditCefCommandLine("allow-running-insecure-content", "1"); //By default, an https page cannot run JavaScript, CSS or plugins from http URLs. This provides an override to get the old insecure behavior. Only available in 47 and above. //EditCefCommandLine("enable-logging", "1"); //Enable Logging for the Renderer process (will open with a cmd prompt and output debug messages - use in conjunction with setting LogSeverity = LogSeverity.Verbose;) //settings.LogSeverity = LogSeverity.Verbose; // Needed for enable-logging to output messages //EditCefCommandLine("disable-extensions", "1"); //Extension support can be disabled //EditCefCommandLine("disable-pdf-extension", "1"); //The PDF extension specifically can be disabled //Load the pepper flash player that comes with Google Chrome - may be possible to load these values from the registry and query the dll for it's version info (Step 2 not strictly required it seems) EditCefCommandLine("ppapi-flash-path", @"C:\Program Files (x86)\Google\Chrome\Application\47.0.2526.106\PepperFlash\pepflashplayer.dll"); //Load a specific pepper flash version (Step 1 of 2) EditCefCommandLine("ppapi-flash-version", "20.0.0.228"); //Load a specific pepper flash version (Step 2 of 2) EditCefCommandLine("enable-npapi", "1"); //NOTE: For OSR best performance you should run with GPU disabled: // `--disable-gpu --disable-gpu-compositing --enable-begin-frame-scheduling` // (you'll loose WebGL support but gain increased FPS and reduced CPU usage). // http://magpcss.org/ceforum/viewtopic.php?f=6&t=13271#p27075 //https://bitbucket.org/chromiumembedded/cef/commits/e3c1d8632eb43c1c2793d71639f3f5695696a5e8 //NOTE: The following function will set all three params //cfSettings.SetOffScreenRenderingBestPerformanceArgs(); //EditCefCommandLine("disable-gpu", "1"); //EditCefCommandLine("disable-gpu-compositing", "1"); //EditCefCommandLine("enable-begin-frame-scheduling", "1"); //EditCefCommandLine("disable-gpu-vsync", "1"); //Disables the DirectWrite font rendering system on windows. //Possibly useful when experiencing blury fonts. //EditCefCommandLine("disable-direct-write", "1"); cfSettings.IgnoreCertificateErrors = true; cfSettings.CachePath = CacheDirectory; cfSettings.UserAgent = UserAgents.GetUserAgent(); Directory.CreateDirectory(CacheDirectory); return(cfSettings); }
public static HttpClient CreateHttpClient(WebProxy proxy, int timeout = 30) => new HttpClient(CreateHttpClientHandler(proxy), true) { BaseAddress = new Uri(BaseAddress.GetAddress()), DefaultRequestHeaders = { { "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" }, { "Accept-Encoding", "gzip, deflate" }, { "Accept-Language", "pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" }, { "User-Agent", UserAgents.GetUserAgent() }, }, Timeout = TimeSpan.FromSeconds(timeout), };