Compare commits
12 Commits
release/0.
...
master
Author | SHA1 | Date | |
---|---|---|---|
de42bc7f66 | |||
|
f769de084e | ||
|
b4f236266a | ||
|
5f2aeb78bf | ||
3c4e1c735a | |||
|
b17ba5665b | ||
|
ce54eb7ce4 | ||
|
0a7bf62bff | ||
a8ecd88fd3 | |||
|
10df3a2219 | ||
|
c90a34904d | ||
527c87889e |
312
AddBatchPageForm.cs
Normal file
312
AddBatchPageForm.cs
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using BookmarkManager.Services;
|
||||||
|
using bzit.bomg.Models;
|
||||||
|
using RyzStudio.Windows.Forms;
|
||||||
|
using RyzStudio.Windows.ThemedForms;
|
||||||
|
|
||||||
|
namespace FizzyLauncher
|
||||||
|
{
|
||||||
|
public class AddBatchPageForm : Form
|
||||||
|
{
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
|
||||||
|
|
||||||
|
private readonly WebProvider _webProvider;
|
||||||
|
private string _rootPath;
|
||||||
|
private bool _isBusy = false;
|
||||||
|
private THorizontalSeparator tHorizontalSeparator3;
|
||||||
|
private ThButton button3;
|
||||||
|
private ThProgressBar progressBar2;
|
||||||
|
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
|
||||||
|
private ThToolbarMemoBox memoBox1;
|
||||||
|
private List<BookmarkModel> _result = new List<BookmarkModel>();
|
||||||
|
private bool _requestCancel = false;
|
||||||
|
|
||||||
|
|
||||||
|
public AddBatchPageForm(string rootPath)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
UISetup.Dialog(this);
|
||||||
|
|
||||||
|
_result = new List<BookmarkModel>();
|
||||||
|
|
||||||
|
_webProvider = new WebProvider();
|
||||||
|
_webProvider.IgnoreSSL = true;
|
||||||
|
|
||||||
|
_rootPath = rootPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
label1 = new Label();
|
||||||
|
tHorizontalSeparator3 = new THorizontalSeparator();
|
||||||
|
button3 = new ThButton();
|
||||||
|
progressBar2 = new ThProgressBar();
|
||||||
|
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
||||||
|
memoBox1 = new ThToolbarMemoBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
label1.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||||
|
label1.Location = new System.Drawing.Point(10, 20);
|
||||||
|
label1.Margin = new Padding(0);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Padding = new Padding(0, 8, 0, 0);
|
||||||
|
label1.Size = new System.Drawing.Size(185, 23);
|
||||||
|
label1.TabIndex = 153;
|
||||||
|
label1.Text = "Add pages (one URL on each line)";
|
||||||
|
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// tHorizontalSeparator3
|
||||||
|
//
|
||||||
|
tHorizontalSeparator3.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tHorizontalSeparator3.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||||
|
tHorizontalSeparator3.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||||
|
tHorizontalSeparator3.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
tHorizontalSeparator3.Location = new System.Drawing.Point(10, 321);
|
||||||
|
tHorizontalSeparator3.Margin = new Padding(0, 10, 0, 0);
|
||||||
|
tHorizontalSeparator3.MaximumSize = new System.Drawing.Size(4920, 2);
|
||||||
|
tHorizontalSeparator3.MinimumSize = new System.Drawing.Size(0, 22);
|
||||||
|
tHorizontalSeparator3.Name = "tHorizontalSeparator3";
|
||||||
|
tHorizontalSeparator3.Size = new System.Drawing.Size(424, 22);
|
||||||
|
tHorizontalSeparator3.TabIndex = 207;
|
||||||
|
tHorizontalSeparator3.TabStop = false;
|
||||||
|
//
|
||||||
|
// button3
|
||||||
|
//
|
||||||
|
button3.ActiveImage = null;
|
||||||
|
button3.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
button3.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
button3.EnableMenuOnClick = false;
|
||||||
|
button3.EnableReactiveVisual = true;
|
||||||
|
button3.HoverImage = null;
|
||||||
|
button3.IdleImage = null;
|
||||||
|
button3.LabelText = "&Add Pages";
|
||||||
|
button3.Location = new System.Drawing.Point(306, 393);
|
||||||
|
button3.Name = "button3";
|
||||||
|
button3.Size = new System.Drawing.Size(128, 32);
|
||||||
|
button3.TabIndex = 209;
|
||||||
|
button3.TabStop = false;
|
||||||
|
button3.MouseClick += button3_MouseClick;
|
||||||
|
//
|
||||||
|
// progressBar2
|
||||||
|
//
|
||||||
|
progressBar2.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
progressBar2.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
progressBar2.BarColour = System.Drawing.Color.FromArgb(79, 193, 203);
|
||||||
|
progressBar2.BarTextColour = System.Drawing.Color.Black;
|
||||||
|
progressBar2.EnableReactiveVisual = false;
|
||||||
|
progressBar2.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||||
|
progressBar2.Location = new System.Drawing.Point(10, 353);
|
||||||
|
progressBar2.Maximum = 100;
|
||||||
|
progressBar2.Minimum = 0;
|
||||||
|
progressBar2.Name = "progressBar2";
|
||||||
|
progressBar2.ProgressText = "50/100";
|
||||||
|
progressBar2.ShowProgressText = true;
|
||||||
|
progressBar2.Size = new System.Drawing.Size(424, 20);
|
||||||
|
progressBar2.TabIndex = 210;
|
||||||
|
progressBar2.TabStop = false;
|
||||||
|
progressBar2.Value = 50;
|
||||||
|
//
|
||||||
|
// dialogFooter1
|
||||||
|
//
|
||||||
|
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
|
||||||
|
dialogFooter1.Button1Text = "&Close";
|
||||||
|
dialogFooter1.Dialog = this;
|
||||||
|
dialogFooter1.Dock = DockStyle.Bottom;
|
||||||
|
dialogFooter1.IsBusy = false;
|
||||||
|
dialogFooter1.Location = new System.Drawing.Point(0, 437);
|
||||||
|
dialogFooter1.Name = "dialogFooter1";
|
||||||
|
dialogFooter1.Size = new System.Drawing.Size(444, 84);
|
||||||
|
//
|
||||||
|
// memoBox1
|
||||||
|
//
|
||||||
|
memoBox1.AllowDrop = true;
|
||||||
|
memoBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
memoBox1.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
memoBox1.ClearedValue = "";
|
||||||
|
memoBox1.EnableReactiveVisual = true;
|
||||||
|
memoBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||||
|
memoBox1.Location = new System.Drawing.Point(10, 53);
|
||||||
|
memoBox1.Name = "memoBox1";
|
||||||
|
memoBox1.ReadOnly = false;
|
||||||
|
memoBox1.ScrollBars = ScrollBars.Vertical;
|
||||||
|
memoBox1.Size = new System.Drawing.Size(424, 258);
|
||||||
|
memoBox1.TabIndex = 211;
|
||||||
|
memoBox1.TabStop = false;
|
||||||
|
memoBox1.WordWrap = false;
|
||||||
|
//
|
||||||
|
// AddBatchPageForm
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = System.Drawing.Color.White;
|
||||||
|
ClientSize = new System.Drawing.Size(444, 521);
|
||||||
|
Controls.Add(memoBox1);
|
||||||
|
Controls.Add(dialogFooter1);
|
||||||
|
Controls.Add(progressBar2);
|
||||||
|
Controls.Add(button3);
|
||||||
|
Controls.Add(tHorizontalSeparator3);
|
||||||
|
Controls.Add(label1);
|
||||||
|
KeyPreview = true;
|
||||||
|
MinimumSize = new System.Drawing.Size(460, 560);
|
||||||
|
Name = "AddBatchPageForm";
|
||||||
|
Text = "Add Pages (Batch)";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLoad(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoad(e);
|
||||||
|
|
||||||
|
memoBox1.Text = string.Empty;
|
||||||
|
|
||||||
|
progressBar2.Minimum = 0;
|
||||||
|
progressBar2.Value = 0;
|
||||||
|
progressBar2.Maximum = memoBox1.Lines?.Length ?? 0;
|
||||||
|
|
||||||
|
memoBox1.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClosing(CancelEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnClosing(e);
|
||||||
|
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<BookmarkModel> Result
|
||||||
|
{
|
||||||
|
get => _result;
|
||||||
|
private set => _result = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected bool IsBusy
|
||||||
|
{
|
||||||
|
get => _isBusy;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_isBusy = value;
|
||||||
|
|
||||||
|
UIControl.SetEnable(memoBox1, !this.IsBusy);
|
||||||
|
UIControl.Invoke(button3, (x) =>
|
||||||
|
{
|
||||||
|
button3.LabelText = (this.IsBusy ? "&Stop" : "&Add Pages");
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogFooter1.IsBusy = _isBusy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void button3_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
await Task.Run(async () =>
|
||||||
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
_requestCancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.IsBusy = true;
|
||||||
|
|
||||||
|
this.Result = new List<BookmarkModel>();
|
||||||
|
|
||||||
|
progressBar2.Minimum = 0;
|
||||||
|
progressBar2.Value = 0;
|
||||||
|
progressBar2.Maximum = memoBox1.Lines?.Length ?? 0;
|
||||||
|
|
||||||
|
foreach (var item in memoBox1.Lines ?? new string[0])
|
||||||
|
{
|
||||||
|
progressBar2.Value++;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(item))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newModel = new BookmarkModel();
|
||||||
|
newModel.Address = item;
|
||||||
|
newModel.Path = _rootPath;
|
||||||
|
|
||||||
|
if (_requestCancel)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
newModel = await UpdateBookmark(newModel, true, true);
|
||||||
|
if (newModel == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_requestCancel)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Result.Add(newModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
//_requestCancel = false;
|
||||||
|
|
||||||
|
this.IsBusy = false;
|
||||||
|
|
||||||
|
if (!_requestCancel)
|
||||||
|
{
|
||||||
|
this.DialogResult = DialogResult.OK;
|
||||||
|
|
||||||
|
UIControl.Close(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_requestCancel = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<BookmarkModel> UpdateBookmark(BookmarkModel model, bool updateTitle, bool updateDescription)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(model.Address))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!model.Address.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) && !model.Address.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
model.Address = "http://" + model.Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
var document = await _webProvider.RetrieveHtmlDocument(model.Address);
|
||||||
|
if (document == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateTitle)
|
||||||
|
{
|
||||||
|
model.Title = _webProvider.ParseTitle(document);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateDescription)
|
||||||
|
{
|
||||||
|
model.Description = _webProvider.ParseDescription(document);
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
AddBatchPageForm.resx
Normal file
120
AddBatchPageForm.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
50
AppResource.Designer.cs
generated
50
AppResource.Designer.cs
generated
@ -126,16 +126,6 @@ namespace BookmarkManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap file {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("file", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -166,16 +156,6 @@ namespace BookmarkManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap help_circle {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("help_circle", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -196,36 +176,6 @@ namespace BookmarkManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap save {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("save", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap search {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("search", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap settings {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("settings", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -139,9 +139,6 @@
|
|||||||
<data name="bookmark" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="bookmark" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>Resources\bookmark.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>Resources\bookmark.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="file" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>Resources\file.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="file_text" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="file_text" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>Resources\file-text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>Resources\file-text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
@ -151,24 +148,12 @@
|
|||||||
<data name="folder_explore" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="folder_explore" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>Resources\folder_explore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>Resources\folder_explore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="help_circle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>Resources\help-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="hexagon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="hexagon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>Resources\hexagon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>Resources\hexagon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="icon_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icon_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>Resources\icon-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>Resources\icon-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="save" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>Resources\save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="search" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>Resources\search.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="settings" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>Resources\settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="trash" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="trash" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>Resources\trash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>Resources\trash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<Copyright>Ray Lam</Copyright>
|
<Copyright>Ray Lam</Copyright>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
<FileVersion>1.0.0.0</FileVersion>
|
||||||
<Version>0.6.0.972</Version>
|
<Version>0.6.2.092</Version>
|
||||||
<PackageId>bukkubuddy</PackageId>
|
<PackageId>bukkubuddy</PackageId>
|
||||||
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
|
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
|
||||||
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
||||||
@ -106,6 +106,9 @@
|
|||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>AppResource.resx</DependentUpon>
|
<DependentUpon>AppResource.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="AddBatchPageForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="UpdateIconsForm.cs" />
|
<Compile Update="UpdateIconsForm.cs" />
|
||||||
<Compile Update="FindForm.cs" />
|
<Compile Update="FindForm.cs" />
|
||||||
<Compile Update="EditBookmarkForm.cs" />
|
<Compile Update="EditBookmarkForm.cs" />
|
||||||
@ -120,8 +123,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
|
||||||
<PackageReference Include="RyzStudio" Version="8.1.2.249" />
|
<PackageReference Include="RyzStudio" Version="8.1.2.366" />
|
||||||
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.614" />
|
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.689" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Xml;
|
||||||
using BookmarkManager.Services;
|
using BookmarkManager.Services;
|
||||||
using bzit.bomg.Models;
|
using bzit.bomg.Models;
|
||||||
using RyzStudio.Windows.Forms;
|
using RyzStudio.Windows.Forms;
|
||||||
@ -20,7 +22,6 @@ namespace FizzyLauncher
|
|||||||
private Label label4;
|
private Label label4;
|
||||||
private ThHiButtonTextBox textBox2;
|
private ThHiButtonTextBox textBox2;
|
||||||
private PictureBox pictureBox1;
|
private PictureBox pictureBox1;
|
||||||
private PictureBox pictureBox2;
|
|
||||||
private ToolTip toolTip1;
|
private ToolTip toolTip1;
|
||||||
private System.ComponentModel.IContainer components;
|
private System.ComponentModel.IContainer components;
|
||||||
private ThClearableTextBox textBox3;
|
private ThClearableTextBox textBox3;
|
||||||
@ -55,11 +56,19 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (model.Icon != null)
|
||||||
|
{
|
||||||
|
if (model.Icon.Width > 16)
|
||||||
|
{
|
||||||
|
model.Icon = RyzStudio.Drawing.ImageEditor.Resize(model.Icon, 16, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pictureBox1.Image = model.Icon;
|
pictureBox1.Image = model.Icon;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
// do nothing
|
pictureBox1.Image = model.Icon = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
memoBox1.Text = model.Notes?.Trim() ?? string.Empty;
|
memoBox1.Text = model.Notes?.Trim() ?? string.Empty;
|
||||||
@ -68,7 +77,7 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
components = new System.ComponentModel.Container();
|
components = new Container();
|
||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
textBox1 = new ThClearableTextBox();
|
textBox1 = new ThClearableTextBox();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
@ -78,13 +87,11 @@ namespace FizzyLauncher
|
|||||||
textBox2 = new ThHiButtonTextBox();
|
textBox2 = new ThHiButtonTextBox();
|
||||||
pictureBox1 = new PictureBox();
|
pictureBox1 = new PictureBox();
|
||||||
toolTip1 = new ToolTip(components);
|
toolTip1 = new ToolTip(components);
|
||||||
pictureBox2 = new PictureBox();
|
|
||||||
textBox3 = new ThClearableTextBox();
|
textBox3 = new ThClearableTextBox();
|
||||||
thUserControl1 = new ThUserControl();
|
thUserControl1 = new ThUserControl();
|
||||||
label5 = new Label();
|
label5 = new Label();
|
||||||
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
((ISupportInitialize)pictureBox1).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit();
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -203,21 +210,9 @@ namespace FizzyLauncher
|
|||||||
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
|
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
|
||||||
pictureBox1.TabIndex = 201;
|
pictureBox1.TabIndex = 201;
|
||||||
pictureBox1.TabStop = false;
|
pictureBox1.TabStop = false;
|
||||||
|
pictureBox1.MouseClick += pictureBox1_MouseClick;
|
||||||
pictureBox1.MouseDoubleClick += pictureBox1_MouseDoubleClick;
|
pictureBox1.MouseDoubleClick += pictureBox1_MouseDoubleClick;
|
||||||
//
|
//
|
||||||
// pictureBox2
|
|
||||||
//
|
|
||||||
pictureBox2.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
pictureBox2.BackColor = Color.Transparent;
|
|
||||||
pictureBox2.ErrorImage = null;
|
|
||||||
pictureBox2.InitialImage = null;
|
|
||||||
pictureBox2.Location = new Point(10, 396);
|
|
||||||
pictureBox2.Name = "pictureBox2";
|
|
||||||
pictureBox2.Size = new Size(32, 32);
|
|
||||||
pictureBox2.SizeMode = PictureBoxSizeMode.CenterImage;
|
|
||||||
pictureBox2.TabIndex = 202;
|
|
||||||
pictureBox2.TabStop = false;
|
|
||||||
//
|
|
||||||
// textBox3
|
// textBox3
|
||||||
//
|
//
|
||||||
textBox3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
textBox3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
@ -264,6 +259,7 @@ namespace FizzyLauncher
|
|||||||
dialogFooter1.Button1Text = "&OK";
|
dialogFooter1.Button1Text = "&OK";
|
||||||
dialogFooter1.Dialog = this;
|
dialogFooter1.Dialog = this;
|
||||||
dialogFooter1.Dock = DockStyle.Bottom;
|
dialogFooter1.Dock = DockStyle.Bottom;
|
||||||
|
dialogFooter1.IsBusy = false;
|
||||||
dialogFooter1.Location = new Point(0, 437);
|
dialogFooter1.Location = new Point(0, 437);
|
||||||
dialogFooter1.Name = "dialogFooter1";
|
dialogFooter1.Name = "dialogFooter1";
|
||||||
dialogFooter1.Size = new Size(384, 84);
|
dialogFooter1.Size = new Size(384, 84);
|
||||||
@ -276,7 +272,6 @@ namespace FizzyLauncher
|
|||||||
ClientSize = new Size(384, 521);
|
ClientSize = new Size(384, 521);
|
||||||
Controls.Add(dialogFooter1);
|
Controls.Add(dialogFooter1);
|
||||||
Controls.Add(textBox3);
|
Controls.Add(textBox3);
|
||||||
Controls.Add(pictureBox2);
|
|
||||||
Controls.Add(pictureBox1);
|
Controls.Add(pictureBox1);
|
||||||
Controls.Add(textBox2);
|
Controls.Add(textBox2);
|
||||||
Controls.Add(memoBox1);
|
Controls.Add(memoBox1);
|
||||||
@ -291,8 +286,7 @@ namespace FizzyLauncher
|
|||||||
MinimumSize = new Size(400, 560);
|
MinimumSize = new Size(400, 560);
|
||||||
Name = "EditBookmarkForm";
|
Name = "EditBookmarkForm";
|
||||||
Text = "Edit Bookmark";
|
Text = "Edit Bookmark";
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
((ISupportInitialize)pictureBox1).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit();
|
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -352,7 +346,7 @@ namespace FizzyLauncher
|
|||||||
UIControl.SetEnable(textBox1, !this.IsBusy);
|
UIControl.SetEnable(textBox1, !this.IsBusy);
|
||||||
UIControl.SetEnable(textBox2, !this.IsBusy);
|
UIControl.SetEnable(textBox2, !this.IsBusy);
|
||||||
UIControl.SetEnable(textBox3, !this.IsBusy);
|
UIControl.SetEnable(textBox3, !this.IsBusy);
|
||||||
UIControl.SetValue(pictureBox2, (this.IsBusy ? RyzStudio.Windows.ThemedForms.Resource2.loading_block : null));
|
dialogFooter1.IsBusy = _isBusy;
|
||||||
UIControl.SetEnable(memoBox1, !this.IsBusy);
|
UIControl.SetEnable(memoBox1, !this.IsBusy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,7 +354,30 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
private async void textBox2_OnButtonClick(object sender, EventArgs e)
|
private async void textBox2_OnButtonClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(textBox2.Text))
|
await InvalidateWebPage(textBox2.Text, true, true, true);
|
||||||
|
|
||||||
|
textBox2.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
await InvalidateWebPage(textBox2.Text, false, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Right)
|
||||||
|
{
|
||||||
|
pictureBox1.Image = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task InvalidateWebPage(string url, bool updateTitle, bool updateDescription, bool updateIcon)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(url))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -372,59 +389,48 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
this.IsBusy = true;
|
this.IsBusy = true;
|
||||||
|
|
||||||
if (!textBox2.Text.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) && !textBox2.Text.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
|
if (!url.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) && !url.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
textBox2.Text = "http://" + textBox2.Text;
|
url = "http://" + url;
|
||||||
}
|
}
|
||||||
|
|
||||||
var document = await _webProvider.RetrieveHtmlDocument(textBox2.Text);
|
var document = await _webProvider.RetrieveHtmlDocument(url);
|
||||||
if (document == null)
|
if (document == null)
|
||||||
{
|
{
|
||||||
this.IsBusy = false;
|
this.IsBusy = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textBox1.Text = _webProvider.ParseTitle(document);
|
if (updateTitle)
|
||||||
textBox3.Text = _webProvider.ParseMetaDescription(document);
|
{
|
||||||
pictureBox1.Image = await _webProvider.RetrieveImage(document);
|
textBox1.Text = _webProvider.ParseTitle(document);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateDescription)
|
||||||
|
{
|
||||||
|
textBox3.Text = _webProvider.ParseDescription(document);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateIcon)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pictureBox1.Image = await _webProvider.RetrieveImage(url, document);
|
||||||
|
if (pictureBox1.Image != null)
|
||||||
|
{
|
||||||
|
if (pictureBox1.Image.Width > 16)
|
||||||
|
{
|
||||||
|
pictureBox1.Image = RyzStudio.Drawing.ImageEditor.Resize(pictureBox1.Image, 16, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
pictureBox1.Image = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.IsBusy = false;
|
this.IsBusy = false;
|
||||||
|
|
||||||
textBox2.Focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Button == MouseButtons.Left)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBox2.Text))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.IsBusy)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.IsBusy = true;
|
|
||||||
|
|
||||||
if (!textBox2.Text.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) && !textBox2.Text.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
textBox2.Text = "http://" + textBox2.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
var document = await _webProvider.RetrieveHtmlDocument(textBox2.Text);
|
|
||||||
if (document == null)
|
|
||||||
{
|
|
||||||
this.IsBusy = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pictureBox1.Image = await _webProvider.RetrieveImage(document);
|
|
||||||
|
|
||||||
this.IsBusy = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
72
MainForm.Designer.cs
generated
72
MainForm.Designer.cs
generated
@ -71,6 +71,7 @@ namespace FizzyLauncher
|
|||||||
sortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
sortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
folderContextMenu = new System.Windows.Forms.ContextMenuStrip(components);
|
folderContextMenu = new System.Windows.Forms.ContextMenuStrip(components);
|
||||||
addPageToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
addPageToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
toolStripMenuItem10 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
addFolderToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
addFolderToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
|
toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
openAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
openAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -90,6 +91,7 @@ namespace FizzyLauncher
|
|||||||
moveUpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
moveUpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
moveDownToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
moveDownToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView();
|
treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView();
|
||||||
|
toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
rootContextMenu.SuspendLayout();
|
rootContextMenu.SuspendLayout();
|
||||||
folderContextMenu.SuspendLayout();
|
folderContextMenu.SuspendLayout();
|
||||||
@ -120,7 +122,7 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
// newToolStripMenuItem
|
// newToolStripMenuItem
|
||||||
//
|
//
|
||||||
newToolStripMenuItem.Image = BookmarkManager.AppResource.file;
|
newToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||||
newToolStripMenuItem.Name = "newToolStripMenuItem";
|
newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||||
newToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N;
|
newToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N;
|
||||||
newToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
newToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||||
@ -129,7 +131,7 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
// openToolStripMenuItem
|
// openToolStripMenuItem
|
||||||
//
|
//
|
||||||
openToolStripMenuItem.Image = BookmarkManager.AppResource.folder;
|
openToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||||
openToolStripMenuItem.Name = "openToolStripMenuItem";
|
openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||||
openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O;
|
openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O;
|
||||||
openToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
openToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||||
@ -155,7 +157,7 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
// saveToolStripMenuItem
|
// saveToolStripMenuItem
|
||||||
//
|
//
|
||||||
saveToolStripMenuItem.Image = BookmarkManager.AppResource.save;
|
saveToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||||
saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S;
|
saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S;
|
||||||
saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||||
@ -190,7 +192,7 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
// findToolStripMenuItem
|
// findToolStripMenuItem
|
||||||
//
|
//
|
||||||
findToolStripMenuItem.Image = BookmarkManager.AppResource.search;
|
findToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||||
findToolStripMenuItem.Name = "findToolStripMenuItem";
|
findToolStripMenuItem.Name = "findToolStripMenuItem";
|
||||||
findToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F;
|
findToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F;
|
||||||
findToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
|
findToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
|
||||||
@ -251,7 +253,7 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
// optionsToolStripMenuItem
|
// optionsToolStripMenuItem
|
||||||
//
|
//
|
||||||
optionsToolStripMenuItem.Image = BookmarkManager.AppResource.settings;
|
optionsToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||||
optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||||
optionsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12;
|
optionsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12;
|
||||||
optionsToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
optionsToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
||||||
@ -267,7 +269,7 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
// viewHelpToolStripMenuItem1
|
// viewHelpToolStripMenuItem1
|
||||||
//
|
//
|
||||||
viewHelpToolStripMenuItem1.Image = BookmarkManager.AppResource.help_circle;
|
viewHelpToolStripMenuItem1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||||
viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
|
viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
|
||||||
viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
|
viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
|
||||||
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
|
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
|
||||||
@ -294,85 +296,92 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
// rootContextMenu
|
// rootContextMenu
|
||||||
//
|
//
|
||||||
rootContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addPageToolStripMenuItem, addFolderToolStripMenuItem, toolStripMenuItem2, editToolStripMenuItem, toolStripMenuItem3, sortToolStripMenuItem });
|
rootContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addPageToolStripMenuItem, toolStripMenuItem11, addFolderToolStripMenuItem, toolStripMenuItem2, editToolStripMenuItem, toolStripMenuItem3, sortToolStripMenuItem });
|
||||||
rootContextMenu.Name = "rootContextMenu";
|
rootContextMenu.Name = "rootContextMenu";
|
||||||
rootContextMenu.Size = new System.Drawing.Size(133, 104);
|
rootContextMenu.Size = new System.Drawing.Size(181, 148);
|
||||||
//
|
//
|
||||||
// addPageToolStripMenuItem
|
// addPageToolStripMenuItem
|
||||||
//
|
//
|
||||||
addPageToolStripMenuItem.Name = "addPageToolStripMenuItem";
|
addPageToolStripMenuItem.Name = "addPageToolStripMenuItem";
|
||||||
addPageToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
addPageToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
addPageToolStripMenuItem.Text = "Add &Page";
|
addPageToolStripMenuItem.Text = "Add &Page";
|
||||||
addPageToolStripMenuItem.Click += addPageToolStripMenuItem_Click;
|
addPageToolStripMenuItem.Click += addPageToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// addFolderToolStripMenuItem
|
// addFolderToolStripMenuItem
|
||||||
//
|
//
|
||||||
addFolderToolStripMenuItem.Name = "addFolderToolStripMenuItem";
|
addFolderToolStripMenuItem.Name = "addFolderToolStripMenuItem";
|
||||||
addFolderToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
addFolderToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
addFolderToolStripMenuItem.Text = "Add &Folder";
|
addFolderToolStripMenuItem.Text = "Add &Folder";
|
||||||
addFolderToolStripMenuItem.Click += addFolderToolStripMenuItem_Click;
|
addFolderToolStripMenuItem.Click += addFolderToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItem2
|
// toolStripMenuItem2
|
||||||
//
|
//
|
||||||
toolStripMenuItem2.Name = "toolStripMenuItem2";
|
toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||||
toolStripMenuItem2.Size = new System.Drawing.Size(129, 6);
|
toolStripMenuItem2.Size = new System.Drawing.Size(177, 6);
|
||||||
//
|
//
|
||||||
// editToolStripMenuItem
|
// editToolStripMenuItem
|
||||||
//
|
//
|
||||||
editToolStripMenuItem.Name = "editToolStripMenuItem";
|
editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||||
editToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
editToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
editToolStripMenuItem.Text = "&Edit";
|
editToolStripMenuItem.Text = "&Edit";
|
||||||
editToolStripMenuItem.Click += editToolStripMenuItem_Click;
|
editToolStripMenuItem.Click += editToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItem3
|
// toolStripMenuItem3
|
||||||
//
|
//
|
||||||
toolStripMenuItem3.Name = "toolStripMenuItem3";
|
toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||||
toolStripMenuItem3.Size = new System.Drawing.Size(129, 6);
|
toolStripMenuItem3.Size = new System.Drawing.Size(177, 6);
|
||||||
//
|
//
|
||||||
// sortToolStripMenuItem
|
// sortToolStripMenuItem
|
||||||
//
|
//
|
||||||
sortToolStripMenuItem.Name = "sortToolStripMenuItem";
|
sortToolStripMenuItem.Name = "sortToolStripMenuItem";
|
||||||
sortToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
sortToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
sortToolStripMenuItem.Text = "&Sort";
|
sortToolStripMenuItem.Text = "&Sort";
|
||||||
sortToolStripMenuItem.Click += sortToolStripMenuItem_Click;
|
sortToolStripMenuItem.Click += sortToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// folderContextMenu
|
// folderContextMenu
|
||||||
//
|
//
|
||||||
folderContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addPageToolStripMenuItem1, addFolderToolStripMenuItem1, toolStripMenuItem4, openAllToolStripMenuItem, editToolStripMenuItem1, deleteToolStripMenuItem, toolStripMenuItem5, sortToolStripMenuItem1, toolStripMenuItem6, moveUpToolStripMenuItem, moveDownToolStripMenuItem });
|
folderContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addPageToolStripMenuItem1, toolStripMenuItem10, addFolderToolStripMenuItem1, toolStripMenuItem4, openAllToolStripMenuItem, editToolStripMenuItem1, deleteToolStripMenuItem, toolStripMenuItem5, sortToolStripMenuItem1, toolStripMenuItem6, moveUpToolStripMenuItem, moveDownToolStripMenuItem });
|
||||||
folderContextMenu.Name = "folderContextMenu";
|
folderContextMenu.Name = "folderContextMenu";
|
||||||
folderContextMenu.Size = new System.Drawing.Size(139, 198);
|
folderContextMenu.Size = new System.Drawing.Size(167, 220);
|
||||||
//
|
//
|
||||||
// addPageToolStripMenuItem1
|
// addPageToolStripMenuItem1
|
||||||
//
|
//
|
||||||
addPageToolStripMenuItem1.Name = "addPageToolStripMenuItem1";
|
addPageToolStripMenuItem1.Name = "addPageToolStripMenuItem1";
|
||||||
addPageToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
|
addPageToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
|
||||||
addPageToolStripMenuItem1.Text = "Add &Page";
|
addPageToolStripMenuItem1.Text = "Add &Page";
|
||||||
addPageToolStripMenuItem1.Click += addPageToolStripMenuItem1_Click;
|
addPageToolStripMenuItem1.Click += addPageToolStripMenuItem1_Click;
|
||||||
//
|
//
|
||||||
|
// toolStripMenuItem10
|
||||||
|
//
|
||||||
|
toolStripMenuItem10.Name = "toolStripMenuItem10";
|
||||||
|
toolStripMenuItem10.Size = new System.Drawing.Size(166, 22);
|
||||||
|
toolStripMenuItem10.Text = "Add Page (&Batch)";
|
||||||
|
toolStripMenuItem10.Click += toolStripMenuItem10_Click;
|
||||||
|
//
|
||||||
// addFolderToolStripMenuItem1
|
// addFolderToolStripMenuItem1
|
||||||
//
|
//
|
||||||
addFolderToolStripMenuItem1.Name = "addFolderToolStripMenuItem1";
|
addFolderToolStripMenuItem1.Name = "addFolderToolStripMenuItem1";
|
||||||
addFolderToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
|
addFolderToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
|
||||||
addFolderToolStripMenuItem1.Text = "Add &Folder";
|
addFolderToolStripMenuItem1.Text = "Add &Folder";
|
||||||
addFolderToolStripMenuItem1.Click += addFolderToolStripMenuItem1_Click;
|
addFolderToolStripMenuItem1.Click += addFolderToolStripMenuItem1_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItem4
|
// toolStripMenuItem4
|
||||||
//
|
//
|
||||||
toolStripMenuItem4.Name = "toolStripMenuItem4";
|
toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||||
toolStripMenuItem4.Size = new System.Drawing.Size(135, 6);
|
toolStripMenuItem4.Size = new System.Drawing.Size(163, 6);
|
||||||
//
|
//
|
||||||
// openAllToolStripMenuItem
|
// openAllToolStripMenuItem
|
||||||
//
|
//
|
||||||
openAllToolStripMenuItem.Image = BookmarkManager.AppResource.bookmark;
|
openAllToolStripMenuItem.Image = BookmarkManager.AppResource.bookmark;
|
||||||
openAllToolStripMenuItem.Name = "openAllToolStripMenuItem";
|
openAllToolStripMenuItem.Name = "openAllToolStripMenuItem";
|
||||||
openAllToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
|
openAllToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
|
||||||
openAllToolStripMenuItem.Text = "&Open All";
|
openAllToolStripMenuItem.Text = "&Open All";
|
||||||
openAllToolStripMenuItem.Click += openAllToolStripMenuItem_Click;
|
openAllToolStripMenuItem.Click += openAllToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// editToolStripMenuItem1
|
// editToolStripMenuItem1
|
||||||
//
|
//
|
||||||
editToolStripMenuItem1.Name = "editToolStripMenuItem1";
|
editToolStripMenuItem1.Name = "editToolStripMenuItem1";
|
||||||
editToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
|
editToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
|
||||||
editToolStripMenuItem1.Text = "&Edit";
|
editToolStripMenuItem1.Text = "&Edit";
|
||||||
editToolStripMenuItem1.Click += editToolStripMenuItem1_Click;
|
editToolStripMenuItem1.Click += editToolStripMenuItem1_Click;
|
||||||
//
|
//
|
||||||
@ -380,32 +389,32 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
deleteToolStripMenuItem.Image = BookmarkManager.AppResource.trash;
|
deleteToolStripMenuItem.Image = BookmarkManager.AppResource.trash;
|
||||||
deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||||
deleteToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
|
deleteToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
|
||||||
deleteToolStripMenuItem.Text = "&Delete";
|
deleteToolStripMenuItem.Text = "&Delete";
|
||||||
deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click;
|
deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItem5
|
// toolStripMenuItem5
|
||||||
//
|
//
|
||||||
toolStripMenuItem5.Name = "toolStripMenuItem5";
|
toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||||
toolStripMenuItem5.Size = new System.Drawing.Size(135, 6);
|
toolStripMenuItem5.Size = new System.Drawing.Size(163, 6);
|
||||||
//
|
//
|
||||||
// sortToolStripMenuItem1
|
// sortToolStripMenuItem1
|
||||||
//
|
//
|
||||||
sortToolStripMenuItem1.Name = "sortToolStripMenuItem1";
|
sortToolStripMenuItem1.Name = "sortToolStripMenuItem1";
|
||||||
sortToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
|
sortToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
|
||||||
sortToolStripMenuItem1.Text = "&Sort";
|
sortToolStripMenuItem1.Text = "&Sort";
|
||||||
sortToolStripMenuItem1.Click += sortToolStripMenuItem1_Click;
|
sortToolStripMenuItem1.Click += sortToolStripMenuItem1_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItem6
|
// toolStripMenuItem6
|
||||||
//
|
//
|
||||||
toolStripMenuItem6.Name = "toolStripMenuItem6";
|
toolStripMenuItem6.Name = "toolStripMenuItem6";
|
||||||
toolStripMenuItem6.Size = new System.Drawing.Size(135, 6);
|
toolStripMenuItem6.Size = new System.Drawing.Size(163, 6);
|
||||||
//
|
//
|
||||||
// moveUpToolStripMenuItem
|
// moveUpToolStripMenuItem
|
||||||
//
|
//
|
||||||
moveUpToolStripMenuItem.Image = BookmarkManager.AppResource.arrow_up_circle;
|
moveUpToolStripMenuItem.Image = BookmarkManager.AppResource.arrow_up_circle;
|
||||||
moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem";
|
moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem";
|
||||||
moveUpToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
|
moveUpToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
|
||||||
moveUpToolStripMenuItem.Text = "Move &Up";
|
moveUpToolStripMenuItem.Text = "Move &Up";
|
||||||
moveUpToolStripMenuItem.Click += moveUpToolStripMenuItem_Click;
|
moveUpToolStripMenuItem.Click += moveUpToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
@ -413,7 +422,7 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
moveDownToolStripMenuItem.Image = BookmarkManager.AppResource.arrow_down_circle;
|
moveDownToolStripMenuItem.Image = BookmarkManager.AppResource.arrow_down_circle;
|
||||||
moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem";
|
moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem";
|
||||||
moveDownToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
|
moveDownToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
|
||||||
moveDownToolStripMenuItem.Text = "Move &Down";
|
moveDownToolStripMenuItem.Text = "Move &Down";
|
||||||
moveDownToolStripMenuItem.Click += moveDownToolStripMenuItem_Click;
|
moveDownToolStripMenuItem.Click += moveDownToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
@ -482,6 +491,13 @@ namespace FizzyLauncher
|
|||||||
treeView1.Size = new System.Drawing.Size(300, 556);
|
treeView1.Size = new System.Drawing.Size(300, 556);
|
||||||
treeView1.TabIndex = 5;
|
treeView1.TabIndex = 5;
|
||||||
//
|
//
|
||||||
|
// toolStripMenuItem11
|
||||||
|
//
|
||||||
|
toolStripMenuItem11.Name = "toolStripMenuItem11";
|
||||||
|
toolStripMenuItem11.Size = new System.Drawing.Size(180, 22);
|
||||||
|
toolStripMenuItem11.Text = "Add Page (&Batch)";
|
||||||
|
toolStripMenuItem11.Click += toolStripMenuItem11_Click;
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
@ -563,6 +579,8 @@ namespace FizzyLauncher
|
|||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||||
private RyzStudio.Windows.Forms.BookmarkTreeView treeView1;
|
private RyzStudio.Windows.Forms.BookmarkTreeView treeView1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem10;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
94
MainForm.cs
94
MainForm.cs
@ -15,6 +15,7 @@ using FizzyLauncher.Models;
|
|||||||
using RyzStudio;
|
using RyzStudio;
|
||||||
using RyzStudio.Windows.Forms;
|
using RyzStudio.Windows.Forms;
|
||||||
using RyzStudio.Windows.ThemedForms;
|
using RyzStudio.Windows.ThemedForms;
|
||||||
|
using static RyzStudio.Windows.Forms.BookmarkTreeView;
|
||||||
|
|
||||||
namespace FizzyLauncher
|
namespace FizzyLauncher
|
||||||
{
|
{
|
||||||
@ -31,6 +32,14 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
this.Text = Application.ProductName;
|
this.Text = Application.ProductName;
|
||||||
|
|
||||||
|
newToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("a", Color.Black, 2);
|
||||||
|
openToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("b", Color.Black, 2);
|
||||||
|
saveToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("c", Color.Black, 2);
|
||||||
|
findToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("d", Color.Black, 2);
|
||||||
|
optionsToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("i", Color.Black, 2);
|
||||||
|
viewHelpToolStripMenuItem1.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("j", Color.Black, 2);
|
||||||
|
//aboutToolStripMenuItem1.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("k", Color.Black, 2);
|
||||||
|
|
||||||
_fileSessionManager = new FileSessionManager();
|
_fileSessionManager = new FileSessionManager();
|
||||||
_fileSessionManager.OpenFileDialog = openFileDialog1;
|
_fileSessionManager.OpenFileDialog = openFileDialog1;
|
||||||
_fileSessionManager.SaveFileDialog = saveFileDialog1;
|
_fileSessionManager.SaveFileDialog = saveFileDialog1;
|
||||||
@ -385,6 +394,36 @@ namespace FizzyLauncher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add page (batch)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void toolStripMenuItem11_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodeType = treeView1.GetNodeType();
|
||||||
|
if ((nodeType != NodeType.Root) && (nodeType != NodeType.Folder))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodePath = treeView1.GetNodePath();
|
||||||
|
|
||||||
|
var form = new AddBatchPageForm(nodePath);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
foreach (var item in form.Result)
|
||||||
|
{
|
||||||
|
treeView1.AddNode(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add folder
|
/// Add folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -448,6 +487,16 @@ namespace FizzyLauncher
|
|||||||
addPageToolStripMenuItem_Click(sender, e);
|
addPageToolStripMenuItem_Click(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add page (batch)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void toolStripMenuItem10_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
toolStripMenuItem11_Click(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add folder
|
/// Add folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -750,6 +799,15 @@ namespace FizzyLauncher
|
|||||||
this.CurrentSession.Height = this.Height;
|
this.CurrentSession.Height = this.Height;
|
||||||
|
|
||||||
var nodeList = treeView1.ToNodeList<BookmarkModel>() ?? new List<KeyValuePair<TreeNode, BookmarkModel>>();
|
var nodeList = treeView1.ToNodeList<BookmarkModel>() ?? new List<KeyValuePair<TreeNode, BookmarkModel>>();
|
||||||
|
foreach (var node in nodeList)
|
||||||
|
{
|
||||||
|
node.Value.Path = treeView1.GetNodePath(node.Key);
|
||||||
|
|
||||||
|
if (node.Value.Path.Contains('\n'))
|
||||||
|
{
|
||||||
|
node.Value.Path = node.Value.Path.Substring(0, node.Value.Path.LastIndexOf('\n'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.CurrentSession.Items = nodeList.Select(x => x.Value).ToList();
|
this.CurrentSession.Items = nodeList.Select(x => x.Value).ToList();
|
||||||
|
|
||||||
@ -767,7 +825,7 @@ namespace FizzyLauncher
|
|||||||
if (result.IsSuccess)
|
if (result.IsSuccess)
|
||||||
{
|
{
|
||||||
// Add icons to save file
|
// Add icons to save file
|
||||||
var result2 = AddImagesToZipFile(filename, this.CurrentSession.Items);
|
var result2 = AddImagesToZipFile(filename, nodeList);
|
||||||
if (!result2.IsSuccess)
|
if (!result2.IsSuccess)
|
||||||
{
|
{
|
||||||
if (showNotices)
|
if (showNotices)
|
||||||
@ -961,7 +1019,7 @@ namespace FizzyLauncher
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private GenericResult AddImagesToZipFile(string zipFilename, List<BookmarkModel> items)
|
private GenericResult AddImagesToZipFile(string zipFilename, List<KeyValuePair<TreeNode, BookmarkModel>> items)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(zipFilename))
|
if (string.IsNullOrWhiteSpace(zipFilename))
|
||||||
{
|
{
|
||||||
@ -989,14 +1047,38 @@ namespace FizzyLauncher
|
|||||||
{
|
{
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
var key = "icon\\" + item.Id.ToString() + ".png";
|
var key = "icon\\" + item.Value.Id.ToString() + ".png";
|
||||||
|
|
||||||
var zipEntry = archive.GetEntry(key);
|
var zipEntry = archive.GetEntry(key);
|
||||||
if (zipEntry != null)
|
if (zipEntry != null)
|
||||||
{
|
{
|
||||||
zipEntry.Delete();
|
zipEntry.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Icon == null)
|
if (item.Key.ImageIndex == (int)NodeIcon.Default)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!treeView1.ImageList.Images.ContainsKey(item.Value.Id.ToString()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var icon = treeView1.ImageList.Images[item.Value.Id.ToString()];
|
||||||
|
if (icon == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (icon.Width <= 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1007,7 +1089,7 @@ namespace FizzyLauncher
|
|||||||
{
|
{
|
||||||
using (Stream entryStream = zipEntry.Open())
|
using (Stream entryStream = zipEntry.Open())
|
||||||
{
|
{
|
||||||
using (Image image = item.Icon)
|
using (Image image = icon)
|
||||||
{
|
{
|
||||||
image.Save(entryStream, ImageFormat.Png);
|
image.Save(entryStream, ImageFormat.Png);
|
||||||
}
|
}
|
||||||
@ -1015,6 +1097,8 @@ namespace FizzyLauncher
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
zipEntry.Delete();
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using HtmlAgilityPack;
|
using HtmlAgilityPack;
|
||||||
@ -148,7 +150,7 @@ namespace BookmarkManager.Services
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Image> RetrieveImage(HtmlAgilityPack.HtmlDocument document)
|
public async Task<Image> RetrieveImage(string url, HtmlAgilityPack.HtmlDocument document)
|
||||||
{
|
{
|
||||||
var iconUrl = this.ParseFavicon(document);
|
var iconUrl = this.ParseFavicon(document);
|
||||||
if (string.IsNullOrWhiteSpace(iconUrl))
|
if (string.IsNullOrWhiteSpace(iconUrl))
|
||||||
@ -156,6 +158,18 @@ namespace BookmarkManager.Services
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var baseUri = new Uri(url);
|
||||||
|
var absoluteUri = new Uri(baseUri, iconUrl);
|
||||||
|
|
||||||
|
iconUrl = absoluteUri.AbsoluteUri;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return await this.RetrieveImage(iconUrl);
|
return await this.RetrieveImage(iconUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,132 +177,102 @@ namespace BookmarkManager.Services
|
|||||||
{
|
{
|
||||||
string result = null;
|
string result = null;
|
||||||
|
|
||||||
result = ParseTagValue(document, "//title", string.Empty)?.Trim();
|
// Find basic title
|
||||||
|
result = FindNodeValue(document, "//title", string.Empty)?.Trim();
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
if (!string.IsNullOrWhiteSpace(result))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@property='og:title']", "content", string.Empty)?.Trim();
|
// Find title from extended meta
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
var patternList = new List<string>()
|
||||||
{
|
{
|
||||||
return result;
|
"//meta[@property='og:title']",
|
||||||
}
|
"//meta[@property='og:site_name']",
|
||||||
|
"//meta[@name='twitter:title']",
|
||||||
|
"//meta[@itemprop='name']"
|
||||||
|
};
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@name='twitter:title']", "content", string.Empty)?.Trim();
|
foreach (var item in patternList)
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
{
|
||||||
return result;
|
result = FindNodeAttrValue(document, item, "content", string.Empty)?.Trim();
|
||||||
}
|
if (string.IsNullOrWhiteSpace(result))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@property='og:site_name']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@itemprop='name']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ParseMetaDescription(HtmlAgilityPack.HtmlDocument document)
|
public string ParseDescription(HtmlAgilityPack.HtmlDocument document)
|
||||||
{
|
{
|
||||||
string result = null;
|
var patternList = new List<string>()
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@name='description']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
{
|
||||||
|
"//meta[@name='description']",
|
||||||
|
"//meta[@property='og:description']",
|
||||||
|
"//meta[@name='twitter:description']",
|
||||||
|
"//meta[@itemprop='description']",
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var item in patternList)
|
||||||
|
{
|
||||||
|
var result = FindNodeAttrValue(document, item, "content", string.Empty)?.Trim();
|
||||||
|
if (string.IsNullOrWhiteSpace(result))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@property='og:description']", "content", string.Empty)?.Trim();
|
return string.Empty;
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@name='twitter:description']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@property='og:description']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[@itemprop='description']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ParseFavicon(HtmlAgilityPack.HtmlDocument document)
|
public string ParseFavicon(HtmlAgilityPack.HtmlDocument document)
|
||||||
{
|
{
|
||||||
string result = null;
|
string result = null;
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'shortcut icon']", "href", string.Empty)?.Trim();
|
// Find link-rel that contains word
|
||||||
|
result = FindNodeAttrValue_ContainsWord(document, "link", "rel", "href", "icon");
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
if (!string.IsNullOrWhiteSpace(result))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'icon']", "href", string.Empty)?.Trim();
|
// Find link-rel contains apple-icon
|
||||||
|
var matchPatterns = new List<string>() { "apple-touch-icon", "apple-touch-icon-precomposed" };
|
||||||
|
result = FindNodeAttrValue_Equals(document, "link", "rel", "href", matchPatterns);
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
if (!string.IsNullOrWhiteSpace(result))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'apple-touch-icon']", "href", string.Empty)?.Trim();
|
// Find favicon from extended meta
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
var patternList = new List<string>()
|
||||||
{
|
{
|
||||||
|
"//meta[@property='og:image']",
|
||||||
|
"//meta[@name='twitter:image']",
|
||||||
|
"//meta[@itemprop='image']"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var item in patternList)
|
||||||
|
{
|
||||||
|
result = FindNodeAttrValue(document, item, "content", string.Empty)?.Trim();
|
||||||
|
if (string.IsNullOrWhiteSpace(result))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'apple-touch-icon-precomposed']", "href", string.Empty)?.Trim();
|
return string.Empty;
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[translate(@property, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'og:image']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'twitter:image']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[translate(@property, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'og:image']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ParseTagValue_Attr(document, "//meta[translate(@itemprop, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'image']", "content", string.Empty)?.Trim();
|
|
||||||
if (!string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "/favicon.ico";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ParseTagValue(HtmlAgilityPack.HtmlDocument document, string xPath, string defaultValue = "")
|
private string FindNodeValue(HtmlAgilityPack.HtmlDocument document, string xPath, string defaultValue = "")
|
||||||
{
|
{
|
||||||
var hnc = document.DocumentNode.SelectNodes(xPath);
|
var hnc = document.DocumentNode.SelectNodes(xPath);
|
||||||
if (hnc == null)
|
if (hnc == null)
|
||||||
@ -320,7 +304,7 @@ namespace BookmarkManager.Services
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ParseTagValue_Attr(HtmlAgilityPack.HtmlDocument document, string xPath, string attr, string defaultValue = "")
|
private string FindNodeAttrValue(HtmlAgilityPack.HtmlDocument document, string xPath, string attr, string defaultValue = "")
|
||||||
{
|
{
|
||||||
var hnc = document.DocumentNode.SelectNodes(xPath);
|
var hnc = document.DocumentNode.SelectNodes(xPath);
|
||||||
if (hnc == null)
|
if (hnc == null)
|
||||||
@ -351,5 +335,93 @@ namespace BookmarkManager.Services
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<HtmlNode> FindNode(HtmlAgilityPack.HtmlDocument document, string nodeName, string attrName)
|
||||||
|
{
|
||||||
|
var xPath = (string.IsNullOrWhiteSpace(attrName) ? $"//{nodeName}" : $"//{nodeName}[@{attrName}]");
|
||||||
|
var hnc = document.DocumentNode.SelectNodes(xPath);
|
||||||
|
if (hnc == null)
|
||||||
|
{
|
||||||
|
return new List<HtmlNode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hnc.Count <= 0)
|
||||||
|
{
|
||||||
|
return new List<HtmlNode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return hnc.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string FindNodeAttrValue_ContainsWord(HtmlAgilityPack.HtmlDocument document, string nodeName, string attrName, string returnAttrName, string matchEqualList, string defaultValue = "")
|
||||||
|
{
|
||||||
|
var linkNodes = FindNode(document, nodeName, attrName);
|
||||||
|
foreach (var item in linkNodes)
|
||||||
|
{
|
||||||
|
var relValue = item.Attributes[attrName].Value?.Trim() ?? string.Empty;
|
||||||
|
if (!ContainsWord(relValue, matchEqualList))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hrefValue = item.Attributes[returnAttrName].Value?.Trim() ?? string.Empty;
|
||||||
|
if (string.IsNullOrWhiteSpace(hrefValue))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return System.Web.HttpUtility.HtmlDecode(hrefValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string FindNodeAttrValue_Equals(HtmlAgilityPack.HtmlDocument document, string nodeName, string attrName, string returnAttrName, List<string> matchValueList, string defaultValue = "")
|
||||||
|
{
|
||||||
|
var linkNodes = FindNode(document, nodeName, attrName);
|
||||||
|
foreach (var item in linkNodes)
|
||||||
|
{
|
||||||
|
var relValue = item.Attributes[attrName].Value?.Trim() ?? string.Empty;
|
||||||
|
if (!matchValueList.Contains(relValue?.ToLower() ?? string.Empty))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hrefValue = item.Attributes[returnAttrName].Value?.Trim() ?? string.Empty;
|
||||||
|
if (string.IsNullOrWhiteSpace(hrefValue))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return System.Web.HttpUtility.HtmlDecode(hrefValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ContainsWord(string haystack, string needle)
|
||||||
|
{
|
||||||
|
haystack = haystack?.Trim() ?? string.Empty;
|
||||||
|
|
||||||
|
if (!haystack.Contains(" "))
|
||||||
|
{
|
||||||
|
return haystack.Equals(needle, StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in haystack.Split(" "))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(item))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.Equals(needle, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,6 @@ namespace FizzyLauncher
|
|||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
|
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
private PictureBox pictureBox2;
|
|
||||||
private ThYesNoPickerBox pickerBox1;
|
private ThYesNoPickerBox pickerBox1;
|
||||||
private ThButton button2;
|
private ThButton button2;
|
||||||
private RyzStudio.Windows.ThemedForms.ThProgressBar progressBar1;
|
private RyzStudio.Windows.ThemedForms.ThProgressBar progressBar1;
|
||||||
@ -51,7 +50,6 @@ namespace FizzyLauncher
|
|||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
tHorizontalSeparator2 = new THorizontalSeparator();
|
tHorizontalSeparator2 = new THorizontalSeparator();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
pictureBox2 = new PictureBox();
|
|
||||||
pickerBox1 = new ThYesNoPickerBox();
|
pickerBox1 = new ThYesNoPickerBox();
|
||||||
button2 = new ThButton();
|
button2 = new ThButton();
|
||||||
progressBar1 = new ThProgressBar();
|
progressBar1 = new ThProgressBar();
|
||||||
@ -60,7 +58,6 @@ namespace FizzyLauncher
|
|||||||
button3 = new ThButton();
|
button3 = new ThButton();
|
||||||
progressBar2 = new ThProgressBar();
|
progressBar2 = new ThProgressBar();
|
||||||
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
||||||
((ISupportInitialize)pictureBox2).BeginInit();
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -106,19 +103,6 @@ namespace FizzyLauncher
|
|||||||
label2.Text = "Retrieve supported icons from bookmarks.";
|
label2.Text = "Retrieve supported icons from bookmarks.";
|
||||||
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
//
|
//
|
||||||
// pictureBox2
|
|
||||||
//
|
|
||||||
pictureBox2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
pictureBox2.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
pictureBox2.ErrorImage = null;
|
|
||||||
pictureBox2.InitialImage = null;
|
|
||||||
pictureBox2.Location = new System.Drawing.Point(402, 294);
|
|
||||||
pictureBox2.Name = "pictureBox2";
|
|
||||||
pictureBox2.Size = new System.Drawing.Size(32, 32);
|
|
||||||
pictureBox2.SizeMode = PictureBoxSizeMode.CenterImage;
|
|
||||||
pictureBox2.TabIndex = 202;
|
|
||||||
pictureBox2.TabStop = false;
|
|
||||||
//
|
|
||||||
// pickerBox1
|
// pickerBox1
|
||||||
//
|
//
|
||||||
pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
@ -237,8 +221,9 @@ namespace FizzyLauncher
|
|||||||
//
|
//
|
||||||
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
|
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
|
||||||
dialogFooter1.Button1Text = "&Close";
|
dialogFooter1.Button1Text = "&Close";
|
||||||
dialogFooter1.Dialog = null;
|
dialogFooter1.Dialog = this;
|
||||||
dialogFooter1.Dock = DockStyle.Bottom;
|
dialogFooter1.Dock = DockStyle.Bottom;
|
||||||
|
dialogFooter1.IsBusy = false;
|
||||||
dialogFooter1.Location = new System.Drawing.Point(0, 437);
|
dialogFooter1.Location = new System.Drawing.Point(0, 437);
|
||||||
dialogFooter1.Name = "dialogFooter1";
|
dialogFooter1.Name = "dialogFooter1";
|
||||||
dialogFooter1.Size = new System.Drawing.Size(444, 84);
|
dialogFooter1.Size = new System.Drawing.Size(444, 84);
|
||||||
@ -257,7 +242,6 @@ namespace FizzyLauncher
|
|||||||
Controls.Add(progressBar1);
|
Controls.Add(progressBar1);
|
||||||
Controls.Add(button2);
|
Controls.Add(button2);
|
||||||
Controls.Add(pickerBox1);
|
Controls.Add(pickerBox1);
|
||||||
Controls.Add(pictureBox2);
|
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
Controls.Add(tHorizontalSeparator2);
|
Controls.Add(tHorizontalSeparator2);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
@ -265,7 +249,6 @@ namespace FizzyLauncher
|
|||||||
MinimumSize = new System.Drawing.Size(460, 560);
|
MinimumSize = new System.Drawing.Size(460, 560);
|
||||||
Name = "UpdateIconsForm";
|
Name = "UpdateIconsForm";
|
||||||
Text = "Update Icons";
|
Text = "Update Icons";
|
||||||
((ISupportInitialize)pictureBox2).EndInit();
|
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -319,7 +302,8 @@ namespace FizzyLauncher
|
|||||||
{
|
{
|
||||||
button3.LabelText = (this.IsBusy ? "&Stop" : "Clear &All");
|
button3.LabelText = (this.IsBusy ? "&Stop" : "Clear &All");
|
||||||
});
|
});
|
||||||
UIControl.SetValue(pictureBox2, (this.IsBusy ? RyzStudio.Windows.ThemedForms.Resource2.loading_block : null));
|
|
||||||
|
dialogFooter1.IsBusy = _isBusy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,14 +356,25 @@ namespace FizzyLauncher
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var image = await _webProvider.RetrieveImage(document);
|
|
||||||
if (image == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newModel = item.Value;
|
var newModel = item.Value;
|
||||||
newModel.Icon = image;
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var image = await _webProvider.RetrieveImage(item.Value.Address, document);
|
||||||
|
if (image != null)
|
||||||
|
{
|
||||||
|
if (image.Width > 16)
|
||||||
|
{
|
||||||
|
image = RyzStudio.Drawing.ImageEditor.Resize(image, 16, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newModel.Icon = image;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
newModel.Icon = null;
|
||||||
|
}
|
||||||
|
|
||||||
_treeView.UpdateNode(item.Key, newModel);
|
_treeView.UpdateNode(item.Key, newModel);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System.ComponentModel;
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Reflection;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using bzit.bomg.Models;
|
using bzit.bomg.Models;
|
||||||
using FizzyLauncher;
|
using FizzyLauncher;
|
||||||
@ -125,6 +127,8 @@ namespace RyzStudio.Windows.Forms
|
|||||||
if (MessageBox.Show("Delete?", "Delete?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Delete?", "Delete?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
this.DeleteNode();
|
this.DeleteNode();
|
||||||
|
|
||||||
|
this.HasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +247,8 @@ namespace RyzStudio.Windows.Forms
|
|||||||
this.EditNode(treeNode);
|
this.EditNode(treeNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.HasChanged = true;
|
||||||
|
|
||||||
return treeNode;
|
return treeNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +278,8 @@ namespace RyzStudio.Windows.Forms
|
|||||||
|
|
||||||
this.SelectedNode = newNode;
|
this.SelectedNode = newNode;
|
||||||
|
|
||||||
|
this.HasChanged = true;
|
||||||
|
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,30 +289,12 @@ namespace RyzStudio.Windows.Forms
|
|||||||
|
|
||||||
public TreeNode AddNode(BookmarkModel model)
|
public TreeNode AddNode(BookmarkModel model)
|
||||||
{
|
{
|
||||||
var parentNode = this.CreateNodePath(model.Path, (int)NodeIcon.Folder1, (int)NodeIcon.Folder2);
|
var parentNode = this.CreateNodePath(model?.Path?.Trim() ?? string.Empty, (int)NodeIcon.Folder1, (int)NodeIcon.Folder2);
|
||||||
int iconIndex = (int)NodeIcon.Default;
|
|
||||||
|
|
||||||
// Add custom favicon
|
// Add custom favicon
|
||||||
if (model.Icon != null)
|
var n = AddImage(model.Id.ToString(), model.Icon);
|
||||||
{
|
|
||||||
var iconKey = model.Id.ToString();
|
|
||||||
if (!string.IsNullOrWhiteSpace(iconKey))
|
|
||||||
{
|
|
||||||
if (this.ImageList.Images.ContainsKey(iconKey))
|
|
||||||
{
|
|
||||||
this.ImageList.Images.RemoveByKey(iconKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
UIControl.Invoke(this, (x) =>
|
TreeNode newNode = new TreeNode(model?.Title?.Trim() ?? string.Empty, n, n);
|
||||||
{
|
|
||||||
this.ImageList.Images.Add(iconKey, model.Icon);
|
|
||||||
});
|
|
||||||
|
|
||||||
iconIndex = this.ImageList.Images.IndexOfKey(iconKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeNode newNode = new TreeNode(model.Title, iconIndex, iconIndex);
|
|
||||||
newNode.Tag = model;
|
newNode.Tag = model;
|
||||||
newNode.ToolTipText = model.ToString();
|
newNode.ToolTipText = model.ToString();
|
||||||
|
|
||||||
@ -404,10 +394,6 @@ namespace RyzStudio.Windows.Forms
|
|||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
node = this.SelectedNode;
|
node = this.SelectedNode;
|
||||||
}
|
|
||||||
|
|
||||||
if (node == null)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,36 +402,18 @@ namespace RyzStudio.Windows.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var iconIndex = (int)NodeIcon.Default;
|
if (model.Id == Guid.Empty)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Update custom favicon
|
// Update custom favicon
|
||||||
var iconKey = model.Id.ToString();
|
var n = AddImage(model.Id.ToString(), model.Icon);
|
||||||
if (!string.IsNullOrWhiteSpace(iconKey))
|
|
||||||
{
|
|
||||||
UIControl.Invoke(this, (x) =>
|
|
||||||
{
|
|
||||||
if (this.ImageList.Images.ContainsKey(iconKey))
|
|
||||||
{
|
|
||||||
this.ImageList.Images.RemoveByKey(iconKey);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (model.Icon != null)
|
|
||||||
{
|
|
||||||
UIControl.Invoke(this, (x) =>
|
|
||||||
{
|
|
||||||
this.ImageList.Images.Add(iconKey, model.Icon);
|
|
||||||
});
|
|
||||||
|
|
||||||
iconIndex = this.ImageList.Images.IndexOfKey(iconKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UIControl.Invoke(this, (x) =>
|
UIControl.Invoke(this, (x) =>
|
||||||
{
|
{
|
||||||
node.Text = model.Title;
|
node.Text = model.Title;
|
||||||
node.ImageIndex = iconIndex;
|
node.ImageIndex = node.SelectedImageIndex = n;
|
||||||
node.SelectedImageIndex = iconIndex;
|
|
||||||
node.Tag = model;
|
node.Tag = model;
|
||||||
node.ToolTipText = model.ToString();
|
node.ToolTipText = model.ToString();
|
||||||
});
|
});
|
||||||
@ -462,9 +430,43 @@ namespace RyzStudio.Windows.Forms
|
|||||||
this.ImageList.Images.Add(Resources.hexagon);
|
this.ImageList.Images.Add(Resources.hexagon);
|
||||||
this.ImageList.Images.Add(Resources.folder);
|
this.ImageList.Images.Add(Resources.folder);
|
||||||
this.ImageList.Images.Add(Resources.folder_explore);
|
this.ImageList.Images.Add(Resources.folder_explore);
|
||||||
this.ImageList.Images.Add(Resources.file_text);
|
this.ImageList.Images.Add("default", Resources.file_text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int AddImage(string key, Image image)
|
||||||
|
{
|
||||||
|
if (image == null)
|
||||||
|
{
|
||||||
|
return (int)NodeIcon.Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (image.Width <= 0)
|
||||||
|
{
|
||||||
|
return (int)NodeIcon.Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return (int)NodeIcon.Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIControl.Invoke(this, (x) =>
|
||||||
|
{
|
||||||
|
if (this.ImageList.Images.ContainsKey(key))
|
||||||
|
{
|
||||||
|
var n = this.ImageList.Images.IndexOfKey(key);
|
||||||
|
|
||||||
|
this.ImageList.Images.SetKeyName(n, ".deleted");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ImageList.Images.Add(key, image);
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.ImageList.Images.IndexOfKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
#define MyAppName "BukkuBuddy Bookmark Manager"
|
#define MyAppName "BukkuBuddy Bookmark Manager"
|
||||||
#define MyAppVersion "0.6.0.716"
|
#define MyAppVersion "0.6.2.092"
|
||||||
#define MyAppPublisher "Hi, I'm Ray"
|
#define MyAppPublisher "Hi, I'm Ray"
|
||||||
#define MyAppURL "https://www.hiimray.co.uk/software-bookmark-manager"
|
#define MyAppURL "https://www.hiimray.co.uk/software-bookmark-manager"
|
||||||
#define MyAppExeName "bukkubuddy.exe"
|
#define MyAppExeName "bukkubuddy.exe"
|
||||||
|
Loading…
Reference in New Issue
Block a user