|
|
|
|
using CefSharp;
|
|
|
|
|
using CefSharp.Wpf;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using 齐越慧眼.cefhelper;
|
|
|
|
|
|
|
|
|
|
namespace 齐越慧眼
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for App.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class App : Application
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否比价用户
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static bool IsPriceTaskUser { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 京东Cookie
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string JdCookie { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public App() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
|
|
|
var settings = new CefSettings()
|
|
|
|
|
{
|
|
|
|
|
UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.1.110 Safari/537.36 SE 2.X MetaSr 1.0",
|
|
|
|
|
Locale = "zh-CN",
|
|
|
|
|
AcceptLanguageList= "zh-CN,zh;q=0.8",
|
|
|
|
|
PersistSessionCookies=true,
|
|
|
|
|
CachePath = Directory.GetCurrentDirectory() + @"\Cache",
|
|
|
|
|
//LocalesDirPath = Directory.GetCurrentDirectory() + "/localeDir",
|
|
|
|
|
LogFile = Directory.GetCurrentDirectory() + "/LogData",
|
|
|
|
|
UserDataPath = Directory.GetCurrentDirectory() + "/userData"
|
|
|
|
|
};
|
|
|
|
|
settings.CefCommandLineArgs.Add("--js-flags", "--max_old_space_size=16384");
|
|
|
|
|
settings.CefCommandLineArgs.Add("enable-media-stream", "0");
|
|
|
|
|
settings.CefCommandLineArgs.Add("--ignore-urlfetcher-cert-requests", "1");
|
|
|
|
|
settings.CefCommandLineArgs.Add("--ignore-certificate-errors", "1");
|
|
|
|
|
settings.CefCommandLineArgs.Add("--disable-web-security", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings.CefCommandLineArgs.Add("disable-gpu", "0");
|
|
|
|
|
|
|
|
|
|
settings.CefCommandLineArgs.Add("no-proxy-server", "1");
|
|
|
|
|
//settings.CefCommandLineArgs.Add("ppapi-flash-path", AppDomain.CurrentDomain.BaseDirectory + "\\Plugins\\pepflash\\pepflashplayer.dll");
|
|
|
|
|
|
|
|
|
|
settings.RegisterScheme(new CefCustomScheme()
|
|
|
|
|
{
|
|
|
|
|
SchemeName = ResourceSchemeHandlerFactory.SchemeName,
|
|
|
|
|
SchemeHandlerFactory = new ResourceSchemeHandlerFactory()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ...
|
|
|
|
|
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|