fix every last warning in every last file (non-html at least)
This commit is contained in:
parent
dc5d26d13e
commit
f7eef416d9
14 changed files with 154 additions and 189 deletions
2
WebBrowser/AppContainer.Designer.cs
generated
2
WebBrowser/AppContainer.Designer.cs
generated
|
@ -1,6 +1,6 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace WebBrowser
|
namespace XeroBrowser
|
||||||
{
|
{
|
||||||
partial class AppContainer
|
partial class AppContainer
|
||||||
{
|
{
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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,29 +17,29 @@ 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){}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
5
WebBrowser/DownloadProgress.Designer.cs
generated
5
WebBrowser/DownloadProgress.Designer.cs
generated
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
|
|
||||||
|
namespace XeroBrowser
|
||||||
|
{
|
||||||
public class MenuHandler : IContextMenuHandler
|
public class MenuHandler : IContextMenuHandler
|
||||||
{
|
{
|
||||||
public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
|
public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
|
||||||
|
@ -10,7 +12,7 @@ public class MenuHandler : IContextMenuHandler
|
||||||
//
|
//
|
||||||
//model.Clear();
|
//model.Clear();
|
||||||
|
|
||||||
Console.WriteLine("Context menu opened !");
|
Console.WriteLine(@"Context menu opened !");
|
||||||
|
|
||||||
// You can add a separator in case that there are more items on the list
|
// You can add a separator in case that there are more items on the list
|
||||||
if (model.Count > 0)
|
if (model.Count > 0)
|
||||||
|
@ -53,12 +55,13 @@ public class MenuHandler : IContextMenuHandler
|
||||||
{
|
{
|
||||||
Clipboard.SetText(parameters.SourceUrl);
|
Clipboard.SetText(parameters.SourceUrl);
|
||||||
}
|
}
|
||||||
catch (ArgumentException) { };
|
catch (ArgumentException) { }
|
||||||
}
|
}
|
||||||
return false;
|
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;
|
//using System.Windows.Forms;
|
||||||
|
@ -66,6 +69,7 @@ public class MenuHandler : IContextMenuHandler
|
||||||
}
|
}
|
||||||
#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 !
|
||||||
}
|
}
|
||||||
|
@ -80,3 +84,4 @@ public class MenuHandler : IContextMenuHandler
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
8
WebBrowser/frmBrowser.Designer.cs
generated
8
WebBrowser/frmBrowser.Designer.cs
generated
|
@ -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);
|
||||||
|
|
|
@ -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)
|
||||||
|
|
8
WebBrowser/frmSettings.Designer.cs
generated
8
WebBrowser/frmSettings.Designer.cs
generated
|
@ -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);
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue