当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 0

M78 / RBrowser
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Program.cs 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;
using Gecko;
namespace RBrowser
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
InitCef();
InitFireFox();
Application.Run(new FrmMain());
}
private static void InitCef()
{
var setting = new CefSettings
{
Locale = "zh-CN",
AcceptLanguageList = "zh-CN,zh;q=0.8",
PersistSessionCookies = true
};
// 设置是否使用GPU
setting.CefCommandLineArgs.Add("disable-gpu", "1");
// 设置是否使用代理服务
setting.CefCommandLineArgs.Add("no-proxy-server", "1");
//Cookies
string cachePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"\Chrome_Cache";
if (Directory.Exists(cachePath))
{
Directory.Delete(cachePath, true);
}
Directory.CreateDirectory(cachePath);
setting.CachePath = cachePath;
setting.PersistSessionCookies = true;
// 设置是否启动js交互,假如需要原生与js方法互调,则需要设置为true
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
// 初始化
Cef.Initialize(setting, performDependencyCheck: true, browserProcessHandler: null);
}
private static void InitFireFox()
{
Xpcom.Initialize("FireFox");
GeckoPreferences.User["intl.accept_languages"] = "zh-CN,zh;q=0.9,en;q=0.8";
string cachePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"\FireFox_Cache";
if (Directory.Exists(cachePath))
{
Directory.Delete(cachePath, true);
}
Directory.CreateDirectory(cachePath);
Gecko.Xpcom.ProfileDirectory = cachePath;
}
}
}
C#
1
https://gitee.com/ICF_M78/RBrowser.git
git@gitee.com:ICF_M78/RBrowser.git
ICF_M78
RBrowser
RBrowser
master

搜索帮助