Changed: site address as icon ID

This commit is contained in:
Ray 2021-09-28 21:46:01 +01:00
parent 3518084267
commit 2fe74fe29d
2 changed files with 5 additions and 8 deletions

View File

@ -691,7 +691,6 @@ namespace FizzyLauncher
#endregion #endregion
private async void treeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) private async void treeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{ {
TreeNode tn = treeView1.SelectedNode; TreeNode tn = treeView1.SelectedNode;
@ -1072,9 +1071,9 @@ namespace FizzyLauncher
Image icon = null; Image icon = null;
// retrieve icon from DB // retrieve icon from DB
if (!string.IsNullOrWhiteSpace(model.SiteName)) if (!string.IsNullOrWhiteSpace(model.SiteAddress))
{ {
string iconID = Crypto.GetSHA256Hash(model?.SiteName); string iconID = Crypto.GetSHA256Hash(model?.SiteAddress);
icon = iconDatabase.FindIcon(iconID); icon = iconDatabase.FindIcon(iconID);
} }
@ -1082,7 +1081,7 @@ namespace FizzyLauncher
BookmarkForm bookmarkForm = new BookmarkForm(model, icon); BookmarkForm bookmarkForm = new BookmarkForm(model, icon);
if (bookmarkForm.ShowDialog() == DialogResult.OK) if (bookmarkForm.ShowDialog() == DialogResult.OK)
{ {
string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteName); string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteAddress);
if (!string.IsNullOrWhiteSpace(iconID)) if (!string.IsNullOrWhiteSpace(iconID))
{ {
iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon); iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon);

View File

@ -878,9 +878,9 @@ namespace RyzStudio.Windows.Forms
{ {
if (this.IconDatabase == null) return (int)IconSet.Default; if (this.IconDatabase == null) return (int)IconSet.Default;
if (item == null) return (int)IconSet.Default; if (item == null) return (int)IconSet.Default;
if (string.IsNullOrWhiteSpace(item.SiteName)) return (int)IconSet.Default; if (string.IsNullOrWhiteSpace(item.SiteAddress)) return (int)IconSet.Default;
string iconID = Crypto.GetSHA256Hash(item?.SiteName); string iconID = Crypto.GetSHA256Hash(item?.SiteAddress);
Image image = this.IconDatabase.FindIcon(iconID); Image image = this.IconDatabase.FindIcon(iconID);
if (image == null) if (image == null)
@ -896,8 +896,6 @@ namespace RyzStudio.Windows.Forms
ThreadControl.Add(this, this.ImageList, iconID, image); ThreadControl.Add(this, this.ImageList, iconID, image);
return this.ImageList.Images.IndexOfKey(iconID); return this.ImageList.Images.IndexOfKey(iconID);
//return (int)IconSet.Default;
} }
//protected int addIcon(BookmarkItemViewModel viewModel) => addIcon(viewModel.ToModel()); //protected int addIcon(BookmarkItemViewModel viewModel) => addIcon(viewModel.ToModel());