public void OnEventRaised(string eventType) { if (eventType.Equals("LaunchBoxStartupCompleted")) { LoadAuthToken(); if (!Cef.IsInitialized) { string launchboxDir = AppDomain.CurrentDomain.BaseDirectory; libraryLoader = new CefLibraryHandle($@"{launchboxDir}\CefSharp\x64\"); bool isValid = !libraryLoader.IsInvalid; CefSettings settings = new CefSettings(); settings.BrowserSubprocessPath = $@"{launchboxDir}\CefSharp\x64\CefSharp.BrowserSubprocess.exe"; Cef.Initialize(settings); } } else if (eventType.Equals("LaunchBoxShutdownBeginning")) { Cef.Shutdown(); libraryLoader.Dispose(); SaveAuthToken(); } }
public static bool InitStage1() { var libraryLoader = new CefLibraryHandle(Path.Combine(PATH_CEF, "libcef.dll")); libraryLoader.Dispose(); return(!libraryLoader.IsInvalid); }
static void Main() { CefLibraryHandle handle = new CefLibraryHandle(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"lib\libcef.dll")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); handle.Dispose(); }
public void InitializeBrowser() { lib = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp_x86\libcef.dll"); browser = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp_x86\CefSharp.BrowserSubprocess.exe"); locales = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp_x86\locales\"); res = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp_x86\"); var libraryLoader = new CefLibraryHandle(lib); var isValid = !libraryLoader.IsInvalid; if (isValid) { } }
private void InitializeChromium(string proxy, string url) { var cef_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"CefEOBrowser"); CefLibraryHandle libraryLoader = new CefLibraryHandle(Path.Combine(cef_path, @"bin\libcef.dll")); CefSettings settings = new CefSettings() { //LogFile = Path.Combine(cef_path, @"debug.log"), CachePath = Path.Combine(cef_path, @"cache"), UserDataPath = Path.Combine(cef_path, @"userdata"), ResourcesDirPath = Path.Combine(cef_path, @"bin"), LocalesDirPath = Path.Combine(cef_path, @"bin\locales"), BrowserSubprocessPath = Path.Combine(cef_path, @"bin\CefSharp.BrowserSubprocess.exe"), Locale = "ja", AcceptLanguageList = "ja-JP", LogSeverity = LogSeverity.Disable }; settings.CefCommandLineArgs.Add("proxy-server", proxy); var nogpu = Directory.EnumerateFiles(cef_path, "nogpu*"); if (nogpu.Any()) { settings.DisableGpuAcceleration(); switch (BrowserUILanguage) { case "zh": AddLog(2, $"检测到文件 {nogpu.FirstOrDefault()},GPU 加速已禁用。"); break; default: AddLog(2, $"{nogpu.FirstOrDefault()} を検出されました、GPU アクセラレーションを無効にする。"); break; } } Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null); Browser = new ChromiumWebBrowser(url) { FocusHandler = null, KeyboardHandler = new BrowserKeyboardHandler(), LifeSpanHandler = new BrowserLifeSpanHandler(), MenuHandler = new BrowserMenuHandler(), RequestHandler = new BrowserRequestHandler() }; Browser.BrowserSettings.StandardFontFamily = "Microsoft YaHei"; // Fixes text rendering position too high Browser.Dock = DockStyle.Fill; Browser.AddressChanged += Browser_AddressChanged; Browser.FrameLoadStart += Browser_FrameLoadEnd; SizeAdjuster.Controls.Add(Browser); SizeAdjuster.SizeChanged += SizeAdjuster_SizeChanged; libraryLoader.Dispose(); }
public static void Initialize() { var handler = new CefLibraryHandle(lib); if (!handler.IsInvalid) { var setting = new CefSharp.WinForms.CefSettings(); setting.LocalesDirPath = locales; setting.ResourcesDirPath = resource; setting.BrowserSubprocessPath = subprocessPath; setting.LogFile = "ceflog.txt"; Cef.Initialize(setting); } }
public Form1() { // Assigning file paths to varialbles lib = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\libcef.dll"); browser = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\CefSharp.BrowserSubprocess.exe"); locales = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\locales\"); res = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\"); var libraryLoader = new CefLibraryHandle(lib); InitializeComponent(); GetWebPage(); libraryLoader.Dispose(); }
static void Main() { lib = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp\libcef.dll"); browser = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp\CefSharp.BrowserSubprocess.exe"); locales = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp\locales\"); res = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"resources\cefsharp\"); var libraryLoader = new CefLibraryHandle(lib); var isValid = !libraryLoader.IsInvalid; Console.WriteLine($"Library is valid: {isValid}"); LoadForm(); libraryLoader.Dispose(); }
//CEFWorks CEF; public void InitBrowser() { CefLibraryHandle libraryLoader = new CefLibraryHandle(Settings.CEFLIB); CefSettings settings = new CefSettings(); settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); settings.BrowserSubprocessPath = Settings.CEFBRW; settings.LocalesDirPath = Settings.CEFLOC; settings.UserDataPath = Settings.CEFUSR; settings.CachePath = Settings.CEFBIN; settings.LogFile = Settings.LOGDIR + "\\debug.log"; // 3264 if (Environment.Is64BitOperatingSystem) { settings.ResourcesDirPath = Settings.CEFDIR; } else { settings.ResourcesDirPath = Settings.CEFDIR64; } CultureInfo ci = CultureInfo.InstalledUICulture; string specName = "en"; try { specName = CultureInfo.CreateSpecificCulture(ci.Name).Name; } catch { } settings.Locale = specName; Cef.Initialize(settings); browser = new ChromiumWebBrowser("rsrc://localhost/Resources/MainForm.html"); browser.FrameLoadEnd += Browser_FrameLoadEnd; Controls.Add(browser); browser.RegisterJsObject("main", this); browser.Dock = DockStyle.Fill; }
public CefManager() { lib = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bomba\libcef.dll"); browser = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bomba\CefSharp.BrowserSubprocess.exe"); locales = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bomba\locales\"); res = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bomba\"); var libraryLoader = new CefLibraryHandle(lib); bool isValid = !libraryLoader.IsInvalid; if (!isValid) { MessageBox.Show("Uygulama başlatılamadı. Dosyalar geçersiz."); Environment.Exit(0); } Settings.CachePath = Application.StartupPath + "\\cache"; Settings.BrowserSubprocessPath = browser; Settings.LocalesDirPath = locales; Settings.ResourcesDirPath = res; Settings.CefCommandLineArgs.Add("plugin-policy", "allow"); Settings.CefCommandLineArgs.Add("enable-gpu", "1"); Settings.CefCommandLineArgs.Add("enable-webgl", "1"); Settings.CefCommandLineArgs.Add("disable-gpu-vsync"); // Settings.CefCommandLineArgs.Add("enable-begin-frame-scheduling"); // Settings.CefCommandLineArgs.Add("disable-gpu-program-cache"); // Settings.CefCommandLineArgs.Add("disable-gpu-shader-disk-cache"); Settings.CefCommandLineArgs.Add("ppapi-flash-path", $"{Application.StartupPath}\\bomba\\pepflashplayer.dll"); Settings.CefCommandLineArgs.Add("ppapi-flash-version", "32.0.0.465"); Settings.UserAgent = "BigpointClient/1.4.6"; if (!Cef.IsInitialized) { Cef.Initialize(Settings); } }
public static void Initialize() { var userAgent = "Mozilla/5.0 (Windows NT " + (Environment.Is64BitOperatingSystem ? "x64" : "x86") + ") AppleWebKit/537.36 (KHTML, like Gecko) Aliapoh.Overlay/" + Environment.Version.ToString() + " Chrome/" + GlobalVariables.TargetCEFTAG.Substring(0, 4) + "." + GlobalVariables.TargetCEFVER.Substring(2, 4) + ".100 Safari/537.36"; CefLibraryHandle libloader = new CefLibraryHandle(Path.Combine(Loader.CEFDIR, "libcef.dll")); Cef.EnableHighDPISupport(); bool isValid = !libloader.IsInvalid; LOG.Logger.Log(LogLevel.Info, "CEF Libaray: " + (isValid ? "OK" : "Failed")); if (!isValid) { LOG.Logger.Log(LogLevel.Error, "Initialize Failed. CEF Binary is not valid"); } var setting = new CefSettings() { LocalesDirPath = Path.Combine(Loader.CEFDIR, "locales"), UserDataPath = Path.Combine(Loader.CEFDIR, "userdata"), CachePath = Path.Combine(Loader.CEFDIR, "Cache"), BrowserSubprocessPath = Path.Combine(Loader.CEFDIR, "CefSharp.BrowserSubprocess.exe"), Locale = LanguageLoader.CurrentCulture, ExternalMessagePump = false, MultiThreadedMessageLoop = true, WindowlessRenderingEnabled = true, IgnoreCertificateErrors = true, RemoteDebuggingPort = 9994, UserAgent = userAgent, LogSeverity = LogSeverity.Disable, }; if (!Cef.Initialize(setting)) { throw new Exception("Unable to Initialize Cef"); } libloader.Dispose(); }
public static void Registration() { // Assigning file paths to varialbles lib = Path.Combine(CrucibleApplication.PluginsDirectory, @"TextEditorPlugin_Resources\libcef.dll"); browser = Path.Combine(CrucibleApplication.PluginsDirectory, @"TextEditorPlugin_Resources\CefSharp.BrowserSubprocess.exe"); locales = Path.Combine(CrucibleApplication.PluginsDirectory, @"TextEditorPlugin_Resources\locales\"); res = Path.Combine(CrucibleApplication.PluginsDirectory, @"TextEditorPlugin_Resources\"); LibraryLoader = new CefLibraryHandle(lib); bool isValid = !LibraryLoader.IsInvalid; Console.WriteLine($"Library is valid: {isValid}"); CrucibleApplication.RegisterFileUI(FileType.Text, CreateTextFileTab); CrucibleApplication.RegisterFileUI(FileType.Configuration, CreateTextFileTab); CrucibleApplication.RegisterFileUI(FileType.XML, CreateTextFileTab); CrucibleApplication.RegisterFileUI(FileType.Lua, CreateTextFileTab); CrucibleApplication.RegisterFileUI(FileType.JSON, CreateTextFileTab); CrucibleApplication.RegisterFileUI(FileType.INI, CreateTextFileTab); CodeEditor.Controls.CodeEditor.Init(); }
private void InitializeChromium(string proxy, string url) { CefLibraryHandle libraryLoader = new CefLibraryHandle(Path.Combine(cef_path, @"bin\libcef.dll")); CefSettings settings = new CefSettings(); settings.CachePath = Path.Combine(cef_path, @"cache"); settings.UserDataPath = Path.Combine(cef_path, @"userdata"); settings.ResourcesDirPath = Path.Combine(cef_path, @"bin"); settings.LocalesDirPath = Path.Combine(cef_path, @"bin\locales"); settings.BrowserSubprocessPath = Path.Combine(cef_path, @"bin\CefSharp.BrowserSubprocess.exe"); settings.CefCommandLineArgs.Add("proxy-server", proxy); //settings.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"; // Fake UA as IE11 on Windows 7 settings.LogSeverity = LogSeverity.Disable; Cef.Initialize(settings); //chromeBrowser = new ChromiumWebBrowser("chrome://view-http-cache/"); //Browser = new ChromiumWebBrowser("http://www.whoishostingthis.com/tools/user-agent/"); //Browser = new ChromiumWebBrowser(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"CefEOBrowser\html\default.htm")); Browser = new ChromiumWebBrowser(url); Cef_started = true; //chromeBrowser.RequestHandler = new RequestHandler(); this.SizeAdjuster.Controls.Add(Browser); Browser.Dock = DockStyle.Fill; libraryLoader.Dispose(); }
static void Main() { #region Recover Settings if (Settings.Default.updateSettings) { Settings.Default.Upgrade(); Settings.Default.updateSettings = false; Settings.Default.Save(); } #endregion #region Get NTRViewer Ready try { // Shut down NTRViewer foreach (Process p in Process.GetProcessesByName("NTRViewer")) { p.Kill(); p.WaitForExit(); } // Extract to Temp Directory File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "NTRViewer.exe"), Resources.NTRViewer); File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "SDL2.dll"), Resources.SDL2); File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "turbojpeg.dll"), Resources.turbojpeg); } catch (Exception) { } #endregion #region Check for Updates using (WebClient wc = new WebClient()) { try { if (wc.DownloadString("https://raw.githubusercontent.com/PR4GM4/kit-kat/master/VERSION.txt") != FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.CodeBase.Replace("file:///", "")).ProductVersion) { MessageBox.Show("Download the latest version at github.com/PR4GM4/kit-kat/releases/latest\nUpdating is not enforced, but it is recommended.\nIf your having issues, updating might help.", "Update Available!"); } } catch (WebException) { //Ignore errors, count it as a failed update check and move on. } } #endregion #region CEFSharp Library Loader CefLibraryHandle libraryLoader = new CefLibraryHandle(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\libcef.dll")); Console.WriteLine($"Library is valid: {!libraryLoader.IsInvalid}"); #endregion #region CEFSharp Settings CefSettings cefSettings = new CefSettings() { LogSeverity = LogSeverity.Disable, MultiThreadedMessageLoop = true, BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\CefSharp.BrowserSubprocess.exe"), LocalesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\locales\"), ResourcesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\") }; if (cefSettings != null && !Cef.Initialize(cefSettings)) { MessageBox.Show("The reason is unknown, make sure you have every file and folder extracted and try again.", "CEFSharp Failed to initialize!"); } #endregion //Start mainform = new MainUI(); Application.EnableVisualStyles(); Application.Run(mainform); }
static void Main() { #region Recover Settings if (Settings.Default.updateSettings) { Settings.Default.Upgrade(); Settings.Default.updateSettings = false; Settings.Default.Save(); } #endregion #region Get NTRViewer Ready try { // Shut down NTRViewer foreach (Process p in Process.GetProcessesByName("NTRViewer")) { p.Kill(); p.WaitForExit(); } // Extract to Temp Directory File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "NTRViewer.exe"), Resources.NTRViewer); File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "SDL2.dll"), Resources.SDL2); File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "turbojpeg.dll"), Resources.turbojpeg); } catch (Exception) { } #endregion #region Check for Updates using (WebClient wc = new WebClient()) { try { if (wc.DownloadString("https://raw.githubusercontent.com/PR4GM4/kit-kat/master/VERSION.txt") != FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.CodeBase.Replace("file:///", "")).ProductVersion) { MessageBox.Show("Download the latest version at github.com/PR4GM4/kit-kat/releases/latest\nUpdating is not enforced, but it is recommended.\nIf your having issues, updating might help.", "Update Available!"); } } catch (WebException) { //Ignore errors, count it as a failed update check and move on. } } #endregion #region Check for C++ 2013 x86 if (!File.Exists(@Environment.SystemDirectory + "/msvcp120.dll")) { MessageBox.Show("C++ Redistributable 2013 x86 from Visual Studio 2013 is required and not currently installed.\n\nReady to install?\nPress OK and i'll bring you RIGHT to the official download page! (Please reboot your PC after installing. Required!)", "Missing Dependency!"); Process.Start("https://www.microsoft.com/en-ie/download/confirmation.aspx?id=40784&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1"); Process.GetCurrentProcess().Kill(); } #endregion #region CEFSharp Library Loader CefLibraryHandle libraryLoader = new CefLibraryHandle(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\libcef.dll")); Console.WriteLine($"Library is valid: {!libraryLoader.IsInvalid}"); #endregion #region CEFSharp Settings CefSettings cefSettings = new CefSettings() { LogSeverity = LogSeverity.Disable, MultiThreadedMessageLoop = true, BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\CefSharp.BrowserSubprocess.exe"), LocalesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\locales\"), ResourcesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"libs\") }; if (cefSettings != null && !Cef.Initialize(cefSettings)) { MessageBox.Show("The reason is unknown, make sure you have every file and folder extracted and try again.", "CEFSharp Failed to initialize!"); } #endregion //Start mainform = new MainUI(); Application.EnableVisualStyles(); Application.Run(mainform); }