fix every last warning in every last file (non-html at least)

This commit is contained in:
RandomHuman 2023-02-20 03:59:04 -07:00
parent dc5d26d13e
commit f7eef416d9
14 changed files with 154 additions and 189 deletions

View file

@ -1,6 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
namespace WebBrowser namespace XeroBrowser
{ {
partial class AppContainer partial class AppContainer
{ {

View file

@ -1,6 +1,6 @@
using EasyTabs; using EasyTabs;
namespace WebBrowser namespace XeroBrowser
{ {
public partial class AppContainer : TitleBarTabs public partial class AppContainer : TitleBarTabs
{ {
@ -16,9 +16,9 @@ namespace WebBrowser
{ {
return new TitleBarTab(this) return new TitleBarTab(this)
{ {
Content = new frmBrowser Content = new FrmBrowser
{ {
Text = "New tab" Text = @"New tab"
} }
}; };
} }

View file

@ -8,18 +8,17 @@ using System.Net;
using CefSharp; using CefSharp;
using CefSharp.Enums; using CefSharp.Enums;
using CefSharp.Structs; using CefSharp.Structs;
using WebBrowser;
using Size = CefSharp.Structs.Size; using Size = CefSharp.Structs.Size;
namespace DiamondCreeperBrowser namespace XeroBrowser
{ {
public class DisplayHandler : IDisplayHandler public class DisplayHandler : IDisplayHandler
{ {
public frmBrowser frmref; public FrmBrowser Frmref;
public DisplayHandler(frmBrowser frm) public DisplayHandler(FrmBrowser frm)
{ {
frmref = frm; Frmref = frm;
} }
public static Icon BytesToIcon(byte[] bytes) public static Icon BytesToIcon(byte[] bytes)
{ {
@ -55,10 +54,10 @@ namespace DiamondCreeperBrowser
{ {
WebClient wc = new WebClient(); WebClient wc = new WebClient();
byte[] buffer = wc.DownloadData(urls[0]); byte[] buffer = wc.DownloadData(urls[0]);
frmref.Icon = BytesToIcon(buffer); Frmref.Icon = BytesToIcon(buffer);
frmref.Update(); Frmref.Update();
frmref.ParentTabs.UpdateThumbnailPreviewIcon(frmref.ParentTabs.Tabs.Single(t => t.Content == frmref)); Frmref.ParentTabs.UpdateThumbnailPreviewIcon(Frmref.ParentTabs.Tabs.Single(t => t.Content == Frmref));
frmref.ParentTabs.RedrawTabs(); Frmref.ParentTabs.RedrawTabs();
} }
@ -68,19 +67,19 @@ namespace DiamondCreeperBrowser
WebClient wc = new WebClient(); WebClient wc = new WebClient();
Uri furi = new Uri(chromiumWebBrowser.Address); Uri furi = new Uri(chromiumWebBrowser.Address);
byte[] buffer = wc.DownloadData(furi.GetLeftPart(UriPartial.Authority) +"/favicon.ico"); byte[] buffer = wc.DownloadData(furi.GetLeftPart(UriPartial.Authority) +"/favicon.ico");
frmref.Icon = BytesToIcon(buffer); Frmref.Icon = BytesToIcon(buffer);
frmref.Update(); Frmref.Update();
frmref.ParentTabs.UpdateThumbnailPreviewIcon(frmref.ParentTabs.Tabs.Single(t => t.Content == frmref)); Frmref.ParentTabs.UpdateThumbnailPreviewIcon(Frmref.ParentTabs.Tabs.Single(t => t.Content == Frmref));
frmref.ParentTabs.RedrawTabs(); Frmref.ParentTabs.RedrawTabs();
} }
catch (Exception){ catch (Exception){
ComponentResourceManager resources = new ComponentResourceManager(typeof(frmBrowser)); ComponentResourceManager resources = new ComponentResourceManager(typeof(FrmBrowser));
frmref.Icon = ((Icon)(resources.GetObject("$this.Icon"))); Frmref.Icon = ((Icon)(resources.GetObject("$this.Icon")));
frmref.Update(); Frmref.Update();
frmref.ParentTabs.UpdateThumbnailPreviewIcon(frmref.ParentTabs.Tabs.Single(t => t.Content == frmref)); Frmref.ParentTabs.UpdateThumbnailPreviewIcon(Frmref.ParentTabs.Tabs.Single(t => t.Content == Frmref));
frmref.ParentTabs.RedrawTabs(); Frmref.ParentTabs.RedrawTabs();
}; }
}; }
} }
public void OnFullscreenModeChange(IWebBrowser chromiumWebBrowser, IBrowser browser, bool fullscreen) public void OnFullscreenModeChange(IWebBrowser chromiumWebBrowser, IBrowser browser, bool fullscreen)

View file

@ -7,10 +7,9 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using CefSharp; using CefSharp;
using WebBrowser;
using Timer = System.Threading.Timer; using Timer = System.Threading.Timer;
namespace DiamondCreeperBrowser namespace XeroBrowser
{ {
public class DownloadHandler : IDownloadHandler public class DownloadHandler : IDownloadHandler
{ {
@ -18,30 +17,30 @@ namespace DiamondCreeperBrowser
public event EventHandler<DownloadItem> OnDownloadUpdatedFired; public event EventHandler<DownloadItem> OnDownloadUpdatedFired;
public frmBrowser frmref; public FrmBrowser Frmref;
public DownloadHandler(frmBrowser frm) public DownloadHandler(FrmBrowser frm)
{ {
frmref = frm; Frmref = frm;
} }
public DownloadProgress downloadProgress = new DownloadProgress(); public DownloadProgress DownloadProgress = new DownloadProgress();
public DownloadItem downloadItem; public DownloadItem DownloadItem;
public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback) public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
{ {
OnBeforeDownloadFired?.Invoke(this, downloadItem); OnBeforeDownloadFired?.Invoke(this, downloadItem);
this.downloadItem = downloadItem; this.DownloadItem = downloadItem;
try try
{ {
frmref.Invoke((Action)delegate Frmref.Invoke((Action)delegate
{ {
downloadProgress.Show(); DownloadProgress.Show();
downloadProgress.FormClosing += DownloadProgress_FormClosing; DownloadProgress.FormClosing += DownloadProgress_FormClosing;
}); });
} }
catch (ObjectDisposedException){}; catch (ObjectDisposedException){}
if (!callback.IsDisposed) if (!callback.IsDisposed)
{ {
@ -54,10 +53,10 @@ namespace DiamondCreeperBrowser
private void DownloadProgress_FormClosing(object sender, FormClosingEventArgs e) private void DownloadProgress_FormClosing(object sender, FormClosingEventArgs e)
{ {
downloadItem.IsCancelled = true; DownloadItem.IsCancelled = true;
} }
public Timer fivesecondtimer; public Timer Fivesecondtimer;
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback) public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
{ {
OnDownloadUpdatedFired?.Invoke(this, downloadItem); OnDownloadUpdatedFired?.Invoke(this, downloadItem);
@ -65,29 +64,28 @@ namespace DiamondCreeperBrowser
if (downloadItem.IsComplete) if (downloadItem.IsComplete)
{ {
fivesecondtimer = new Timer(tcallback, null, 1000 * 5, 1000 * 5); Fivesecondtimer = new Timer(tcallback, null, 1000 * 5, 1000 * 5);
} }
frmref.Invoke((Action)delegate { Frmref.Invoke((Action)delegate {
downloadProgress.ProgressBar1.Value = downloadItem.PercentComplete; DownloadProgress.ProgressBar1.Value = downloadItem.PercentComplete;
downloadProgress.ProgressPrecentage.Text = downloadItem.PercentComplete + "% " + (downloadItem.ReceivedBytes / 0x100000) + "MB / " + (downloadItem.TotalBytes / 0x100000) + "MB"; DownloadProgress.ProgressPrecentage.Text = downloadItem.PercentComplete + @"% " + (downloadItem.ReceivedBytes / 0x100000) + @"MB / " + (downloadItem.TotalBytes / 0x100000) + @"MB";
downloadProgress.ProgressFileName.Text = Path.GetFileName(downloadItem.FullPath); DownloadProgress.ProgressFileName.Text = Path.GetFileName(downloadItem.FullPath);
downloadProgress.Update(); DownloadProgress.Update();
try { } catch (InvalidAsynchronousStateException){}; try { } catch (InvalidAsynchronousStateException){}
}); });
} }
private void tcallback(object state) private void tcallback(object state)
{ {
try { try {
frmref.Invoke((Action)delegate Frmref.Invoke((Action)delegate
{ {
downloadProgress.Close(); DownloadProgress.Close();
}); });
} }
catch (InvalidOperationException){}; catch (InvalidOperationException){}
} }
} }
} }

View file

@ -1,8 +1,7 @@
 using System.ComponentModel;
using System.ComponentModel;
using Bunifu.UI.WinForms; using Bunifu.UI.WinForms;
namespace DiamondCreeperBrowser namespace XeroBrowser
{ {
partial class DownloadProgress partial class DownloadProgress
{ {

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
namespace DiamondCreeperBrowser namespace XeroBrowser
{ {
public partial class DownloadProgress : Form public partial class DownloadProgress : Form
{ {
@ -15,19 +15,9 @@ namespace DiamondCreeperBrowser
} }
private void label1_Click(object sender, EventArgs e)
{
}
private void DownloadProgress_FormClosing(object sender, FormClosingEventArgs e) private void DownloadProgress_FormClosing(object sender, FormClosingEventArgs e)
{ {
} }
private void bunifuLabel1_Click(object sender, EventArgs e)
{
}
} }
} }

View file

@ -3,10 +3,8 @@
using System; using System;
using CefSharp; using CefSharp;
using EasyTabs; using EasyTabs;
using WebBrowser;
using XeroBrowser;
namespace DiamondCreeperBrowser namespace XeroBrowser
{ {
public class LifeSpanHandler : ILifeSpanHandler public class LifeSpanHandler : ILifeSpanHandler
{ {
@ -19,12 +17,12 @@ namespace DiamondCreeperBrowser
TitleBarTab tab = new TitleBarTab(Program.Container) TitleBarTab tab = new TitleBarTab(Program.Container)
{ {
Content = new frmBrowser Content = new FrmBrowser
{ {
Text = "New Tab" Text = @"New Tab"
} }
}; };
frmBrowser frmref = (frmBrowser)tab.Content; FrmBrowser frmref = (FrmBrowser)tab.Content;
frmref.chromiumWebBrowser1.Load(targetUrl); frmref.chromiumWebBrowser1.Load(targetUrl);
Program.Container.Tabs.Add(tab); Program.Container.Tabs.Add(tab);
Program.Container.SelectedTab = tab; Program.Container.SelectedTab = tab;

View file

@ -2,81 +2,86 @@
using System.Windows.Forms; using System.Windows.Forms;
using CefSharp; using CefSharp;
public class MenuHandler : IContextMenuHandler namespace XeroBrowser
{ {
public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model) public class MenuHandler : IContextMenuHandler
{ {
// Remove any existent option using the Clear method of the model public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
//
//model.Clear();
Console.WriteLine("Context menu opened !");
// You can add a separator in case that there are more items on the list
if (model.Count > 0)
{ {
model.AddSeparator(); // Remove any existent option using the Clear method of the model
} //
//model.Clear();
Console.WriteLine(@"Context menu opened !");
// Add a new item to the list using the AddItem method of the model // You can add a separator in case that there are more items on the list
//model.AddItem((CefMenuCommand)113, "Copy link address"); if (model.Count > 0)
model.AddItem((CefMenuCommand)114, "Paste");
// Add a separator
//model.AddSeparator();
}
public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
{
// React to the first ID (show dev tools method)
if (commandId == (CefMenuCommand)26501)
{
browser.GetHost().ShowDevTools();
return true;
}
// React to the second ID (show dev tools method)
if (commandId == (CefMenuCommand)26502)
{
browser.GetHost().CloseDevTools();
return true;
}
// Any new item should be handled through a new if statement
if ((int)commandId == 113)
{
//using System.Windows.Forms;
try
{ {
Clipboard.SetText(parameters.SourceUrl); model.AddSeparator();
} }
catch (ArgumentException) { };
// Add a new item to the list using the AddItem method of the model
//model.AddItem((CefMenuCommand)113, "Copy link address");
model.AddItem((CefMenuCommand)114, "Paste");
// Add a separator
//model.AddSeparator();
} }
return false;
public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
{
// React to the first ID (show dev tools method)
if (commandId == (CefMenuCommand)26501)
{
browser.GetHost().ShowDevTools();
return true;
}
// React to the second ID (show dev tools method)
if (commandId == (CefMenuCommand)26502)
{
browser.GetHost().CloseDevTools();
return true;
}
// Any new item should be handled through a new if statement
if ((int)commandId == 113)
{
//using System.Windows.Forms;
try
{
Clipboard.SetText(parameters.SourceUrl);
}
catch (ArgumentException) { }
}
return false;
#pragma warning disable CS0162 // Unreachable code detected #pragma warning disable CS0162 // Unreachable code detected
if ((int)commandId == 114) /*
{ if ((int)commandId == 114)
//using System.Windows.Forms; {
Clipboard.GetText(); //using System.Windows.Forms;
} Clipboard.GetText();
}
#pragma warning restore CS0162 // Unreachable code detected #pragma warning restore CS0162 // Unreachable code detected
return false; return false;
*/
// Return false should ignore the selected option of the user ! // Return false should ignore the selected option of the user !
} }
public void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame) public void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame)
{ {
} }
public bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback) public bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback)
{ {
return false; return false;
}
} }
} }

View file

@ -4,7 +4,6 @@ using System.Windows.Forms;
using CefSharp; using CefSharp;
using CefSharp.WinForms; using CefSharp.WinForms;
using EasyTabs; using EasyTabs;
using WebBrowser;
namespace XeroBrowser namespace XeroBrowser
{ {
@ -41,7 +40,7 @@ namespace XeroBrowser
new TitleBarTab(Container) new TitleBarTab(Container)
{ {
Content = new frmBrowser Content = new FrmBrowser
{ {
Text = @"New Tab" Text = @"New Tab"
} }

View file

@ -2,7 +2,7 @@
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using CefSharp; using CefSharp;
namespace DiamondCreeperBrowser namespace XeroBrowser
{ {
public class RequestHandler : IRequestHandler public class RequestHandler : IRequestHandler
{ {

View file

@ -4,9 +4,9 @@ using Bunifu.UI.WinForms;
using CefSharp.WinForms; using CefSharp.WinForms;
using BunifuImageButton = Bunifu.UI.WinForms.BunifuImageButton; using BunifuImageButton = Bunifu.UI.WinForms.BunifuImageButton;
namespace WebBrowser namespace XeroBrowser
{ {
partial class frmBrowser partial class FrmBrowser
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@ -35,7 +35,7 @@ namespace WebBrowser
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmBrowser)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmBrowser));
Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties5 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties(); Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties5 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties();
Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties6 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties(); Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties6 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties();
Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties7 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties(); Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties7 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties();
@ -564,7 +564,7 @@ namespace WebBrowser
this.Controls.Add(this.bunifuCards1); this.Controls.Add(this.bunifuCards1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmBrowser"; this.Name = "FrmBrowser";
this.Text = "frmBrowser"; this.Text = "frmBrowser";
this.bunifuCards1.ResumeLayout(false); this.bunifuCards1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);

View file

@ -4,17 +4,16 @@ using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using Bunifu.Utils; using Bunifu.Utils;
using CefSharp; using CefSharp;
using DiamondCreeperBrowser;
using EasyTabs; using EasyTabs;
using XeroBrowser.Properties; using XeroBrowser.Properties;
namespace WebBrowser namespace XeroBrowser
{ {
public partial class frmBrowser : Form public partial class FrmBrowser : Form
{ {
Uri fileUri; Uri _fileUri;
Uri fileUri2; // Uri _fileUri2;
public frmBrowser() public FrmBrowser()
{ {
InitializeComponent(); InitializeComponent();
chromiumWebBrowser1.DownloadHandler = new DownloadHandler(this); chromiumWebBrowser1.DownloadHandler = new DownloadHandler(this);
@ -22,8 +21,8 @@ namespace WebBrowser
chromiumWebBrowser1.MenuHandler = new MenuHandler(); chromiumWebBrowser1.MenuHandler = new MenuHandler();
chromiumWebBrowser1.DisplayHandler = new DisplayHandler(this); chromiumWebBrowser1.DisplayHandler = new DisplayHandler(this);
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "index.html"); string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "index.html");
fileUri = new Uri(filePath); _fileUri = new Uri(filePath);
string fileUrl = fileUri.AbsoluteUri; string fileUrl = _fileUri.AbsoluteUri;
chromiumWebBrowser1.Load(fileUrl); chromiumWebBrowser1.Load(fileUrl);
txtSearchOrUrl.Text = ""; txtSearchOrUrl.Text = "";
CheckForIllegalCrossThreadCalls = false; CheckForIllegalCrossThreadCalls = false;
@ -59,7 +58,7 @@ namespace WebBrowser
chromiumWebBrowser1.Reload(); chromiumWebBrowser1.Reload();
} }
private bool isBlocked; private bool _isBlocked;
private void chromiumWebBrowser1_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e) private void chromiumWebBrowser1_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
{ {
if (e.IsLoading) if (e.IsLoading)
@ -75,14 +74,11 @@ namespace WebBrowser
try try
{ {
if (this == null)
return;
Invoke((Action)delegate Invoke((Action)delegate
{ {
if (txtSearchOrUrl != null && chromiumWebBrowser1 != null) if (txtSearchOrUrl != null && chromiumWebBrowser1 != null)
{ {
if (!chromiumWebBrowser1.Address.EndsWith(fileUri.ToString())) if (!chromiumWebBrowser1.Address.EndsWith(_fileUri.ToString()))
{ {
txtSearchOrUrl.Text = chromiumWebBrowser1.Address; txtSearchOrUrl.Text = chromiumWebBrowser1.Address;
} }
@ -110,9 +106,9 @@ namespace WebBrowser
else else
{ {
txtSearchOrUrl.IconLeft = Resources.insecure1; txtSearchOrUrl.IconLeft = Resources.insecure1;
if (!isBlocked) if (!_isBlocked)
{ {
MessageBox.Show("Warning: This site is insecure!, Your personal information may be at risk or hackers can install malicious software on your device.", "Xero Browser", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(@"Warning: This site is insecure!, Your personal information may be at risk or hackers can install malicious software on your device.", @"Xero Browser", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
} }
@ -137,29 +133,29 @@ namespace WebBrowser
string[] blockedUrls = { "https://diamondcreeper.org/1337", "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://www.youtube.com/watch?v=xm3YgoEiEDc", "https://www.youtube.com/watch?v=xvFZjo5PgG0", "https://www.youtube.com/watch?v=O91DT1pR1ew", "https://www.youtube.com/watch?v=o-YBDTqX_ZU", "https://www.youtube.com/watch?v=H8ZH_mkfPUY", "https://www.youtube.com/watch?v=o-YBDTqX_ZU", "https://www.youtube.com/watch?v=xvFZjo5PgG0" }; string[] blockedUrls = { "https://diamondcreeper.org/1337", "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://www.youtube.com/watch?v=xm3YgoEiEDc", "https://www.youtube.com/watch?v=xvFZjo5PgG0", "https://www.youtube.com/watch?v=O91DT1pR1ew", "https://www.youtube.com/watch?v=o-YBDTqX_ZU", "https://www.youtube.com/watch?v=H8ZH_mkfPUY", "https://www.youtube.com/watch?v=o-YBDTqX_ZU", "https://www.youtube.com/watch?v=xvFZjo5PgG0" };
string[] blockedDrms = { "netflix.com", "disneyplus.com" }; string[] blockedDrms = { "netflix.com", "disneyplus.com" };
if (!isBlocked) if (!_isBlocked)
{ {
foreach (string blockedDrm in blockedDrms) foreach (string blockedDrm in blockedDrms)
{ {
if (chromiumWebBrowser1.Address.StartsWith(blockedDrm)) if (chromiumWebBrowser1.Address.StartsWith(blockedDrm))
{ {
chromiumWebBrowser1.Stop(); // cancel the navigation chromiumWebBrowser1.Stop(); // cancel the navigation
isBlocked = true; _isBlocked = true;
chromiumWebBrowser1.LoadHtml("<html><body><h1>Error!</h1><h3>This website requires a DRM (Digital Rights Management) which Xero Browser does not support!</h3></body></html>", blockedDrm); chromiumWebBrowser1.LoadHtml("<html><body><h1>Error!</h1><h3>This website requires a DRM (Digital Rights Management) which Xero Browser does not support!</h3></body></html>", blockedDrm);
} }
}; }
foreach (string blockedUrl in blockedUrls) foreach (string blockedUrl in blockedUrls)
{ {
if (chromiumWebBrowser1.Address.StartsWith(blockedUrl)) if (chromiumWebBrowser1.Address.StartsWith(blockedUrl))
{ {
chromiumWebBrowser1.Stop(); // cancel the navigation chromiumWebBrowser1.Stop(); // cancel the navigation
isBlocked = true; _isBlocked = true;
chromiumWebBrowser1.LoadHtml("<html><body><h1>Rickroll Blocked!</h1><p>Being rickrolled is disabled.</p></body></html>", blockedUrl); chromiumWebBrowser1.LoadHtml("<html><body><h1>Rickroll Blocked!</h1><p>Being rickrolled is disabled.</p></body></html>", blockedUrl);
} }
}; }
} }
} }
@ -174,7 +170,7 @@ namespace WebBrowser
private void btnSettings_Click(object sender, EventArgs e) private void btnSettings_Click(object sender, EventArgs e)
{ {
Backdrop.Show(new frmSettings()); Backdrop.Show(new FrmSettings());
} }
private void chromiumWebBrowser1_KeyDown(object sender, KeyEventArgs e) private void chromiumWebBrowser1_KeyDown(object sender, KeyEventArgs e)
@ -189,16 +185,9 @@ namespace WebBrowser
private void chromiumWebBrowser1_LoadError(object sender, LoadErrorEventArgs e) private void chromiumWebBrowser1_LoadError(object sender, LoadErrorEventArgs e)
{ {
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "loaderror.html"); // string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "loaderror.html");
fileUri2 = new Uri(filePath); // _fileUri2 = new Uri(filePath);
string fileUrl = fileUri2.AbsoluteUri; // string fileUrl = _fileUri2.AbsoluteUri;
}
private void bunifuImageButton2_Click(object sender, EventArgs e, frmSettings frmSettings)
{
string url = frmSettings.bunifuTextBox1.Text; // Get the URL from the text box on the form
chromiumWebBrowser1.Load(url); // Navigate to the specified URL
} }
private void txtSearchOrUrl_KeyUp(object sender, KeyEventArgs e) private void txtSearchOrUrl_KeyUp(object sender, KeyEventArgs e)

View file

@ -3,9 +3,9 @@ using System.Windows.Forms;
using Bunifu.UI.WinForms; using Bunifu.UI.WinForms;
using Bunifu.UI.WinForms.BunifuButton; using Bunifu.UI.WinForms.BunifuButton;
namespace WebBrowser namespace XeroBrowser
{ {
partial class frmSettings partial class FrmSettings
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@ -37,7 +37,7 @@ namespace WebBrowser
Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties10 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties(); Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties10 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties();
Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties11 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties(); Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties11 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties();
Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties12 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties(); Bunifu.UI.WinForms.BunifuTextBox.StateProperties stateProperties12 = new Bunifu.UI.WinForms.BunifuTextBox.StateProperties();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSettings)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmSettings));
Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges borderEdges5 = new Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges(); Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges borderEdges5 = new Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges();
Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges borderEdges6 = new Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges(); Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges borderEdges6 = new Bunifu.UI.WinForms.BunifuButton.BunifuButton2.BorderEdges();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
@ -1196,7 +1196,7 @@ namespace WebBrowser
this.Controls.Add(this.bunifuLabel3); this.Controls.Add(this.bunifuLabel3);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmSettings"; this.Name = "FrmSettings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "frmSettings"; this.Text = "frmSettings";
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);

View file

@ -1,27 +1,19 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms; using System.Windows.Forms;
using Bunifu.UI.WinForms; // using Bunifu.UI.WinForms;
namespace WebBrowser namespace XeroBrowser
{ {
public partial class frmSettings : Form public partial class FrmSettings : Form
{ {
public frmSettings() public FrmSettings()
{ {
InitializeComponent(); InitializeComponent();
} }
private void bunifuToggleSwitchflash_CheckedChanged(object sender, BunifuToggleSwitch.CheckedChangedEventArgs e)
{
}
private void bunifuToggleSwitchcookies_CheckedChanged(object sender, BunifuToggleSwitch.CheckedChangedEventArgs e)
{
}
private void bunifuDropdown1_SelectedIndexChanged(object sender, EventArgs e) private void bunifuDropdown1_SelectedIndexChanged(object sender, EventArgs e)
{ {
@ -33,10 +25,6 @@ namespace WebBrowser
Process.Start("ms-settings:network-proxy"); Process.Start("ms-settings:network-proxy");
} }
private void frmSettings_FormClosing(object sender, FormClosingEventArgs e, Form form)
{
}
private void bunifuPictureBox1_Click(object sender, EventArgs e) private void bunifuPictureBox1_Click(object sender, EventArgs e)
{ {