using System; using System.IO; using System.Windows.Forms; using CefSharp; using CefSharp.WinForms; using EasyTabs; using Google.Apis.Safebrowsing.v4; using Google.Apis.Safebrowsing.v4.Data; using Google.Apis.Services; using System.Collections.Generic; using System.Threading.Tasks; using System.Linq.Expressions; namespace XeroBrowser { public static class Program { //safebrowsing integration /* public static async Task IsUrlUnsafe(string url, string apiKey) { // ignore any file stored locally if (url.StartsWith("file://")) { return false; } var safeBrowsingService = new SafebrowsingService(new BaseClientService.Initializer { ApiKey = "AIzaSyCQV - s52iNah - il6T5iFuqo6M_JzcLyaxs", ApplicationName = "XeroBrowser" }); var request = new GoogleSecuritySafebrowsingV4FindThreatMatchesRequest { Client = new GoogleSecuritySafebrowsingV4ClientInfo { ClientId = "XeroBrowser", ClientVersion = "1.0" }, ThreatInfo = new GoogleSecuritySafebrowsingV4ThreatInfo { ThreatTypes = new List { "MALWARE", "SOCIAL_ENGINEERING", "UNWANTED_SOFTWARE", "POTENTIALLY_HARMFUL_APPLICATION" }, PlatformTypes = new List { "ANY_PLATFORM" }, ThreatEntryTypes = new List { "URL" }, ThreatEntries = new List { new GoogleSecuritySafebrowsingV4ThreatEntry { Url = url } } } }; var response = await safeBrowsingService.ThreatMatches.Find(request).ExecuteAsync(); try { } catch(System.Net.Http.HttpRequestException) { } return response != null && response.Matches != null && response.Matches.Count > 0; } */ public static AppContainer Container; private static TitleBarTabsApplicationContext _applicationContext; /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Container = new AppContainer(); CefSettings settings = new CefSettings(); settings.CefCommandLineArgs["plugin-policy"] = "allow"; settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 XeroBrowser/1.0.0"; settings.CefCommandLineArgs.Add("enable-media-stream", "1"); settings.CachePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\CEF"; settings.CefCommandLineArgs.Add("safebrowsing-disable-download-protection", "0"); settings.CefCommandLineArgs.Add("safebrowsing-disable-extension-blacklist", "0"); settings.CefCommandLineArgs.Add("enable-do-not-track"); /// settings.CefCommandLineArgs.Add("safebrowsing-disable-auto-update", "0"); FileChecker.FolderCheck(); FileChecker.FileCheck(); Cef.Initialize(settings); Container.Tabs.Add( new TitleBarTab(Container) { Content = new FrmBrowser { Text = @"New Tab" } } ); Container.SelectedTabIndex = 0; try { _applicationContext = new TitleBarTabsApplicationContext(); _applicationContext.Start(Container); Application.Run(_applicationContext); } catch (Exception) { // ignored } } } }