Merge pull request 'release/0.6.1' (#4) from release/0.6.1 into master
Reviewed-on: #4
This commit is contained in:
commit
3c4e1c735a
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>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </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>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </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>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -139,9 +139,6 @@
|
||||
<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>
|
||||
</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">
|
||||
<value>Resources\file-text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@ -151,24 +148,12 @@
|
||||
<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>
|
||||
</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">
|
||||
<value>Resources\hexagon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<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>
|
||||
</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">
|
||||
<value>Resources\trash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<Copyright>Ray Lam</Copyright>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
<Version>0.6.0.1042</Version>
|
||||
<Version>0.6.1.0249</Version>
|
||||
<PackageId>bukkubuddy</PackageId>
|
||||
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
|
||||
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
||||
@ -120,8 +120,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
|
||||
<PackageReference Include="RyzStudio" Version="8.1.2.324" />
|
||||
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.632" />
|
||||
<PackageReference Include="RyzStudio" Version="8.1.2.366" />
|
||||
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.689" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using BookmarkManager.Services;
|
||||
using bzit.bomg.Models;
|
||||
@ -54,11 +55,19 @@ namespace FizzyLauncher
|
||||
|
||||
try
|
||||
{
|
||||
if (model.Icon != null)
|
||||
{
|
||||
if (model.Icon.Width > 16)
|
||||
{
|
||||
model.Icon = RyzStudio.Drawing.ImageEditor.Resize(model.Icon, 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
pictureBox1.Image = model.Icon;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// do nothing
|
||||
pictureBox1.Image = model.Icon = null;
|
||||
}
|
||||
|
||||
memoBox1.Text = model.Notes?.Trim() ?? string.Empty;
|
||||
@ -200,6 +209,7 @@ namespace FizzyLauncher
|
||||
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
|
||||
pictureBox1.TabIndex = 201;
|
||||
pictureBox1.TabStop = false;
|
||||
pictureBox1.MouseClick += pictureBox1_MouseClick;
|
||||
pictureBox1.MouseDoubleClick += pictureBox1_MouseDoubleClick;
|
||||
//
|
||||
// textBox3
|
||||
@ -343,7 +353,30 @@ namespace FizzyLauncher
|
||||
|
||||
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;
|
||||
}
|
||||
@ -355,59 +388,48 @@ namespace FizzyLauncher
|
||||
|
||||
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)
|
||||
{
|
||||
this.IsBusy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
textBox1.Text = _webProvider.ParseTitle(document);
|
||||
textBox3.Text = _webProvider.ParseMetaDescription(document);
|
||||
pictureBox1.Image = await _webProvider.RetrieveImage(document);
|
||||
if (updateTitle)
|
||||
{
|
||||
textBox1.Text = _webProvider.ParseTitle(document);
|
||||
}
|
||||
|
||||
if (updateDescription)
|
||||
{
|
||||
textBox3.Text = _webProvider.ParseMetaDescription(document);
|
||||
}
|
||||
|
||||
if (updateIcon)
|
||||
{
|
||||
try
|
||||
{
|
||||
pictureBox1.Image = await _webProvider.RetrieveImage(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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
34
MainForm.Designer.cs
generated
34
MainForm.Designer.cs
generated
@ -120,7 +120,7 @@ namespace FizzyLauncher
|
||||
//
|
||||
// newToolStripMenuItem
|
||||
//
|
||||
newToolStripMenuItem.Image = BookmarkManager.AppResource.file;
|
||||
newToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||
newToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N;
|
||||
newToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
@ -129,7 +129,7 @@ namespace FizzyLauncher
|
||||
//
|
||||
// openToolStripMenuItem
|
||||
//
|
||||
openToolStripMenuItem.Image = BookmarkManager.AppResource.folder;
|
||||
openToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||
openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O;
|
||||
openToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
@ -155,7 +155,7 @@ namespace FizzyLauncher
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
saveToolStripMenuItem.Image = BookmarkManager.AppResource.save;
|
||||
saveToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S;
|
||||
saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
@ -190,10 +190,10 @@ namespace FizzyLauncher
|
||||
//
|
||||
// findToolStripMenuItem
|
||||
//
|
||||
findToolStripMenuItem.Image = BookmarkManager.AppResource.search;
|
||||
findToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
findToolStripMenuItem.Name = "findToolStripMenuItem";
|
||||
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(180, 22);
|
||||
findToolStripMenuItem.Text = "&Find";
|
||||
findToolStripMenuItem.Click += findToolStripMenuItem_Click;
|
||||
//
|
||||
@ -207,26 +207,26 @@ namespace FizzyLauncher
|
||||
// expandAllToolStripMenuItem
|
||||
//
|
||||
expandAllToolStripMenuItem.Name = "expandAllToolStripMenuItem";
|
||||
expandAllToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
expandAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
expandAllToolStripMenuItem.Text = "&Expand All";
|
||||
expandAllToolStripMenuItem.Click += expandAllToolStripMenuItem_Click;
|
||||
//
|
||||
// collapseAllToolStripMenuItem
|
||||
//
|
||||
collapseAllToolStripMenuItem.Name = "collapseAllToolStripMenuItem";
|
||||
collapseAllToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
collapseAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
collapseAllToolStripMenuItem.Text = "&Collapse All";
|
||||
collapseAllToolStripMenuItem.Click += collapseAllToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
|
||||
toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
|
||||
//
|
||||
// alwaysOnTopToolStripMenuItem
|
||||
//
|
||||
alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem";
|
||||
alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
alwaysOnTopToolStripMenuItem.Text = "Always On &Top";
|
||||
alwaysOnTopToolStripMenuItem.Click += alwaysOnTopToolStripMenuItem_Click;
|
||||
//
|
||||
@ -240,21 +240,21 @@ namespace FizzyLauncher
|
||||
// toolStripMenuItem9
|
||||
//
|
||||
toolStripMenuItem9.Name = "toolStripMenuItem9";
|
||||
toolStripMenuItem9.Size = new System.Drawing.Size(168, 22);
|
||||
toolStripMenuItem9.Size = new System.Drawing.Size(180, 22);
|
||||
toolStripMenuItem9.Text = "Update &Icons";
|
||||
toolStripMenuItem9.Click += toolStripMenuItem9_Click;
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
toolStripSeparator2.Size = new System.Drawing.Size(165, 6);
|
||||
toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
|
||||
//
|
||||
// optionsToolStripMenuItem
|
||||
//
|
||||
optionsToolStripMenuItem.Image = BookmarkManager.AppResource.settings;
|
||||
optionsToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||
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(180, 22);
|
||||
optionsToolStripMenuItem.Text = "&Options";
|
||||
optionsToolStripMenuItem.Click += optionsToolStripMenuItem_Click;
|
||||
//
|
||||
@ -267,22 +267,22 @@ namespace FizzyLauncher
|
||||
//
|
||||
// viewHelpToolStripMenuItem1
|
||||
//
|
||||
viewHelpToolStripMenuItem1.Image = BookmarkManager.AppResource.help_circle;
|
||||
viewHelpToolStripMenuItem1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
|
||||
viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
|
||||
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
|
||||
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
viewHelpToolStripMenuItem1.Text = "&View Help";
|
||||
viewHelpToolStripMenuItem1.Click += viewHelpToolStripMenuItem1_Click;
|
||||
//
|
||||
// toolStripMenuItem16
|
||||
//
|
||||
toolStripMenuItem16.Name = "toolStripMenuItem16";
|
||||
toolStripMenuItem16.Size = new System.Drawing.Size(143, 6);
|
||||
toolStripMenuItem16.Size = new System.Drawing.Size(177, 6);
|
||||
//
|
||||
// aboutToolStripMenuItem1
|
||||
//
|
||||
aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
|
||||
aboutToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
|
||||
aboutToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
aboutToolStripMenuItem1.Text = "&About";
|
||||
aboutToolStripMenuItem1.Click += aboutToolStripMenuItem1_Click;
|
||||
//
|
||||
|
45
MainForm.cs
45
MainForm.cs
@ -15,6 +15,7 @@ using FizzyLauncher.Models;
|
||||
using RyzStudio;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
using static RyzStudio.Windows.Forms.BookmarkTreeView;
|
||||
|
||||
namespace FizzyLauncher
|
||||
{
|
||||
@ -31,6 +32,14 @@ namespace FizzyLauncher
|
||||
|
||||
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.OpenFileDialog = openFileDialog1;
|
||||
_fileSessionManager.SaveFileDialog = saveFileDialog1;
|
||||
@ -776,7 +785,7 @@ namespace FizzyLauncher
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
// Add icons to save file
|
||||
var result2 = AddImagesToZipFile(filename, this.CurrentSession.Items);
|
||||
var result2 = AddImagesToZipFile(filename, nodeList);
|
||||
if (!result2.IsSuccess)
|
||||
{
|
||||
if (showNotices)
|
||||
@ -970,7 +979,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))
|
||||
{
|
||||
@ -998,14 +1007,38 @@ namespace FizzyLauncher
|
||||
{
|
||||
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);
|
||||
if (zipEntry != null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -1016,7 +1049,7 @@ namespace FizzyLauncher
|
||||
{
|
||||
using (Stream entryStream = zipEntry.Open())
|
||||
{
|
||||
using (Image image = item.Icon)
|
||||
using (Image image = icon)
|
||||
{
|
||||
image.Save(entryStream, ImageFormat.Png);
|
||||
}
|
||||
@ -1024,6 +1057,8 @@ namespace FizzyLauncher
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
zipEntry.Delete();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -356,14 +356,25 @@ namespace FizzyLauncher
|
||||
break;
|
||||
}
|
||||
|
||||
var image = await _webProvider.RetrieveImage(document);
|
||||
if (image == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var newModel = item.Value;
|
||||
newModel.Icon = image;
|
||||
|
||||
try
|
||||
{
|
||||
var image = await _webProvider.RetrieveImage(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);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.ComponentModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using bzit.bomg.Models;
|
||||
using FizzyLauncher;
|
||||
@ -125,6 +127,8 @@ namespace RyzStudio.Windows.Forms
|
||||
if (MessageBox.Show("Delete?", "Delete?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
this.DeleteNode();
|
||||
|
||||
this.HasChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,6 +247,8 @@ namespace RyzStudio.Windows.Forms
|
||||
this.EditNode(treeNode);
|
||||
}
|
||||
|
||||
this.HasChanged = true;
|
||||
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
@ -272,6 +278,8 @@ namespace RyzStudio.Windows.Forms
|
||||
|
||||
this.SelectedNode = newNode;
|
||||
|
||||
this.HasChanged = true;
|
||||
|
||||
return newNode;
|
||||
}
|
||||
}
|
||||
@ -282,29 +290,11 @@ namespace RyzStudio.Windows.Forms
|
||||
public TreeNode AddNode(BookmarkModel model)
|
||||
{
|
||||
var parentNode = this.CreateNodePath(model?.Path?.Trim() ?? string.Empty, (int)NodeIcon.Folder1, (int)NodeIcon.Folder2);
|
||||
int iconIndex = (int)NodeIcon.Default;
|
||||
|
||||
// Add custom favicon
|
||||
if (model.Icon != null)
|
||||
{
|
||||
var iconKey = model.Id.ToString();
|
||||
if (!string.IsNullOrWhiteSpace(iconKey))
|
||||
{
|
||||
if (this.ImageList.Images.ContainsKey(iconKey))
|
||||
{
|
||||
this.ImageList.Images.RemoveByKey(iconKey);
|
||||
}
|
||||
var n = AddImage(model.Id.ToString(), model.Icon);
|
||||
|
||||
UIControl.Invoke(this, (x) =>
|
||||
{
|
||||
this.ImageList.Images.Add(iconKey, model.Icon);
|
||||
});
|
||||
|
||||
iconIndex = this.ImageList.Images.IndexOfKey(iconKey);
|
||||
}
|
||||
}
|
||||
|
||||
TreeNode newNode = new TreeNode(model?.Title?.Trim() ?? string.Empty, iconIndex, iconIndex);
|
||||
TreeNode newNode = new TreeNode(model?.Title?.Trim() ?? string.Empty, n, n);
|
||||
newNode.Tag = model;
|
||||
newNode.ToolTipText = model.ToString();
|
||||
|
||||
@ -404,10 +394,6 @@ namespace RyzStudio.Windows.Forms
|
||||
if (node == null)
|
||||
{
|
||||
node = this.SelectedNode;
|
||||
}
|
||||
|
||||
if (node == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -416,36 +402,18 @@ namespace RyzStudio.Windows.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
var iconIndex = (int)NodeIcon.Default;
|
||||
if (model.Id == Guid.Empty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update custom favicon
|
||||
var iconKey = model.Id.ToString();
|
||||
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);
|
||||
}
|
||||
}
|
||||
var n = AddImage(model.Id.ToString(), model.Icon);
|
||||
|
||||
UIControl.Invoke(this, (x) =>
|
||||
{
|
||||
node.Text = model.Title;
|
||||
node.ImageIndex = iconIndex;
|
||||
node.SelectedImageIndex = iconIndex;
|
||||
node.ImageIndex = node.SelectedImageIndex = n;
|
||||
node.Tag = model;
|
||||
node.ToolTipText = model.ToString();
|
||||
});
|
||||
@ -462,9 +430,43 @@ namespace RyzStudio.Windows.Forms
|
||||
this.ImageList.Images.Add(Resources.hexagon);
|
||||
this.ImageList.Images.Add(Resources.folder);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user