Added: update icon + progress bar

This commit is contained in:
Ray 2021-09-30 22:26:17 +01:00
parent 90473e092d
commit f56072eebc
18 changed files with 1125 additions and 55 deletions

View File

@ -389,41 +389,12 @@ namespace FizzyLauncher
}
else
{
ThreadControl.SetValue(pictureBox1, RetrieveImage(rs.IconURL));
ThreadControl.SetValue(pictureBox1, webParser.RetrieveImage(rs.IconURL));
}
IsBusy = false;
});
}
private Bitmap RetrieveImage(string url)
{
if (string.IsNullOrWhiteSpace(url))
{
return null;
}
if (webClient == null) webClient = new WebClient();
webClient.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
try
{
byte[] byteData = webClient.DownloadData(url);
if (!RyzStudio.IO.FileType.IsImage(byteData))
{
throw new Exception("Not a supported image");
}
Image img = Image.FromStream(new MemoryStream(byteData));
return new Bitmap(img, 16, 16);
}
catch (Exception)
{
return null;
}
}
}
}

View File

@ -12,9 +12,9 @@
<Company>Hi, I'm Ray</Company>
<Product>Bookmark Manager</Product>
<Copyright>Ray Lam</Copyright>
<AssemblyVersion>0.4.0.061</AssemblyVersion>
<FileVersion>0.4.0.061</FileVersion>
<Version>0.4.0.061</Version>
<AssemblyVersion>0.4.0.129</AssemblyVersion>
<FileVersion>0.4.0.129</FileVersion>
<Version>0.4.0.129</Version>
<PackageId>bookmarkmanager</PackageId>
</PropertyGroup>
@ -107,6 +107,12 @@
<AutoGen>True</AutoGen>
<DependentUpon>AppResource.resx</DependentUpon>
</Compile>
<Compile Update="RyzStudio\Windows\ThemedForms\TProgressBar.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="UpdateIconsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FindForm.cs">
<SubType>Form</SubType>
</Compile>

40
MainForm.Designer.cs generated
View File

@ -84,6 +84,8 @@
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator();
this.moveUpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.moveDownToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.menuStrip1.SuspendLayout();
this.rootContextMenu.SuspendLayout();
this.folderContextMenu.SuspendLayout();
@ -130,7 +132,7 @@
this.newToolStripMenuItem.Image = global::BookmarkManager.UIResource.file2;
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.newToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.newToolStripMenuItem.Text = "&New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
//
@ -139,52 +141,52 @@
this.openToolStripMenuItem.Image = global::BookmarkManager.UIResource.folder2;
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.openToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.openToolStripMenuItem.Text = "&Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// toolStripMenuItem13
//
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
this.toolStripMenuItem13.Size = new System.Drawing.Size(143, 6);
this.toolStripMenuItem13.Size = new System.Drawing.Size(177, 6);
//
// closeToolStripMenuItem
//
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
this.closeToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.closeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.closeToolStripMenuItem.Text = "&Close";
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
//
// toolStripMenuItem14
//
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(143, 6);
this.toolStripMenuItem14.Size = new System.Drawing.Size(177, 6);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Image = global::BookmarkManager.UIResource.disk2;
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "&Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveAsToolStripMenuItem.Text = "Save &As...";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
//
// toolStripMenuItem15
//
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
this.toolStripMenuItem15.Size = new System.Drawing.Size(143, 6);
this.toolStripMenuItem15.Size = new System.Drawing.Size(177, 6);
//
// exitToolStripMenuItem2
//
this.exitToolStripMenuItem2.Name = "exitToolStripMenuItem2";
this.exitToolStripMenuItem2.Size = new System.Drawing.Size(146, 22);
this.exitToolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.exitToolStripMenuItem2.Text = "E&xit";
this.exitToolStripMenuItem2.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@ -201,7 +203,7 @@
this.findToolStripMenuItem.Image = global::BookmarkManager.UIResource.search2;
this.findToolStripMenuItem.Name = "findToolStripMenuItem";
this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
this.findToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.findToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.findToolStripMenuItem.Text = "&Find";
this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click);
//
@ -245,6 +247,8 @@
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem9,
this.toolStripSeparator2,
this.optionsToolStripMenuItem});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
@ -255,7 +259,7 @@
this.optionsToolStripMenuItem.Image = global::BookmarkManager.UIResource.cog2;
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12)));
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.optionsToolStripMenuItem.Text = "&Options";
this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click);
//
@ -510,6 +514,18 @@
this.moveDownToolStripMenuItem1.Text = "Move &Down";
this.moveDownToolStripMenuItem1.Click += new System.EventHandler(this.moveDownToolStripMenuItem1_Click);
//
// toolStripMenuItem9
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem9.Text = "Update &Icons";
this.toolStripMenuItem9.Click += new System.EventHandler(this.toolStripMenuItem9_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -591,6 +607,8 @@
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem8;
private System.Windows.Forms.ToolStripMenuItem moveUpToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem moveDownToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
}
}

View File

@ -27,6 +27,7 @@ namespace FizzyLauncher
protected IconDatabase iconDatabase = null;
protected UpdateIconsForm updateIconsForm = null;
protected OptionsForm optionsForm = null;
protected FindForm findForm = null;
@ -163,6 +164,8 @@ namespace FizzyLauncher
ThreadControl.SetEnable(findToolStripMenuItem, false);
ThreadControl.SetEnable(toolStripMenuItem9, false);
ThreadControl.SetEnable(expandAllToolStripMenuItem, false);
ThreadControl.SetEnable(collapseAllToolStripMenuItem, false);
@ -175,6 +178,8 @@ namespace FizzyLauncher
ThreadControl.SetEnable(findToolStripMenuItem, true);
ThreadControl.SetEnable(toolStripMenuItem9, true);
ThreadControl.SetEnable(expandAllToolStripMenuItem, true);
ThreadControl.SetEnable(collapseAllToolStripMenuItem, true);
@ -189,6 +194,8 @@ namespace FizzyLauncher
ThreadControl.SetEnable(findToolStripMenuItem, true);
ThreadControl.SetEnable(toolStripMenuItem9, true);
ThreadControl.SetEnable(expandAllToolStripMenuItem, true);
ThreadControl.SetEnable(collapseAllToolStripMenuItem, true);
@ -468,6 +475,22 @@ namespace FizzyLauncher
}
/// <summary>
/// Update icons
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem9_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
}
if (updateIconsForm == null) updateIconsForm = new UpdateIconsForm(treeView1, iconDatabase);
updateIconsForm.ShowDialog();
}
/// <summary>
/// Options
/// </summary>
@ -1176,7 +1199,7 @@ namespace FizzyLauncher
// retrieve icon from DB
if (!string.IsNullOrWhiteSpace(model.SiteAddress))
{
string iconID = Crypto.GetSHA256Hash(model?.SiteAddress);
string iconID = model?.ToHash();
icon = iconDatabase.FindIcon(iconID);
}
@ -1184,7 +1207,7 @@ namespace FizzyLauncher
BookmarkForm bookmarkForm = new BookmarkForm(model, icon);
if (bookmarkForm.ShowDialog() == DialogResult.OK)
{
string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteAddress);
string iconID = bookmarkForm.Model.Item?.ToHash();
if (!string.IsNullOrWhiteSpace(iconID))
{
iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon);

View File

@ -1,4 +1,5 @@
using System;
using BookmarkManager;
using System;
using System.Text;
namespace bzit.bomg.Models
@ -47,5 +48,7 @@ namespace bzit.bomg.Models
return sb.ToString();
}
public string ToHash() => Crypto.GetSHA256Hash(this.SiteAddress);
}
}

View File

@ -2,6 +2,8 @@
using HtmlAgilityPack;
using RyzStudio.Net;
using System;
using System.Drawing;
using System.IO;
using System.Net;
namespace BookmarkManager
@ -9,6 +11,7 @@ namespace BookmarkManager
public class WebParser
{
protected HttpWeb webClient = null;
protected WebClient webClient2 = null;
public BookmarkResult RetrieveDetails(string url)
@ -44,6 +47,35 @@ namespace BookmarkManager
return rs;
}
public Bitmap RetrieveImage(string url)
{
if (string.IsNullOrWhiteSpace(url))
{
return null;
}
if (webClient2 == null) webClient2 = new WebClient();
webClient2.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
try
{
byte[] byteData = webClient2.DownloadData(url);
if (!RyzStudio.IO.FileType.IsImage(byteData))
{
throw new Exception("Not a supported image");
}
Image img = Image.FromStream(new MemoryStream(byteData));
return new Bitmap(img, 16, 16);
}
catch (Exception)
{
return null;
}
}
protected string retrieveSourceCode(string url)
{

View File

@ -0,0 +1,63 @@
namespace RyzStudio.Windows.Forms
{
partial class TCustomProgressBar
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label3
//
this.label3.BackColor = System.Drawing.Color.Transparent;
this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
this.label3.Font = new System.Drawing.Font("Segoe UI", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(4, 4);
this.label3.Margin = new System.Windows.Forms.Padding(0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(803, 47);
this.label3.TabIndex = 144;
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// ProgressBarInner
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label3);
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "ProgressBarInner";
this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.Size = new System.Drawing.Size(810, 54);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label3;
}
}

View File

@ -0,0 +1,158 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace RyzStudio.Windows.Forms
{
public partial class TCustomProgressBar : TUserControl
{
protected int minimum = 0;
protected int maximum = 100;
protected int value = 50;
public TCustomProgressBar() : base()
{
InitializeComponent();
this.Padding = new Padding(0);
}
[Category("Data"), Browsable(true)]
public int Minimum
{
get => minimum;
set
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
SetMinimum(value);
}));
}
else
{
SetMinimum(value);
}
}
}
[Category("Data"), Browsable(true)]
public int Maximum
{
get => maximum;
set
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
SetMaximum(value);
}));
}
else
{
SetMaximum(value);
}
}
}
[Category("Data"), Browsable(true)]
public int Value
{
get => value;
set
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
SetValue(value);
}));
}
else
{
SetValue(value);
}
}
}
[Category("Appearance"), Browsable(true)]
public Color BarColour { get; set; } = Color.FromArgb(158, 225, 249);
[Category("Appearance"), Browsable(true)]
public Color BarTextColour { get => label3.ForeColor; set => label3.ForeColor = value; }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Rectangle canvas = this.DisplayRectangle;
Graphics g = e.Graphics;
if (this.Value > 0)
{
decimal result = decimal.Divide(canvas.Width, this.Maximum) * this.Value;
canvas.Width = (int)Math.Round(result);
g.FillRectangle(new SolidBrush(this.BarColour), canvas);
}
}
public void Reset(int value)
{
this.Minimum = 0;
this.Value = 0;
this.Maximum = value;
}
protected void UpdateText() => RyzStudio.Windows.Forms.ThreadControl.SetText(label3, string.Format("{0}/{1}", this.Value.ToString(), this.Maximum.ToString()));
protected void SetMinimum(int value)
{
int m = value;
if (m < 0) m = 0;
if (m > this.Maximum) m = this.Maximum;
if (this.Value < m) this.Value = m;
if (this.value > this.Maximum) this.value = this.Maximum;
minimum = m;
UpdateText();
this.Invalidate();
}
protected void SetMaximum(int value)
{
int m = value;
if (m < 0) m = 0;
if (m < this.Minimum) m = this.Minimum;
if (this.Value > m) this.Value = m;
if (this.value < this.Minimum) this.value = this.Minimum;
maximum = m;
UpdateText();
this.Invalidate();
}
protected void SetValue(int value)
{
int m = value;
if (m < this.Minimum) m = this.Minimum;
if (m > this.Maximum) m = this.Maximum;
this.value = m;
UpdateText();
this.Invalidate();
}
}
}

View 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>

View File

@ -626,6 +626,20 @@ namespace RyzStudio.Windows.Forms
}
}
public static void SetValue(ComboBox control, int value)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(() => {
control.SelectedIndex = value;
}));
}
else
{
control.SelectedIndex = value;
}
}
public static void SetValue(PictureBox control, Image value)
{
if (control.InvokeRequired)
@ -641,6 +655,42 @@ namespace RyzStudio.Windows.Forms
}
}
public static string GetValue(ListBox sender)
{
string rv = string.Empty;
if (sender.InvokeRequired)
{
sender.Invoke(new MethodInvoker(() => {
rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString();
}));
}
else
{
rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString();
}
return rv;
}
public static int GetValue(ComboBox sender)
{
int rv = -1;
if (sender.InvokeRequired)
{
sender.Invoke(new MethodInvoker(() => {
rv = sender.SelectedIndex;
}));
}
else
{
rv = sender.SelectedIndex;
}
return rv;
}
public static void SetVisible(Control control, bool value)
{
if (control.InvokeRequired)

View File

@ -1,4 +1,7 @@
namespace RyzStudio.Windows.ThemedForms
using RyzStudio.Windows.Forms;
using System.Windows.Forms;
namespace RyzStudio.Windows.ThemedForms
{
public class TYesNoPickerBox : TPickerBox
{
@ -11,7 +14,14 @@
if (this.ComboBox.Items.Count > 0) this.ComboBox.SelectedIndex = 0;
}
public bool Value { get => (this.ComboBox.SelectedIndex == 1); set =>this.ComboBox.SelectedIndex = (value ? 1 : 0); }
public ComboBox InnerControl { get => this.ComboBox; }
public bool Value
{
get => (ThreadControl.GetValue(this.ComboBox) == 1);
set => ThreadControl.SetValue(this.ComboBox, (value ? 1 : 0));
}
}
}

View File

@ -1,5 +1,6 @@
namespace RyzStudio.Windows.ThemedForms
{
using RyzStudio.Windows.Forms;
using System;
using System.ComponentModel;
using System.Drawing;
@ -136,7 +137,7 @@
[Browsable(true)]
[Category("Appearance")]
public string LabelText { get => label1.Text; set => label1.Text = value; }
public string LabelText { get => ThreadControl.GetText(label1); set => ThreadControl.SetText(label1, value); }
[Browsable(true)]
[Category("Appearance")]

View File

@ -0,0 +1,50 @@
using RyzStudio.Drawing;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace RyzStudio.Windows.ThemedForms
{
public partial class TProgressBar : RyzStudio.Windows.ThemedForms.TUserControl
{
protected readonly Padding textboxPadding = new Padding(2, 2, 2, 2);
public TProgressBar() : base()
{
InitializeComponent();
this.Margin = new Padding(10, 6, 10, 6);
this.Font = new Font(this.Font, FontStyle.Regular);
customProgressBar1.Font = this.Font;
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
this.Invalidate();
}
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")]
public RyzStudio.Windows.Forms.TCustomProgressBar InnerControl { get => customProgressBar1; set => customProgressBar1 = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get => base.Margin; set => base.Margin = value; }
protected override void updateBackground(Graphics g, ThemeStyle style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
this.Padding = new Padding((b + textboxPadding.Left), (b + textboxPadding.Top), ((b - 1) + textboxPadding.Right), ((b - 1) + textboxPadding.Bottom));
Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth);
g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath());
g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath());
}
}
}

View File

@ -0,0 +1,65 @@
namespace RyzStudio.Windows.ThemedForms
{
partial class TProgressBar
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.customProgressBar1 = new RyzStudio.Windows.Forms.TCustomProgressBar();
this.SuspendLayout();
//
// customProgressBar1
//
this.customProgressBar1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.customProgressBar1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.customProgressBar1.BarColour = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(225)))), ((int)(((byte)(249)))));
this.customProgressBar1.BarTextColour = System.Drawing.SystemColors.ControlText;
this.customProgressBar1.Dock = System.Windows.Forms.DockStyle.Fill;
this.customProgressBar1.Location = new System.Drawing.Point(4, 4);
this.customProgressBar1.Margin = new System.Windows.Forms.Padding(0);
this.customProgressBar1.Maximum = 100;
this.customProgressBar1.Minimum = 0;
this.customProgressBar1.Name = "customProgressBar1";
this.customProgressBar1.Size = new System.Drawing.Size(121, 25);
this.customProgressBar1.TabIndex = 0;
this.customProgressBar1.Value = 50;
//
// TProgressBar
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.customProgressBar1);
this.Name = "TProgressBar";
this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.Size = new System.Drawing.Size(128, 32);
this.ResumeLayout(false);
}
#endregion
private Forms.TCustomProgressBar customProgressBar1;
}
}

View File

@ -0,0 +1,60 @@
<root>
<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>

380
UpdateIconsForm.cs Normal file
View File

@ -0,0 +1,380 @@
using BookmarkManager;
using bzit.bomg.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
using TProgressBar = RyzStudio.Windows.Forms.TCustomProgressBar;
namespace FizzyLauncher
{
public class UpdateIconsForm : TDialogForm
{
private System.Windows.Forms.Label label1;
private TButton button1;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
private Label label2;
private PictureBox pictureBox2;
private ToolTip toolTip1;
private System.ComponentModel.IContainer components;
protected BookmarkTreeView bookmarkTreeView = null;
protected IconDatabase iconDatabase = null;
protected WebParser webParser = null;
protected WebClient webClient = null;
private TYesNoPickerBox pickerBox1;
private TButton button2;
protected bool isBusy = false;
private RyzStudio.Windows.ThemedForms.TProgressBar progressBar1;
protected bool requestCancellation = false;
public UpdateIconsForm(BookmarkTreeView treeView, IconDatabase database)
{
InitializeComponent();
bookmarkTreeView = treeView;
iconDatabase = database;
pickerBox1.InnerControl.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.tHorizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.label2 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.button2 = new RyzStudio.Windows.ThemedForms.TButton();
this.progressBar1 = new RyzStudio.Windows.ThemedForms.TProgressBar();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
this.label1.Location = new System.Drawing.Point(10, 21);
this.label1.Margin = new System.Windows.Forms.Padding(0);
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
this.label1.Size = new System.Drawing.Size(154, 34);
this.label1.TabIndex = 153;
this.label1.Text = "Find outstanding icons only";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.DefaultImage = null;
this.button1.DownImage = null;
this.button1.IsSelected = false;
this.button1.LabelText = "&Close";
this.button1.Location = new System.Drawing.Point(241, 469);
this.button1.Margin = new System.Windows.Forms.Padding(10);
this.button1.Name = "button1";
this.button1.OverImage = null;
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(128, 32);
this.button1.TabIndex = 173;
this.button1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.button1_MouseClick);
//
// tHorizontalSeparator1
//
this.tHorizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tHorizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.tHorizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.tHorizontalSeparator1.BackColor = System.Drawing.Color.Transparent;
this.tHorizontalSeparator1.Location = new System.Drawing.Point(10, 437);
this.tHorizontalSeparator1.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
this.tHorizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
this.tHorizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22);
this.tHorizontalSeparator1.Name = "tHorizontalSeparator1";
this.tHorizontalSeparator1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
this.tHorizontalSeparator1.Size = new System.Drawing.Size(364, 22);
this.tHorizontalSeparator1.TabIndex = 188;
//
// tHorizontalSeparator2
//
this.tHorizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tHorizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.tHorizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.tHorizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
this.tHorizontalSeparator2.Location = new System.Drawing.Point(10, 59);
this.tHorizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
this.tHorizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
this.tHorizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
this.tHorizontalSeparator2.Name = "tHorizontalSeparator2";
this.tHorizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
this.tHorizontalSeparator2.Size = new System.Drawing.Size(364, 22);
this.tHorizontalSeparator2.TabIndex = 190;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.label2.Location = new System.Drawing.Point(10, 85);
this.label2.Margin = new System.Windows.Forms.Padding(0);
this.label2.Name = "label2";
this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
this.label2.Size = new System.Drawing.Size(52, 34);
this.label2.TabIndex = 195;
this.label2.Text = "Progress";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pictureBox2
//
this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
this.pictureBox2.ErrorImage = null;
this.pictureBox2.InitialImage = null;
this.pictureBox2.Location = new System.Drawing.Point(196, 469);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(32, 32);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox2.TabIndex = 202;
this.pictureBox2.TabStop = false;
//
// pickerBox1
//
this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
this.pickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.pickerBox1.Location = new System.Drawing.Point(285, 21);
this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.pickerBox1.Name = "pickerBox1";
this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox1.Size = new System.Drawing.Size(84, 34);
this.pickerBox1.SubmitButton = null;
this.pickerBox1.TabIndex = 203;
this.pickerBox1.Value = true;
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button2.BackColor = System.Drawing.Color.Transparent;
this.button2.DefaultImage = null;
this.button2.DownImage = null;
this.button2.IsSelected = false;
this.button2.LabelText = "&Run";
this.button2.Location = new System.Drawing.Point(241, 168);
this.button2.Margin = new System.Windows.Forms.Padding(10);
this.button2.Name = "button2";
this.button2.OverImage = null;
this.button2.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button2.Size = new System.Drawing.Size(128, 32);
this.button2.TabIndex = 205;
this.button2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.button2_MouseClick);
//
// progressBar1
//
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.BackColor = System.Drawing.Color.Transparent;
this.progressBar1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.progressBar1.Location = new System.Drawing.Point(10, 119);
this.progressBar1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Padding = new System.Windows.Forms.Padding(6, 6, 5, 5);
this.progressBar1.Size = new System.Drawing.Size(359, 33);
this.progressBar1.TabIndex = 206;
//
// UpdateIconsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(384, 521);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.button2);
this.Controls.Add(this.pickerBox1);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.tHorizontalSeparator2);
this.Controls.Add(this.tHorizontalSeparator1);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.KeyPreview = true;
this.MinimumSize = new System.Drawing.Size(400, 560);
this.Name = "UpdateIconsForm";
this.Text = "Update Icons";
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
comboBox1_SelectedIndexChanged(null, null);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
this.DialogResult = DialogResult.None;
}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
if (IsBusy)
{
e.Cancel = true;
}
}
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
if (!IsBusy)
{
this.Close();
}
}
base.OnKeyDown(e);
}
protected bool IsBusy
{
get => isBusy;
set
{
isBusy = value;
ThreadControl.SetValue(pictureBox2, (isBusy ? AppResource.loading_block : null));
ThreadControl.SetEnable(pickerBox1, !isBusy);
button2.LabelText = (isBusy ? "&Stop" : "&Run");
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsBusy)
{
return;
}
List<BookmarkItem> bookmarkList = GetBookmarkFilteredList();
progressBar1.InnerControl.Reset(bookmarkList.Count);
}
private async void button2_MouseClick(object sender, MouseEventArgs e)
{
await Task.Run(() =>
{
if (IsBusy)
{
requestCancellation = true;
return;
}
IsBusy = true;
WebParser webParser = new WebParser();
List<BookmarkItem> bookmarkList = GetBookmarkFilteredList();
progressBar1.InnerControl.Reset(bookmarkList.Count);
for (int i=0; i<bookmarkList.Count; i++)
{
progressBar1.InnerControl.Value = (i + 1);
if (requestCancellation) break;
BookmarkItem item = bookmarkList[i];
BookmarkResult result = webParser.RetrieveDetails(item.SiteAddress);
if (result == null)
{
continue;
}
if (string.IsNullOrWhiteSpace(result.IconURL))
{
continue;
}
if (requestCancellation) break;
Image favicon = webParser.RetrieveImage(result.IconURL);
if (favicon == null)
{
continue;
}
iconDatabase.AddIcon(item.ToHash(), favicon);
}
IsBusy = false;
requestCancellation = false;
});
}
private void button1_MouseClick(object sender, MouseEventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
protected List<BookmarkItem> GetBookmarkFilteredList()
{
List<BookmarkItem> rs = bookmarkTreeView.GetBookmarkList();
// remove empty
for (int i = 0; i < rs.Count; i++)
{
if (string.IsNullOrWhiteSpace(rs[i].SiteAddress))
{
rs.Remove(rs[i]);
}
}
if (pickerBox1.Value)
{
for (int i = 0; i < rs.Count; i++)
{
if (iconDatabase.HasIcon(rs[i].ToHash()))
{
rs.Remove(rs[i]);
}
}
}
return rs;
}
}
}

63
UpdateIconsForm.resx Normal file
View File

@ -0,0 +1,63 @@
<root>
<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>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -880,7 +880,7 @@ namespace RyzStudio.Windows.Forms
if (item == null) return (int)IconSet.Default;
if (string.IsNullOrWhiteSpace(item.SiteAddress)) return (int)IconSet.Default;
string iconID = Crypto.GetSHA256Hash(item?.SiteAddress);
string iconID = item?.ToHash();
Image image = this.IconDatabase.FindIcon(iconID);
if (image == null)
@ -888,10 +888,7 @@ namespace RyzStudio.Windows.Forms
return (int)IconSet.Default;
}
if (this.ImageList.Images.ContainsKey(iconID))
{
this.ImageList.Images.RemoveByKey(iconID);
}
if (this.ImageList.Images.ContainsKey(iconID)) this.ImageList.Images.RemoveByKey(iconID);
ThreadControl.Add(this, this.ImageList, iconID, image);