release/0.7.0 #5

Merged
Ray merged 2 commits from release/0.7.0 into master 2026-05-22 10:15:20 +00:00
73 changed files with 3754 additions and 2209 deletions

View File

@ -1,315 +0,0 @@
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, 361);
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, 433);
button3.Name = "button3";
button3.Padding = new Padding(4, 4, 3, 3);
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, 393);
progressBar2.Maximum = 100;
progressBar2.Minimum = 0;
progressBar2.Name = "progressBar2";
progressBar2.Padding = new Padding(4, 4, 3, 3);
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, 477);
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.Padding = new Padding(4, 4, 3, 3);
memoBox1.ReadOnly = false;
memoBox1.ScrollBars = ScrollBars.Vertical;
memoBox1.Size = new System.Drawing.Size(424, 298);
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, 561);
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, 600);
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;
}
}
}

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows8.0</TargetFramework>
<TargetFramework>net10.0-windows8.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<NoWin32Manifest>true</NoWin32Manifest>
<ApplicationIcon>favicon.ico</ApplicationIcon>
@ -14,7 +14,7 @@
<Copyright>Ray Lam</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Version>0.6.5.149</Version>
<Version>0.7.0.255</Version>
<PackageId>bukkubuddy</PackageId>
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
@ -38,7 +38,9 @@
<Compile Remove="DTO\**" />
<Compile Remove="Net\**" />
<Compile Remove="References\**" />
<Compile Remove="Resources\UI\**" />
<Compile Remove="Resources\MainMenu\**" />
<Compile Remove="Resources\New folder\**" />
<Compile Remove="Resources\TreeView\**" />
<Compile Remove="RyzStudio\**" />
<Compile Remove="Text\**" />
<EmbeddedResource Remove="#\**" />
@ -46,7 +48,9 @@
<EmbeddedResource Remove="DTO\**" />
<EmbeddedResource Remove="Net\**" />
<EmbeddedResource Remove="References\**" />
<EmbeddedResource Remove="Resources\UI\**" />
<EmbeddedResource Remove="Resources\MainMenu\**" />
<EmbeddedResource Remove="Resources\New folder\**" />
<EmbeddedResource Remove="Resources\TreeView\**" />
<EmbeddedResource Remove="RyzStudio\**" />
<EmbeddedResource Remove="Text\**" />
<None Remove="#\**" />
@ -54,17 +58,21 @@
<None Remove="DTO\**" />
<None Remove="Net\**" />
<None Remove="References\**" />
<None Remove="Resources\UI\**" />
<None Remove="Resources\MainMenu\**" />
<None Remove="Resources\New folder\**" />
<None Remove="Resources\TreeView\**" />
<None Remove="RyzStudio\**" />
<None Remove="Text\**" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Models\TileGroupModel.cs" />
<Compile Remove="Models\TileModel.cs" />
<Compile Remove="DTOs\BookmarkModel.cs" />
<Compile Remove="DTOs\TileGroupModel.cs" />
<Compile Remove="DTOs\TileModel.cs" />
<Compile Remove="NewForm.cs" />
<Compile Remove="OpenFileForm.cs" />
<Compile Remove="PasswordForm.cs" />
<Compile Remove="UpdateIconsForm.cs" />
<Compile Remove="Windows\Forms\BookmarkTreeViewSNode.cs" />
<Compile Remove="Windows\Forms\EditGroupForm.cs" />
<Compile Remove="Windows\Forms\EditTileFolderForm.cs" />
@ -80,6 +88,7 @@
<EmbeddedResource Remove="NewForm.resx" />
<EmbeddedResource Remove="OpenFileForm.resx" />
<EmbeddedResource Remove="PasswordForm.resx" />
<EmbeddedResource Remove="UpdateIconsForm.resx" />
<EmbeddedResource Remove="Windows\Forms\EditGroupForm.resx" />
<EmbeddedResource Remove="Windows\Forms\EditTileFolderForm.resx" />
<EmbeddedResource Remove="Windows\Forms\EditTileForm.resx" />
@ -90,10 +99,13 @@
<ItemGroup>
<None Remove=".gitignore" />
<None Remove="build-installer.iss" />
<None Remove="build.bat" />
<None Remove="build64.bat" />
<None Remove="installer-64.iss" />
<None Remove="installer-86.iss" />
<None Remove="Resources\icon-64.png" />
<None Remove="Resources\loading-block.gif" />
</ItemGroup>
<ItemGroup>
@ -101,30 +113,44 @@
</ItemGroup>
<ItemGroup>
<Compile Update="AppResource.Designer.cs">
<Compile Update="Resources\MainMenuResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>AppResource.resx</DependentUpon>
<DependentUpon>MainMenuResource.resx</DependentUpon>
</Compile>
<Compile Update="AddBatchPageForm.cs">
<Compile Update="Forms\AddMultiPageForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="UpdateIconsForm.cs" />
<Compile Update="FindForm.cs" />
<Compile Update="EditBookmarkForm.cs" />
<Compile Update="Forms\UpdateIconsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\ClearIconsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FindForm.cs" />
<Compile Update="Forms\EditBookmarkForm.cs" />
<Compile Update="Resources\TreeViewResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>TreeViewResource.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="AppResource.resx">
<EmbeddedResource Update="Resources\MainMenuResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>AppResource.Designer.cs</LastGenOutput>
<LastGenOutput>MainMenuResource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\TreeViewResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TreeViewResource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
<PackageReference Include="RyzStudio" Version="8.1.5.141" />
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.5.141" />
<PackageReference Include="HtmlAgilityPack" Version="1.12.4" />
<PackageReference Include="RyzStudio" Version="10.1.0.128" />
<PackageReference Include="RyzStudio.Windows.Forms" Version="10.1.0.140" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,54 @@
using System.Text;
namespace BukkuBuddy.DTOs.SaveFile
{
public class App4Options : AppOptionsBase
{
public class Item
{
public string SiteName { get; set; }
public string SiteAddress { get; set; }
public string SiteDescription { get; set; }
public string TreeviewPath { get; set; }
public string Notes { get; set; }
public string Path
{
get
{
if (string.IsNullOrWhiteSpace(TreeviewPath))
{
return string.Empty;
}
var path = this.TreeviewPath?.Trim('\\')?.Trim() ?? string.Empty;
if (!path.Contains("\\"))
{
return path?.Trim() ?? string.Empty;
}
var sb = new StringBuilder();
var parts = path.Split("\\");
for (var i = 1; i < parts.Length; i++)
{
var item = System.Web.HttpUtility.UrlDecode(parts[i]);
sb.Append(item);
sb.Append("\n");
}
return sb.ToString()?.Trim() ?? string.Empty;
}
}
}
}
}

View File

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Text.Json.Serialization;
namespace BukkuBuddy.DTOs.SaveFile
{
public class App6Options : AppOptionsBase
{
public class Item
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Title { get; set; }
public string Address { get; set; }
public string Description { get; set; }
public string Path { get; set; }
public string Notes { get; set; }
[JsonIgnore]
public Image Icon { get; set; }
public new string ToString()
{
StringBuilder sb = new StringBuilder();
if (!string.IsNullOrWhiteSpace(this.Title))
{
sb.AppendLine("Name");
sb.AppendLine(this.Title + Environment.NewLine);
}
if (!string.IsNullOrWhiteSpace(this.Address))
{
sb.AppendLine("Address");
sb.AppendLine(this.Address + Environment.NewLine);
}
if (!string.IsNullOrWhiteSpace(this.Description))
{
sb.AppendLine("Description");
sb.AppendLine(this.Description + Environment.NewLine);
}
if (!string.IsNullOrWhiteSpace(this.Notes))
{
sb.AppendLine("Notes");
sb.AppendLine(this.Notes + Environment.NewLine);
}
return sb.ToString();
}
}
public new int FileVersion { get; set; } = 6;
public bool RestorePosition { get; set; } = true;
public bool AlwaysOnTop { get; set; } = false;
public string RunCommand { get; set; } = "{0}";
public bool AllowUnsafeSSL { get; set; } = false;
public bool AllowCookies { get; set; } = false;
public bool AllowRedirects { get; set; } = true;
public int Timeout { get; set; } = 6;
public List<string> Directories { get; set; } = new List<string>();
public List<Item> Items { get; set; } = new List<Item>();
}
}

View File

@ -0,0 +1,16 @@
using System.Drawing;
namespace BukkuBuddy.DTOs.SaveFile
{
public class AppOptionsBase
{
public int FileVersion { get; set; } = 0;
public Point StartPosition { get; set; } = Point.Empty;
public int Width { get; set; } = 0;
public int Height { get; set; } = 320;
}
}

View File

@ -1,257 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using bzit.bomg.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
namespace FizzyLauncher
{
public class FindForm : Form
{
private System.Windows.Forms.Label label1;
private ThButton button2;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
private ThButton button1;
private ThClearableTextBox textBox1;
private BookmarkTreeView treeView1 = null;
private int findPosition = -1;
public FindForm(BookmarkTreeView treeView)
{
InitializeComponent();
this.MinimizeBox = false;
this.MaximizeBox = false;
this.ShowIcon = false;
this.ShowInTaskbar = true;
treeView1 = treeView;
textBox1.PreviewKeyDown += textBox1_PreviewKeyDown;
}
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.button2 = new RyzStudio.Windows.ThemedForms.ThButton();
this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.textBox1 = new ThClearableTextBox();
this.button1 = new RyzStudio.Windows.ThemedForms.ThButton();
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(30, 34);
this.label1.TabIndex = 153;
this.label1.Text = "Find";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// button2
//
this.button2.ActiveImage = null;
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.BackColor = System.Drawing.Color.Transparent;
this.button2.HoverImage = null;
this.button2.IdleImage = null;
this.button2.LabelText = "&Next";
this.button2.Location = new System.Drawing.Point(321, 99);
this.button2.Margin = new System.Windows.Forms.Padding(10, 0, 0, 10);
this.button2.Name = "button2";
this.button2.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button2.Size = new System.Drawing.Size(128, 32);
this.button2.TabIndex = 2;
this.button2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.button2_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, 67);
this.tHorizontalSeparator1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 10);
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(444, 22);
this.tHorizontalSeparator1.TabIndex = 188;
this.tHorizontalSeparator1.TabStop = false;
//
// textBox1
//
this.textBox1.AcceptButton = this.button2;
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.BackColor = System.Drawing.Color.Transparent;
this.textBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.textBox1.Location = new System.Drawing.Point(121, 20);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(328, 35);
this.textBox1.TabIndex = 0;
this.textBox1.UseSystemPasswordChar = false;
//
// button1
//
this.button1.ActiveImage = null;
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.HoverImage = null;
this.button1.IdleImage = null;
this.button1.LabelText = "&First";
this.button1.Location = new System.Drawing.Point(185, 99);
this.button1.Margin = new System.Windows.Forms.Padding(10, 0, 0, 10);
this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(128, 32);
this.button1.TabIndex = 1;
this.button1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.button1_MouseClick);
//
// FindForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(464, 151);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.tHorizontalSeparator1);
this.Controls.Add(this.button2);
this.Controls.Add(this.label1);
this.MinimumSize = new System.Drawing.Size(480, 190);
this.Name = "FindForm";
this.Text = "Find";
this.ResumeLayout(false);
this.PerformLayout();
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
textBox1.Focus();
}
private void textBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Enter:
if (findPosition < 0)
{
button1_MouseClick(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
else
{
button2_MouseClick(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
break;
case Keys.Escape:
this.Close();
break;
default:
break;
}
}
/// <summary>
/// Find first.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
return;
}
if (treeView1.Nodes.Count <= 0)
{
return;
}
findPosition = -1;
var nodeList = treeView1.ToNodeList<BookmarkModel>();
var node = nodeList.Where(x => x.Value.Title.Contains(textBox1.Text?.Trim())).Select(x => x.Key).FirstOrDefault();
if (node != null)
{
findPosition = 0;
treeView1.SelectedNode = node;
treeView1.SelectedNode.EnsureVisible();
}
}
}
/// <summary>
/// Find next.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
return;
}
if (treeView1.Nodes.Count <= 0)
{
return;
}
if (treeView1.SelectedNode == null)
{
treeView1.SelectedNode = treeView1.Nodes[0];
}
var nodeList = treeView1.ToNodeList<BookmarkModel>();
var node = nodeList.Where(x => x.Value.Title.Contains(textBox1.Text?.Trim())).Select(x => x.Key)?.ToList() ?? new List<TreeNode>();
if (node != null)
{
//var pos = nodeList.FindIndex(x => x.Key == treeView1.SelectedNode);
//if (pos < 0)
//{
// findPosition = -1;
//} else {
// findPosition = pos;
//}
findPosition++;
if (findPosition >= node.Count)
{
findPosition = 0;
}
treeView1.SelectedNode = node[findPosition];
treeView1.SelectedNode.EnsureVisible();
}
}
}
}
}

View File

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

276
Forms/AddMultiPageForm.cs Normal file
View File

@ -0,0 +1,276 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Forms;
using BukkuBuddy.DTOs.SaveFile;
using BukkuBuddy.Services;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
namespace BukkuBuddy.Forms
{
public class AddMultiPageForm : Form
{
private Label label1;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private ThToolbarMemoBox memoBox1;
private ThUserControl userControl1;
private TProgressBar progressBar1;
private readonly WebPageService _webPageService;
private readonly string _rootPath;
private List<App6Options.Item> result = null;
private bool isBusy = false;
public AddMultiPageForm(string rootPath, App6Options options)
{
InitializeComponent();
UISetup.Dialog(this);
_webPageService = new WebPageService(options.AllowUnsafeSSL, options.Timeout, options.AllowCookies, options.AllowRedirects);
_rootPath = rootPath;
}
private void InitializeComponent()
{
label1 = new Label();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
memoBox1 = new ThToolbarMemoBox();
userControl1 = new ThUserControl();
progressBar1 = new TProgressBar();
userControl1.SuspendLayout();
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(60, 23);
label1.TabIndex = 153;
label1.Text = "Addresses";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// dialogFooter1
//
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
dialogFooter1.Dock = DockStyle.Bottom;
dialogFooter1.EnableMovable = false;
dialogFooter1.IsBusy = false;
dialogFooter1.Location = new System.Drawing.Point(0, 451);
dialogFooter1.Name = "dialogFooter1";
dialogFooter1.Size = new System.Drawing.Size(384, 70);
dialogFooter1.TabIndex = 212;
dialogFooter1.TabStop = false;
dialogFooter1.OnButton1Click += dialogFooter1_OnButton1Click;
//
// memoBox1
//
memoBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
memoBox1.BackColor = System.Drawing.Color.Transparent;
memoBox1.ClearedValue = "";
memoBox1.EnableMovable = false;
memoBox1.Location = new System.Drawing.Point(95, 20);
memoBox1.Name = "memoBox1";
memoBox1.ReadOnly = false;
memoBox1.ScrollBars = ScrollBars.Vertical;
memoBox1.Size = new System.Drawing.Size(280, 387);
memoBox1.TabIndex = 211;
memoBox1.TabStop = false;
memoBox1.WordWrap = false;
//
// userControl1
//
userControl1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
userControl1.BackColor = System.Drawing.Color.Transparent;
userControl1.Controls.Add(progressBar1);
userControl1.EnableMovable = false;
userControl1.Location = new System.Drawing.Point(95, 417);
userControl1.Name = "userControl1";
userControl1.Size = new System.Drawing.Size(280, 24);
userControl1.TabIndex = 214;
//
// progressBar1
//
progressBar1.BarColour = System.Drawing.Color.FromArgb(190, 100, 242);
progressBar1.Dock = DockStyle.Fill;
progressBar1.EnableMovable = false;
progressBar1.Location = new System.Drawing.Point(3, 3);
progressBar1.Maximum = 100;
progressBar1.Minimum = 0;
progressBar1.Name = "progressBar1";
progressBar1.OnProgressChanged = null;
progressBar1.ShowText = true;
progressBar1.Size = new System.Drawing.Size(274, 18);
progressBar1.TabIndex = 156;
progressBar1.Value = 25;
//
// AddBatchPageForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = System.Drawing.Color.White;
ClientSize = new System.Drawing.Size(384, 521);
Controls.Add(userControl1);
Controls.Add(memoBox1);
Controls.Add(dialogFooter1);
Controls.Add(label1);
KeyPreview = true;
MinimumSize = new System.Drawing.Size(400, 560);
Name = "AddBatchPageForm";
Text = "Add Multiple Pages";
userControl1.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
memoBox1.Text = string.Empty;
progressBar1.Minimum = 0;
progressBar1.Value = 0;
progressBar1.Maximum = 0;
memoBox1.Focus();
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
base.OnFormClosing(e);
if (this.IsBusy)
{
e.Cancel = true;
}
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public List<App6Options.Item> Result
{
get => result;
private set => result = value;
}
protected bool IsBusy
{
get => isBusy;
set
{
isBusy = value;
UIControl.SetEnable(memoBox1, !isBusy);
dialogFooter1.IsBusy = isBusy;
}
}
private async void dialogFooter1_OnButton1Click(object sender, MouseEventArgs e)
{
if (this.IsBusy)
{
return;
}
this.IsBusy = true;
this.Result = new List<App6Options.Item>();
await Task.Run(async () =>
{
progressBar1.Value = 0;
progressBar1.Maximum = memoBox1.Lines?.Length ?? 0;
foreach (var item in memoBox1.Lines ?? new string[0])
{
progressBar1.Value++;
if (string.IsNullOrWhiteSpace(item))
{
continue;
}
if (!_webPageService.IsValidUrl(item))
{
continue;
}
var newBookmark = await CreateApp6OptionsItem(item, _rootPath);
if (newBookmark == null)
{
continue;
}
this.Result.Add(newBookmark);
}
});
this.IsBusy = false;
this.DialogResult = DialogResult.OK;
this.Close();
}
private async Task<App6Options.Item> CreateApp6OptionsItem(string url, string path)
{
if (!_webPageService.IsValidUrl(url))
{
return null;
}
HtmlAgilityPack.HtmlDocument htmlDocument = null;
try
{
htmlDocument = await _webPageService.GetDocument(url);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, "Update Icon", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
if (htmlDocument == null)
{
return null;
}
var response = new App6Options.Item();
response.Address = url;
response.Path = path;
response.Title = _webPageService.ParseTitle(htmlDocument) ?? string.Empty;
response.Description = _webPageService.ParseDescription(htmlDocument) ?? string.Empty;
var faviconUrl = _webPageService.ParseFavicon(htmlDocument);
if (!string.IsNullOrWhiteSpace(faviconUrl))
{
var favicon = await _webPageService.GetImage(faviconUrl);
if (favicon != null)
{
if (favicon.Width > 16)
{
favicon = RyzStudio.Drawing.ImageEditor.Resize(favicon, 16, 16);
}
}
response.Icon = favicon;
}
return response;
}
}
}

161
Forms/ClearIconsForm.cs Normal file
View File

@ -0,0 +1,161 @@
using System;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
using BukkuBuddy.DTOs.SaveFile;
using RyzStudio.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace BukkuBuddy.Forms
{
public class ClearIconsForm : Form
{
private TProgressBar progressBar1;
private RyzStudio.Windows.ThemedForms.ThUserControl userControl1;
private Label label1;
private Label label2;
private readonly BookmarkTreeView _treeView = null;
public ClearIconsForm(BookmarkTreeView treeView)
{
InitializeComponent();
UISetup.Dialog(this, true);
this.Text = "Deleting Icons";
_treeView = treeView;
}
private void InitializeComponent()
{
progressBar1 = new TProgressBar();
userControl1 = new RyzStudio.Windows.ThemedForms.ThUserControl();
label1 = new Label();
label2 = new Label();
userControl1.SuspendLayout();
SuspendLayout();
//
// progressBar1
//
progressBar1.BarColour = Color.FromArgb(25, 104, 218);
progressBar1.Dock = DockStyle.Fill;
progressBar1.EnableMovable = false;
progressBar1.Location = new Point(3, 3);
progressBar1.Maximum = 100;
progressBar1.Minimum = 0;
progressBar1.Name = "progressBar1";
progressBar1.OnProgressChanged = null;
progressBar1.ShowText = true;
progressBar1.Size = new Size(418, 18);
progressBar1.TabIndex = 156;
progressBar1.Value = 25;
//
// userControl1
//
userControl1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
userControl1.BackColor = Color.Transparent;
userControl1.Controls.Add(progressBar1);
userControl1.EnableMovable = false;
userControl1.Location = new Point(10, 64);
userControl1.Name = "userControl1";
userControl1.Size = new Size(424, 24);
userControl1.TabIndex = 157;
//
// label1
//
label1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
label1.AutoEllipsis = true;
label1.Location = new Point(10, 20);
label1.Name = "label1";
label1.Size = new Size(424, 15);
label1.TabIndex = 159;
//
// label2
//
label2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
label2.AutoEllipsis = true;
label2.Location = new Point(10, 40);
label2.Name = "label2";
label2.Size = new Size(424, 15);
label2.TabIndex = 160;
//
// ClearIconsForm
//
BackColor = Color.White;
ClientSize = new Size(444, 117);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(userControl1);
Name = "ClearIconsForm";
Text = "Clear Icons";
userControl1.ResumeLayout(false);
ResumeLayout(false);
}
protected async override void OnShown(EventArgs e)
{
base.OnShown(e);
await Task.Run(async () =>
{
this.Clear();
var model = _treeView.ToNodeList<App6Options.Item>();
// Update progress bars
progressBar1.Maximum = model.Count;
progressBar1.Value = 0;
UIControl.SetText(label1, "Deleting...");
UIControl.SetText(label2, "");
foreach (var item in model)
{
UIControl.SetText(label2, "... " + item.Value.Title);
progressBar1.Value++;
if (item.Value.Icon == null)
{
continue;
}
var newModel = item.Value;
newModel.Icon = null;
_treeView.UpdateNode(item.Key, newModel);
}
_treeView.Clear(false, true);
UIControl.SetText(label1, "");
UIControl.SetText(label2, "Done");
});
this.DialogResult = DialogResult.OK;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
base.OnFormClosing(e);
if (this.DialogResult != DialogResult.OK)
{
e.Cancel = true;
}
}
public void Clear()
{
UIControl.SetText(label1, "Ready");
UIControl.SetText(label2, "");
progressBar1.Value = progressBar1.Maximum = 0;
}
}
}

View File

@ -3,39 +3,37 @@ using System.ComponentModel;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using BookmarkManager.Services;
using bzit.bomg.Models;
using BukkuBuddy.DTOs.SaveFile;
using BukkuBuddy.Services;
using RyzStudio;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
namespace FizzyLauncher
namespace BukkuBuddy.Forms
{
public class EditBookmarkForm : Form
{
private System.Windows.Forms.Label label1;
private Label label1;
private ThClearableTextBox textBox1;
private Label label2;
private Label label3;
private ThToolbarMemoBox memoBox1;
private Label label4;
private ThHiButtonTextBox textBox2;
private ThIconButtonTextBox textBox2;
private PictureBox pictureBox1;
private ToolTip toolTip1;
private System.ComponentModel.IContainer components;
private ThClearableTextBox textBox3;
private ThUserControl thUserControl1;
private readonly WebProvider _webProvider;
private BookmarkModel result = null;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private THorizontalSeparator tHorizontalSeparator1;
private bool _isBusy = false;
private THorizontalSeparator horizontalSeparator1;
private readonly WebPageService _webPageService;
private bool isBusy = false;
private App6Options.Item result = null;
public EditBookmarkForm(BookmarkModel model = null)
public EditBookmarkForm(App6Options.Item model, App6Options options)
{
InitializeComponent();
@ -45,34 +43,7 @@ namespace FizzyLauncher
result = model;
_webProvider = new WebProvider();
_webProvider.IgnoreSSL = true;
if (result != null)
{
textBox1.Text = model.Title?.Trim() ?? string.Empty;
textBox2.Text = model.Address?.Trim() ?? string.Empty;
textBox3.Text = model.Description?.Trim() ?? string.Empty;
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)
{
pictureBox1.Image = model.Icon = null;
}
memoBox1.Text = model.Notes?.Trim() ?? string.Empty;
}
_webPageService = new WebPageService(options.AllowUnsafeSSL, options.Timeout, options.AllowCookies, options.AllowRedirects);
}
private void InitializeComponent()
@ -84,12 +55,11 @@ namespace FizzyLauncher
label3 = new Label();
memoBox1 = new ThToolbarMemoBox();
label4 = new Label();
textBox2 = new ThHiButtonTextBox();
textBox2 = new ThIconButtonTextBox();
pictureBox1 = new PictureBox();
toolTip1 = new ToolTip(components);
textBox3 = new ThClearableTextBox();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
tHorizontalSeparator1 = new THorizontalSeparator();
horizontalSeparator1 = new THorizontalSeparator();
((ISupportInitialize)pictureBox1).BeginInit();
SuspendLayout();
//
@ -98,7 +68,7 @@ namespace FizzyLauncher
label1.AutoSize = true;
label1.BackColor = Color.Transparent;
label1.ForeColor = SystemColors.ControlText;
label1.Location = new Point(9, 21);
label1.Location = new Point(10, 20);
label1.Margin = new Padding(0);
label1.Name = "label1";
label1.Padding = new Padding(0, 8, 0, 0);
@ -112,14 +82,12 @@ namespace FizzyLauncher
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = Color.Transparent;
textBox1.ClearedValue = "";
textBox1.EnableReactiveVisual = true;
textBox1.Font = new Font("Segoe UI", 9F);
textBox1.EnableMovable = false;
textBox1.Icon = "O";
textBox1.IconSize = 13F;
textBox1.Location = new Point(115, 20);
textBox1.Location = new Point(95, 20);
textBox1.Name = "textBox1";
textBox1.Padding = new Padding(4, 4, 3, 3);
textBox1.Size = new Size(314, 32);
textBox1.Size = new Size(280, 32);
textBox1.TabIndex = 0;
textBox1.TabStop = false;
textBox1.UseSystemPasswordChar = false;
@ -154,18 +122,15 @@ namespace FizzyLauncher
//
// memoBox1
//
memoBox1.AllowDrop = true;
memoBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
memoBox1.BackColor = Color.Transparent;
memoBox1.ClearedValue = "";
memoBox1.EnableReactiveVisual = true;
memoBox1.Font = new Font("Segoe UI", 9F);
memoBox1.Location = new Point(87, 166);
memoBox1.EnableMovable = false;
memoBox1.Location = new Point(95, 158);
memoBox1.Name = "memoBox1";
memoBox1.Padding = new Padding(4, 4, 3, 3);
memoBox1.ReadOnly = false;
memoBox1.ScrollBars = ScrollBars.Vertical;
memoBox1.Size = new Size(342, 302);
memoBox1.Size = new Size(280, 283);
memoBox1.TabIndex = 3;
memoBox1.TabStop = false;
memoBox1.WordWrap = false;
@ -175,7 +140,7 @@ namespace FizzyLauncher
label4.AutoSize = true;
label4.BackColor = Color.Transparent;
label4.ForeColor = SystemColors.ControlText;
label4.Location = new Point(9, 166);
label4.Location = new Point(10, 158);
label4.Margin = new Padding(0);
label4.Name = "label4";
label4.Padding = new Padding(0, 8, 0, 0);
@ -188,14 +153,12 @@ namespace FizzyLauncher
//
textBox2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox2.BackColor = Color.Transparent;
textBox2.EnableReactiveVisual = true;
textBox2.Font = new Font("Segoe UI", 9F);
textBox2.EnableMovable = false;
textBox2.Icon = "M";
textBox2.IconSize = 13F;
textBox2.Location = new Point(98, 62);
textBox2.Location = new Point(115, 62);
textBox2.Name = "textBox2";
textBox2.Padding = new Padding(4, 4, 3, 3);
textBox2.Size = new Size(331, 32);
textBox2.Size = new Size(260, 32);
textBox2.TabIndex = 1;
textBox2.TabStop = false;
textBox2.UseSystemPasswordChar = false;
@ -206,7 +169,7 @@ namespace FizzyLauncher
pictureBox1.BackColor = Color.White;
pictureBox1.ErrorImage = null;
pictureBox1.InitialImage = null;
pictureBox1.Location = new Point(78, 20);
pictureBox1.Location = new Point(61, 20);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(32, 32);
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
@ -220,14 +183,12 @@ namespace FizzyLauncher
textBox3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox3.BackColor = Color.Transparent;
textBox3.ClearedValue = "";
textBox3.EnableReactiveVisual = true;
textBox3.Font = new Font("Segoe UI", 9F);
textBox3.EnableMovable = false;
textBox3.Icon = "O";
textBox3.IconSize = 13F;
textBox3.Location = new Point(116, 104);
textBox3.Location = new Point(115, 104);
textBox3.Name = "textBox3";
textBox3.Padding = new Padding(4, 4, 3, 3);
textBox3.Size = new Size(313, 32);
textBox3.Size = new Size(260, 32);
textBox3.TabIndex = 203;
textBox3.TabStop = false;
textBox3.UseSystemPasswordChar = false;
@ -235,34 +196,29 @@ namespace FizzyLauncher
// dialogFooter1
//
dialogFooter1.BackColor = Color.FromArgb(240, 240, 240);
dialogFooter1.Button1Text = "&OK";
dialogFooter1.Dialog = this;
dialogFooter1.Dock = DockStyle.Bottom;
dialogFooter1.EnableMovable = false;
dialogFooter1.IsBusy = false;
dialogFooter1.Location = new Point(0, 477);
dialogFooter1.Location = new Point(0, 451);
dialogFooter1.Name = "dialogFooter1";
dialogFooter1.Size = new Size(444, 84);
dialogFooter1.Size = new Size(384, 70);
dialogFooter1.TabIndex = 210;
dialogFooter1.TabStop = false;
//
// tHorizontalSeparator1
// horizontalSeparator1
//
tHorizontalSeparator1.AutoScrollMargin = new Size(0, 0);
tHorizontalSeparator1.AutoScrollMinSize = new Size(0, 0);
tHorizontalSeparator1.BackColor = Color.Transparent;
tHorizontalSeparator1.Location = new Point(9, 139);
tHorizontalSeparator1.MaximumSize = new Size(3840, 22);
tHorizontalSeparator1.MinimumSize = new Size(0, 22);
tHorizontalSeparator1.Name = "tHorizontalSeparator1";
tHorizontalSeparator1.Size = new Size(423, 22);
tHorizontalSeparator1.TabIndex = 209;
tHorizontalSeparator1.TabStop = false;
horizontalSeparator1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
horizontalSeparator1.Location = new Point(5, 141);
horizontalSeparator1.Name = "horizontalSeparator1";
horizontalSeparator1.Size = new Size(375, 10);
//
// EditBookmarkForm
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = Color.White;
ClientSize = new Size(444, 561);
Controls.Add(tHorizontalSeparator1);
ClientSize = new Size(384, 521);
Controls.Add(horizontalSeparator1);
Controls.Add(pictureBox1);
Controls.Add(dialogFooter1);
Controls.Add(textBox3);
@ -274,7 +230,7 @@ namespace FizzyLauncher
Controls.Add(textBox1);
Controls.Add(label1);
KeyPreview = true;
MinimumSize = new Size(460, 600);
MinimumSize = new Size(400, 560);
Name = "EditBookmarkForm";
Text = "Edit Bookmark";
((ISupportInitialize)pictureBox1).EndInit();
@ -286,12 +242,37 @@ namespace FizzyLauncher
{
base.OnShown(e);
textBox1.Text = result?.Title?.Trim() ?? string.Empty;
textBox2.Text = result?.Address?.Trim() ?? string.Empty;
textBox3.Text = result?.Description?.Trim() ?? string.Empty;
memoBox1.Text = result?.Notes?.Trim() ?? string.Empty;
if (result != null)
{
try
{
if (result.Icon != null)
{
if (result.Icon.Width > 16)
{
result.Icon = RyzStudio.Drawing.ImageEditor.Resize(result.Icon, 16, 16);
}
}
pictureBox1.Image = result.Icon;
}
catch (Exception)
{
pictureBox1.Image = result.Icon = null;
}
}
textBox2.Focus();
}
protected override void OnClosing(CancelEventArgs e)
protected override void OnFormClosing(FormClosingEventArgs e)
{
base.OnClosing(e);
base.OnFormClosing(e);
if (this.IsBusy)
{
@ -299,13 +280,14 @@ namespace FizzyLauncher
}
}
public BookmarkModel Result
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public App6Options.Item Result
{
get
{
if (result == null)
{
result = new BookmarkModel();
result = new App6Options.Item();
}
result.Title = textBox1.Text?.Trim() ?? string.Empty;
@ -329,50 +311,90 @@ namespace FizzyLauncher
protected bool IsBusy
{
get => _isBusy;
get => isBusy;
set
{
_isBusy = value;
isBusy = value;
UIControl.SetEnable(textBox1, !this.IsBusy);
UIControl.SetEnable(textBox2, !this.IsBusy);
UIControl.SetEnable(textBox3, !this.IsBusy);
dialogFooter1.IsBusy = _isBusy;
UIControl.SetEnable(memoBox1, !this.IsBusy);
UIControl.SetEnable(textBox1, !isBusy);
UIControl.SetEnable(textBox2, !isBusy);
UIControl.SetEnable(textBox3, !isBusy);
UIControl.SetEnable(memoBox1, !isBusy);
dialogFooter1.IsBusy = isBusy;
}
}
private async void textBox2_OnButtonClick(object sender, EventArgs e)
{
await InvalidateWebPage(textBox2.Text, true, true, true);
textBox2.Focus();
}
/// <summary>
/// Retrieve favicon
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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))
if (this.IsBusy)
{
return;
}
if (e.Button == MouseButtons.Left)
{
if (string.IsNullOrWhiteSpace(textBox2.Text))
{
return;
}
DialogResult result = DialogResult.Yes;
if (pictureBox1.Image != null)
{
result = MessageBox.Show("Do you want to (try to) retrieve the favicon?", "Retrieve Favicon", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
}
if (result == DialogResult.Yes)
{
await Task.Run(async () =>
{
this.IsBusy = true;
var image = await GetFavicon(textBox2.Text);
UIControl.SetImage(pictureBox1, image);
this.IsBusy = false;
});
}
}
}
/// <summary>
/// Clear favicon
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
if (this.IsBusy)
{
return;
}
if (e.Button == MouseButtons.Right)
{
if (pictureBox1.Image == null)
{
return;
}
//if (MessageBox.Show("Are you sure you want to clear the favicon?", "Clear Favicon", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
//{
pictureBox1.Image = null;
//}
}
}
private async void textBox2_OnButtonClick(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
@ -380,48 +402,110 @@ namespace FizzyLauncher
this.IsBusy = true;
if (!url.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) && !url.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
await Task.Run(async () =>
{
url = "http://" + url;
}
var document = await _webProvider.RetrieveHtmlDocument(url);
if (document == null)
{
this.IsBusy = false;
return;
}
if (updateTitle)
{
textBox1.Text = _webProvider.ParseTitle(document);
}
if (updateDescription)
{
textBox3.Text = _webProvider.ParseDescription(document);
}
if (updateIcon)
{
try
var result = await UpdateBookmarkInfo(textBox2.Text);
if (!result.Success)
{
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);
}
}
MessageBox.Show(result.Message, "Update Bookmark", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception)
{
pictureBox1.Image = null;
}
}
});
this.IsBusy = false;
textBox2.Focus();
}
private async Task<Image> GetFavicon(string url)
{
if (!_webPageService.IsValidUrl(url))
{
return null;
}
HtmlAgilityPack.HtmlDocument htmlDocument = null;
try
{
htmlDocument = await _webPageService.GetDocument(url);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, "Update Icon", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
if (htmlDocument == null)
{
return null;
}
var faviconUrl = _webPageService.ParseFavicon(htmlDocument);
if (string.IsNullOrWhiteSpace(faviconUrl))
{
return null;
}
var favicon = await _webPageService.GetImage(faviconUrl);
if (favicon != null)
{
if (favicon.Width > 16)
{
favicon = RyzStudio.Drawing.ImageEditor.Resize(favicon, 16, 16);
}
}
return favicon;
}
private async Task<MethodResult> UpdateBookmarkInfo(string url)
{
if (!_webPageService.IsValidUrl(url))
{
return MethodResult.Error("Invalid URL.");
}
HtmlAgilityPack.HtmlDocument htmlDocument = null;
try
{
htmlDocument = await _webPageService.GetDocument(url);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, "Update Icon", MessageBoxButtons.OK, MessageBoxIcon.Error);
return MethodResult.Error(exc.Message);
}
if (htmlDocument == null)
{
return null;
}
var title = _webPageService.ParseTitle(htmlDocument) ?? string.Empty;
var description = _webPageService.ParseDescription(htmlDocument) ?? string.Empty;
UIControl.SetText(textBox1, title);
UIControl.SetText(textBox3, description);
var faviconUrl = _webPageService.ParseFavicon(htmlDocument);
if (!string.IsNullOrWhiteSpace(faviconUrl))
{
var favicon = await _webPageService.GetImage(faviconUrl);
if (favicon != null)
{
if (favicon.Width > 16)
{
favicon = RyzStudio.Drawing.ImageEditor.Resize(favicon, 16, 16);
}
}
UIControl.SetImage(pictureBox1, favicon);
}
return MethodResult.Create();
}
}

282
Forms/FindForm.cs Normal file
View File

@ -0,0 +1,282 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using BukkuBuddy.DTOs.SaveFile;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
namespace BukkuBuddy.Forms
{
public class FindForm : Form
{
private Label label1;
private ThButton button2;
private THorizontalSeparator horizontalSeparator1;
private ThButton button1;
private ThClearableTextBox textBox1;
private BookmarkTreeView treeView1 = null;
private int findPosition = -1;
public FindForm(BookmarkTreeView treeView)
{
InitializeComponent();
this.MinimizeBox = false;
this.MaximizeBox = false;
this.ShowIcon = false;
this.ShowInTaskbar = true;
treeView1 = treeView;
textBox1.PreviewKeyDown += textBox1_PreviewKeyDown;
}
private void InitializeComponent()
{
label1 = new Label();
button2 = new ThButton();
horizontalSeparator1 = new THorizontalSeparator();
textBox1 = new ThClearableTextBox();
button1 = new ThButton();
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, 9, 0, 10);
label1.Size = new System.Drawing.Size(30, 34);
label1.TabIndex = 153;
label1.Text = "Find";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// button2
//
button2.ActiveImage = null;
button2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
button2.BackColor = System.Drawing.Color.Transparent;
button2.EnableMenuOnClick = false;
button2.EnableMovable = false;
button2.HoverImage = null;
button2.IdleImage = null;
//
//
//
button2.Label.BackColor = System.Drawing.Color.White;
button2.Label.Dock = DockStyle.Fill;
button2.Label.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
button2.Label.ForeColor = System.Drawing.Color.FromArgb(126, 54, 244);
button2.Label.Location = new System.Drawing.Point(4, 4);
button2.Label.Margin = new Padding(0);
button2.Label.Name = "label1";
button2.Label.Size = new System.Drawing.Size(121, 25);
button2.Label.TabIndex = 0;
button2.Label.Text = "&Next";
button2.Label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
button2.LabelText = "&Next";
button2.Location = new System.Drawing.Point(246, 94);
button2.Name = "button2";
button2.Size = new System.Drawing.Size(128, 32);
button2.TabIndex = 2;
button2.TabStop = false;
button2.MouseClick += button2_MouseClick;
button2.MouseDoubleClick += button2_MouseClick;
//
// horizontalSeparator1
//
horizontalSeparator1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
horizontalSeparator1.Location = new System.Drawing.Point(5, 73);
horizontalSeparator1.Name = "horizontalSeparator1";
horizontalSeparator1.Padding = new Padding(0, 10, 0, 10);
horizontalSeparator1.Size = new System.Drawing.Size(375, 10);
//
// textBox1
//
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = System.Drawing.Color.Transparent;
textBox1.ClearedValue = "";
textBox1.EnableMovable = false;
textBox1.Icon = "O";
textBox1.IconSize = 13F;
textBox1.Location = new System.Drawing.Point(95, 20);
textBox1.Name = "textBox1";
textBox1.Size = new System.Drawing.Size(280, 32);
textBox1.TabIndex = 0;
textBox1.TabStop = false;
textBox1.UseSystemPasswordChar = false;
//
// button1
//
button1.ActiveImage = null;
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
button1.BackColor = System.Drawing.Color.Transparent;
button1.EnableMenuOnClick = false;
button1.EnableMovable = false;
button1.HoverImage = null;
button1.IdleImage = null;
//
//
//
button1.Label.BackColor = System.Drawing.Color.White;
button1.Label.Dock = DockStyle.Fill;
button1.Label.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
button1.Label.ForeColor = System.Drawing.Color.FromArgb(126, 54, 244);
button1.Label.Location = new System.Drawing.Point(4, 4);
button1.Label.Margin = new Padding(0);
button1.Label.Name = "label1";
button1.Label.Size = new System.Drawing.Size(121, 25);
button1.Label.TabIndex = 0;
button1.Label.Text = "&First";
button1.Label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
button1.LabelText = "&First";
button1.Location = new System.Drawing.Point(110, 94);
button1.Name = "button1";
button1.Size = new System.Drawing.Size(128, 32);
button1.TabIndex = 1;
button1.TabStop = false;
button1.MouseClick += button1_MouseClick;
button1.MouseDoubleClick += button1_MouseClick;
//
// FindForm
//
AutoScaleMode = AutoScaleMode.None;
ClientSize = new System.Drawing.Size(384, 141);
Controls.Add(button1);
Controls.Add(textBox1);
Controls.Add(horizontalSeparator1);
Controls.Add(button2);
Controls.Add(label1);
MinimumSize = new System.Drawing.Size(400, 168);
Name = "FindForm";
Text = "Find";
ResumeLayout(false);
PerformLayout();
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
textBox1.Focus();
}
private void textBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Enter:
if (findPosition < 0)
{
button1_MouseClick(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
else
{
button2_MouseClick(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
break;
case Keys.Escape:
this.Close();
break;
default:
break;
}
}
/// <summary>
/// Find first.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
return;
}
if (treeView1.Nodes.Count <= 0)
{
return;
}
findPosition = -1;
var nodeList = treeView1.ToNodeList<App6Options.Item>();
var node = nodeList.Where(x => x.Value.Title.Contains(textBox1.Text?.Trim())).Select(x => x.Key).FirstOrDefault();
if (node != null)
{
findPosition = 0;
treeView1.SelectedNode = node;
treeView1.SelectedNode.EnsureVisible();
}
}
}
/// <summary>
/// Find next.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
return;
}
if (treeView1.Nodes.Count <= 0)
{
return;
}
if (treeView1.SelectedNode == null)
{
treeView1.SelectedNode = treeView1.Nodes[0];
}
var nodeList = treeView1.ToNodeList<App6Options.Item>();
var node = nodeList.Where(x => x.Value.Title.Contains(textBox1.Text?.Trim())).Select(x => x.Key)?.ToList() ?? new List<TreeNode>();
if (node != null)
{
//var pos = nodeList.FindIndex(x => x.Key == treeView1.SelectedNode);
//if (pos < 0)
//{
// findPosition = -1;
//} else {
// findPosition = pos;
//}
findPosition++;
if (findPosition >= node.Count)
{
findPosition = 0;
}
treeView1.SelectedNode = node[findPosition];
treeView1.SelectedNode.EnsureVisible();
}
}
}
}
}

360
Forms/LoadingForm.cs Normal file
View File

@ -0,0 +1,360 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Threading.Tasks;
using System.Windows.Forms;
using BukkuBuddy.DTOs.SaveFile;
using RyzStudio.Windows.Forms;
using static RyzStudio.Windows.Forms.BookmarkTreeView;
namespace BukkuBuddy.Forms
{
public class LoadingForm : Form
{
private TProgressBar progressBar1;
private RyzStudio.Windows.ThemedForms.ThUserControl userControl1;
private RyzStudio.Windows.ThemedForms.ThUserControl userControl2;
private TProgressBar progressBar2;
private Label label1;
private Label label2;
private App6Options result = null;
private string loadFilename = "";
private BookmarkTreeView treeView = null;
public LoadingForm()
{
InitializeComponent();
UISetup.Dialog(this, true);
this.Text = "Loading";
}
private void InitializeComponent()
{
progressBar1 = new TProgressBar();
userControl1 = new RyzStudio.Windows.ThemedForms.ThUserControl();
userControl2 = new RyzStudio.Windows.ThemedForms.ThUserControl();
progressBar2 = new TProgressBar();
label1 = new Label();
label2 = new Label();
userControl1.SuspendLayout();
userControl2.SuspendLayout();
SuspendLayout();
//
// progressBar1
//
progressBar1.BarColour = Color.FromArgb(191, 102, 243);
progressBar1.Dock = DockStyle.Fill;
progressBar1.EnableMovable = false;
progressBar1.Location = new Point(3, 3);
progressBar1.Maximum = 100;
progressBar1.Minimum = 0;
progressBar1.Name = "progressBar1";
progressBar1.OnProgressChanged = null;
progressBar1.ShowText = true;
progressBar1.Size = new Size(418, 18);
progressBar1.TabIndex = 156;
progressBar1.Value = 25;
//
// userControl1
//
userControl1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
userControl1.BackColor = Color.Transparent;
userControl1.Controls.Add(progressBar1);
userControl1.EnableMovable = false;
userControl1.Location = new Point(10, 64);
userControl1.Name = "userControl1";
userControl1.Size = new Size(424, 24);
userControl1.TabIndex = 157;
//
// userControl2
//
userControl2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
userControl2.BackColor = Color.Transparent;
userControl2.Controls.Add(progressBar2);
userControl2.EnableMovable = false;
userControl2.Location = new Point(10, 98);
userControl2.Name = "userControl2";
userControl2.Size = new Size(424, 24);
userControl2.TabIndex = 158;
//
// progressBar2
//
progressBar2.BarColour = Color.FromArgb(25, 104, 218);
progressBar2.Dock = DockStyle.Fill;
progressBar2.EnableMovable = false;
progressBar2.Location = new Point(3, 3);
progressBar2.Maximum = 100;
progressBar2.Minimum = 0;
progressBar2.Name = "progressBar2";
progressBar2.OnProgressChanged = null;
progressBar2.ShowText = true;
progressBar2.Size = new Size(418, 18);
progressBar2.TabIndex = 156;
progressBar2.Value = 25;
//
// label1
//
label1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
label1.AutoEllipsis = true;
label1.Location = new Point(10, 20);
label1.Name = "label1";
label1.Size = new Size(424, 15);
label1.TabIndex = 159;
//
// label2
//
label2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
label2.AutoEllipsis = true;
label2.Location = new Point(10, 40);
label2.Name = "label2";
label2.Size = new Size(424, 15);
label2.TabIndex = 160;
//
// LoadingForm
//
BackColor = Color.White;
ClientSize = new Size(444, 141);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(userControl2);
Controls.Add(userControl1);
Name = "LoadingForm";
Text = "Edit Section";
userControl1.ResumeLayout(false);
userControl2.ResumeLayout(false);
ResumeLayout(false);
}
protected async override void OnShown(EventArgs e)
{
base.OnShown(e);
await Task.Run(async () =>
{
this.Clear();
UIControl.SetText(label1, "Loading...");
UIControl.SetText(label2, "... " + Path.GetFileName(loadFilename));
var newSession = await LoadSaveSessionWithVersion(loadFilename);
var isPack = Path.GetExtension(loadFilename).Equals(".jsnx", StringComparison.CurrentCultureIgnoreCase);
// Update progress bars
progressBar1.Maximum = newSession.Directories?.Count ?? 0;
progressBar2.Maximum = newSession.Items?.Count ?? 0;
progressBar1.Value = 0;
progressBar2.Value = 0;
UIControl.SetText(label1, "Loading...");
UIControl.SetText(label2, "");
foreach (var item in newSession?.Directories ?? new List<string>())
{
if (string.IsNullOrWhiteSpace(item))
{
continue;
}
UIControl.SetText(label2, "... " + Path.GetFileNameWithoutExtension(item));
progressBar1.Value++;
treeView.CreateNodePath(item, (int)NodeIcon.Folder1, (int)NodeIcon.Folder2);
}
foreach (var item in newSession?.Items ?? new List<App6Options.Item>())
{
UIControl.SetText(label2, "... " + item.Title);
progressBar2.Value++;
// Load extra data from archive file
if (isPack)
{
item.Icon = await LoadIconFromFile(loadFilename, item);
}
treeView.AddNode(item);
}
if (treeView.Nodes.Count >= 0)
{
UIControl.Invoke(treeView, (x) =>
{
treeView.Nodes[0].Expand();
treeView.SelectedNode = treeView.Nodes[0];
});
}
result = newSession;
UIControl.SetText(label1, "");
UIControl.SetText(label2, "Done");
});
this.DialogResult = DialogResult.OK;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
base.OnFormClosing(e);
if (this.DialogResult != DialogResult.OK)
{
e.Cancel = true;
}
}
public App6Options Result
{
get => result ?? new App6Options();
}
public async Task<DialogResult> ShowDialog(string filename, BookmarkTreeView control)
{
loadFilename = filename;
treeView = control;
return this.ShowDialog();
}
public void Clear()
{
UIControl.SetText(label1, "Ready");
UIControl.SetText(label2, "");
progressBar1.Value = progressBar1.Maximum = 0;
progressBar2.Value = progressBar2.Maximum = 0;
treeView.Clear(true, true, "New Session");
}
private async Task<App6Options> LoadSaveSessionWithVersion(string filename)
{
var result = new App6Options();
if (string.IsNullOrWhiteSpace(filename))
{
return result;
}
var fileExtension = Path.GetExtension(filename?.ToLower()?.Trim() ?? string.Empty);
if (string.IsNullOrWhiteSpace(fileExtension))
{
return result;
}
// Load session, assume version 3.
App6Options loadSession = null;
switch (fileExtension)
{
case ".json":
case ".jsonfig":
loadSession = await RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<App6Options>(filename);
if (loadSession == null)
{
loadSession = await LoadFileR4(filename);
}
break;
case ".jsnx":
loadSession = await RyzStudio.IO.Compression.ZFile.ReadFile<App6Options>(filename, "Document.json");
break;
default:
break;
}
if (loadSession == null)
{
return result;
}
// File likely not correct schema.
if (loadSession.FileVersion <= 0)
{
return result;
}
result = loadSession;
return result;
}
private async Task<App6Options> LoadFileR4(string filename)
{
var session = await RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<List<App4Options.Item>>(filename);
if (session == null)
{
return null;
}
var result = new App6Options();
result.Items = new List<App6Options.Item>();
foreach (var item in session)
{
result.Items.Add(new App6Options.Item()
{
Title = item.SiteName,
Address = item.SiteAddress,
Description = item.SiteDescription,
Notes = item.Notes,
Path = item.Path
});
}
return result;
}
private async Task<Image> LoadIconFromFile(string filename, App6Options.Item item)
{
if (item == null)
{
return null;
}
if (item.Id == Guid.Empty)
{
return null;
}
return await Task.Run(() =>
{
try
{
using (var archive = ZipFile.Open(filename, ZipArchiveMode.Read))
{
var key = "icon\\" + item.Id.ToString() + ".png";
var zipEntry = archive.GetEntry(key);
if (zipEntry == null)
{
return null;
}
using (Stream entryStream = zipEntry.Open())
{
return Image.FromStream(entryStream);
}
}
}
catch (Exception)
{
return null;
}
});
}
}
}

120
Forms/LoadingForm.resx Normal file
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>

410
Forms/OptionsForm.cs Normal file
View File

@ -0,0 +1,410 @@
using System;
using System.Windows.Forms;
using BukkuBuddy.DTOs.SaveFile;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms.PickerBox;
namespace BukkuBuddy.Forms
{
public class OptionsForm : Form
{
private ThYesNoPickerBox pickerBox1;
private Label label2;
private Label label1;
private ThYesNoPickerBox pickerBox2;
private Label label3;
private RyzStudio.Windows.ThemedForms.ButtonTextBox.ThClearableTextBox textBox1;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private FlowLayoutPanel flowLayoutPanel1;
private TTogglePanel togglePanel1;
private TTogglePanel togglePanel2;
private Label label4;
private ThYesNoPickerBox pickerBox3;
private TTogglePanel togglePanel3;
private Label label5;
private RyzStudio.Windows.ThemedForms.ThNumericBox numericBox1;
private Label label6;
private ThYesNoPickerBox pickerBox4;
private Label label7;
private ThYesNoPickerBox pickerBox5;
private App6Options _appSession = null;
public OptionsForm(App6Options appSession)
{
InitializeComponent();
UISetup.Dialog(this, true);
UISetup.AutoSizeChildren(flowLayoutPanel1);
_appSession = appSession;
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
pickerBox1.Value = _appSession?.RestorePosition ?? true;
textBox1.Text = _appSession.RunCommand ?? string.Empty;
pickerBox2.Value = _appSession?.AlwaysOnTop ?? false;
pickerBox3.Value = _appSession?.AllowUnsafeSSL ?? false;
numericBox1.Value = _appSession?.Timeout ?? 0;
pickerBox4.Value = _appSession?.AllowCookies ?? false;
pickerBox5.Value = _appSession?.AllowRedirects ?? false;
}
private void InitializeComponent()
{
pickerBox1 = new ThYesNoPickerBox();
label2 = new Label();
pickerBox2 = new ThYesNoPickerBox();
label1 = new Label();
textBox1 = new RyzStudio.Windows.ThemedForms.ButtonTextBox.ThClearableTextBox();
label3 = new Label();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
flowLayoutPanel1 = new FlowLayoutPanel();
togglePanel1 = new TTogglePanel();
togglePanel2 = new TTogglePanel();
togglePanel3 = new TTogglePanel();
label6 = new Label();
pickerBox4 = new ThYesNoPickerBox();
numericBox1 = new RyzStudio.Windows.ThemedForms.ThNumericBox();
label4 = new Label();
label5 = new Label();
pickerBox3 = new ThYesNoPickerBox();
label7 = new Label();
pickerBox5 = new ThYesNoPickerBox();
flowLayoutPanel1.SuspendLayout();
togglePanel1.SuspendLayout();
togglePanel2.SuspendLayout();
togglePanel3.SuspendLayout();
SuspendLayout();
//
// pickerBox1
//
pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox1.BackColor = System.Drawing.Color.Transparent;
pickerBox1.EnableMovable = false;
pickerBox1.Location = new System.Drawing.Point(311, 22);
pickerBox1.Name = "pickerBox1";
pickerBox1.SelectedIndex = 1;
pickerBox1.Size = new System.Drawing.Size(80, 32);
pickerBox1.TabIndex = 197;
pickerBox1.TabStop = false;
pickerBox1.Value = true;
//
// label2
//
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent;
label2.ForeColor = System.Drawing.SystemColors.ControlText;
label2.Location = new System.Drawing.Point(1, 22);
label2.Margin = new Padding(0);
label2.Name = "label2";
label2.Padding = new Padding(0, 8, 0, 0);
label2.Size = new System.Drawing.Size(92, 23);
label2.TabIndex = 196;
label2.Text = "Restore Position";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox2
//
pickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox2.BackColor = System.Drawing.Color.Transparent;
pickerBox2.EnableMovable = false;
pickerBox2.Location = new System.Drawing.Point(311, 64);
pickerBox2.Name = "pickerBox2";
pickerBox2.SelectedIndex = 1;
pickerBox2.Size = new System.Drawing.Size(80, 32);
pickerBox2.TabIndex = 198;
pickerBox2.TabStop = false;
pickerBox2.Value = true;
//
// label1
//
label1.AutoSize = true;
label1.BackColor = System.Drawing.Color.Transparent;
label1.ForeColor = System.Drawing.SystemColors.ControlText;
label1.Location = new System.Drawing.Point(1, 64);
label1.Margin = new Padding(0);
label1.Name = "label1";
label1.Padding = new Padding(0, 8, 0, 0);
label1.Size = new System.Drawing.Size(85, 23);
label1.TabIndex = 196;
label1.Text = "Always On Top";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// textBox1
//
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = System.Drawing.Color.Transparent;
textBox1.ClearedValue = "{0}";
textBox1.EnableMovable = false;
textBox1.Icon = "O";
textBox1.IconSize = 13F;
textBox1.Location = new System.Drawing.Point(131, 22);
textBox1.Name = "textBox1";
textBox1.Size = new System.Drawing.Size(260, 32);
textBox1.TabIndex = 203;
textBox1.TabStop = false;
textBox1.UseSystemPasswordChar = false;
//
// label3
//
label3.AutoSize = true;
label3.BackColor = System.Drawing.Color.Transparent;
label3.ForeColor = System.Drawing.SystemColors.ControlText;
label3.Location = new System.Drawing.Point(1, 22);
label3.Margin = new Padding(0);
label3.Name = "label3";
label3.Padding = new Padding(0, 8, 0, 0);
label3.Size = new System.Drawing.Size(88, 23);
label3.TabIndex = 199;
label3.Text = "Run Command";
label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// dialogFooter1
//
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
dialogFooter1.Dock = DockStyle.Bottom;
dialogFooter1.EnableMovable = false;
dialogFooter1.IsBusy = false;
dialogFooter1.Location = new System.Drawing.Point(0, 491);
dialogFooter1.Name = "dialogFooter1";
dialogFooter1.Size = new System.Drawing.Size(444, 70);
dialogFooter1.TabIndex = 196;
dialogFooter1.TabStop = false;
//
// flowLayoutContainer1
//
flowLayoutPanel1.AutoScroll = true;
flowLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
flowLayoutPanel1.Controls.Add(togglePanel1);
flowLayoutPanel1.Controls.Add(togglePanel2);
flowLayoutPanel1.Controls.Add(togglePanel3);
flowLayoutPanel1.Dock = DockStyle.Fill;
flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
flowLayoutPanel1.Name = "flowLayoutContainer1";
flowLayoutPanel1.Padding = new Padding(10, 10, 10, 30);
flowLayoutPanel1.Size = new System.Drawing.Size(444, 491);
flowLayoutPanel1.TabIndex = 195;
//
// togglePanel1
//
togglePanel1.BackColor = System.Drawing.Color.FromArgb(252, 252, 252);
togglePanel1.CloseIcon = "H";
togglePanel1.Controls.Add(label2);
togglePanel1.Controls.Add(pickerBox1);
togglePanel1.EnableMovable = false;
togglePanel1.ExpandedHeight = 64;
togglePanel1.HeaderPadding = new Padding(4, 0, 0, 2);
togglePanel1.IconWidth = 20;
togglePanel1.Location = new System.Drawing.Point(10, 10);
togglePanel1.Name = "togglePanel1";
togglePanel1.OpenIcon = "G";
togglePanel1.Size = new System.Drawing.Size(401, 64);
togglePanel1.TabIndex = 0;
togglePanel1.Title = "Start-Up";
togglePanel1.TitleContextMenuStrip = null;
togglePanel1.TitleCursor = Cursors.Default;
//
// togglePanel2
//
togglePanel2.BackColor = System.Drawing.Color.FromArgb(252, 252, 252);
togglePanel2.CloseIcon = "H";
togglePanel2.Controls.Add(textBox1);
togglePanel2.Controls.Add(label3);
togglePanel2.Controls.Add(label1);
togglePanel2.Controls.Add(pickerBox2);
togglePanel2.EnableMovable = false;
togglePanel2.ExpandedHeight = 103;
togglePanel2.HeaderPadding = new Padding(4, 0, 0, 2);
togglePanel2.IconWidth = 20;
togglePanel2.Location = new System.Drawing.Point(10, 84);
togglePanel2.Name = "togglePanel2";
togglePanel2.OpenIcon = "G";
togglePanel2.Size = new System.Drawing.Size(401, 103);
togglePanel2.TabIndex = 1;
togglePanel2.Title = "Behaviour";
togglePanel2.TitleContextMenuStrip = null;
togglePanel2.TitleCursor = Cursors.Default;
//
// togglePanel3
//
togglePanel3.BackColor = System.Drawing.Color.FromArgb(252, 252, 252);
togglePanel3.CloseIcon = "H";
togglePanel3.Controls.Add(label7);
togglePanel3.Controls.Add(pickerBox5);
togglePanel3.Controls.Add(label6);
togglePanel3.Controls.Add(pickerBox4);
togglePanel3.Controls.Add(numericBox1);
togglePanel3.Controls.Add(label4);
togglePanel3.Controls.Add(label5);
togglePanel3.Controls.Add(pickerBox3);
togglePanel3.EnableMovable = false;
togglePanel3.ExpandedHeight = 187;
togglePanel3.HeaderPadding = new Padding(4, 0, 0, 2);
togglePanel3.IconWidth = 20;
togglePanel3.Location = new System.Drawing.Point(10, 197);
togglePanel3.Name = "togglePanel3";
togglePanel3.OpenIcon = "G";
togglePanel3.Size = new System.Drawing.Size(401, 187);
togglePanel3.TabIndex = 2;
togglePanel3.Title = "Web Traffic";
togglePanel3.TitleContextMenuStrip = null;
togglePanel3.TitleCursor = Cursors.Default;
//
// label6
//
label6.AutoSize = true;
label6.BackColor = System.Drawing.Color.Transparent;
label6.ForeColor = System.Drawing.SystemColors.ControlText;
label6.Location = new System.Drawing.Point(1, 106);
label6.Margin = new Padding(0);
label6.Name = "label6";
label6.Padding = new Padding(0, 8, 0, 0);
label6.Size = new System.Drawing.Size(82, 23);
label6.TabIndex = 199;
label6.Text = "Allow Cookies";
label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox4
//
pickerBox4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox4.BackColor = System.Drawing.Color.Transparent;
pickerBox4.EnableMovable = false;
pickerBox4.Location = new System.Drawing.Point(311, 106);
pickerBox4.Name = "pickerBox4";
pickerBox4.SelectedIndex = 1;
pickerBox4.Size = new System.Drawing.Size(80, 32);
pickerBox4.TabIndex = 200;
pickerBox4.TabStop = false;
pickerBox4.Value = true;
//
// numericBox1
//
numericBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
numericBox1.BackColor = System.Drawing.Color.Transparent;
numericBox1.EnableMovable = false;
numericBox1.Location = new System.Drawing.Point(291, 64);
numericBox1.Maximum = 30;
numericBox1.Minimum = 1;
numericBox1.Name = "numericBox1";
numericBox1.Size = new System.Drawing.Size(100, 32);
numericBox1.TabIndex = 3;
numericBox1.TabStop = false;
numericBox1.Value = 6;
//
// label4
//
label4.AutoSize = true;
label4.BackColor = System.Drawing.Color.Transparent;
label4.ForeColor = System.Drawing.SystemColors.ControlText;
label4.Location = new System.Drawing.Point(1, 22);
label4.Margin = new Padding(0);
label4.Name = "label4";
label4.Padding = new Padding(0, 8, 0, 0);
label4.Size = new System.Drawing.Size(97, 23);
label4.TabIndex = 196;
label4.Text = "Allow Unsafe SSL";
label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
label5.AutoSize = true;
label5.BackColor = System.Drawing.Color.Transparent;
label5.ForeColor = System.Drawing.SystemColors.ControlText;
label5.Location = new System.Drawing.Point(1, 64);
label5.Margin = new Padding(0);
label5.Name = "label5";
label5.Padding = new Padding(0, 8, 0, 0);
label5.Size = new System.Drawing.Size(151, 23);
label5.TabIndex = 196;
label5.Text = "Request Timeout (Seconds)";
label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox3
//
pickerBox3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox3.BackColor = System.Drawing.Color.Transparent;
pickerBox3.EnableMovable = false;
pickerBox3.Location = new System.Drawing.Point(311, 22);
pickerBox3.Name = "pickerBox3";
pickerBox3.SelectedIndex = 1;
pickerBox3.Size = new System.Drawing.Size(80, 32);
pickerBox3.TabIndex = 198;
pickerBox3.TabStop = false;
pickerBox3.Value = true;
//
// label7
//
label7.AutoSize = true;
label7.BackColor = System.Drawing.Color.Transparent;
label7.ForeColor = System.Drawing.SystemColors.ControlText;
label7.Location = new System.Drawing.Point(1, 148);
label7.Margin = new Padding(0);
label7.Name = "label7";
label7.Padding = new Padding(0, 8, 0, 0);
label7.Size = new System.Drawing.Size(88, 23);
label7.TabIndex = 201;
label7.Text = "Allow Redirects";
label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox5
//
pickerBox5.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox5.BackColor = System.Drawing.Color.Transparent;
pickerBox5.EnableMovable = false;
pickerBox5.Location = new System.Drawing.Point(311, 148);
pickerBox5.Name = "pickerBox5";
pickerBox5.SelectedIndex = 1;
pickerBox5.Size = new System.Drawing.Size(80, 32);
pickerBox5.TabIndex = 202;
pickerBox5.TabStop = false;
pickerBox5.Value = true;
//
// OptionsForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = System.Drawing.Color.WhiteSmoke;
ClientSize = new System.Drawing.Size(444, 561);
Controls.Add(flowLayoutPanel1);
Controls.Add(dialogFooter1);
MinimumSize = new System.Drawing.Size(460, 600);
Name = "OptionsForm";
Text = "Options";
flowLayoutPanel1.ResumeLayout(false);
togglePanel1.ResumeLayout(false);
togglePanel1.PerformLayout();
togglePanel2.ResumeLayout(false);
togglePanel2.PerformLayout();
togglePanel3.ResumeLayout(false);
togglePanel3.PerformLayout();
ResumeLayout(false);
}
public App6Options Result
{
get
{
if (_appSession == null)
{
_appSession = new App6Options();
}
_appSession.RestorePosition = pickerBox1.Value;
_appSession.RunCommand = textBox1.Text ?? string.Empty;
_appSession.AlwaysOnTop = pickerBox2.Value;
_appSession.AllowUnsafeSSL = pickerBox3.Value;
_appSession.Timeout = numericBox1.Value;
_appSession.AllowCookies = pickerBox4.Value;
_appSession.AllowRedirects = pickerBox5.Value;
return _appSession;
}
}
}
}

120
Forms/OptionsForm.resx Normal file
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>

227
Forms/UpdateIconsForm.cs Normal file
View File

@ -0,0 +1,227 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using BukkuBuddy.DTOs.SaveFile;
using BukkuBuddy.Services;
using RyzStudio.Windows.Forms;
namespace BukkuBuddy.Forms
{
public class UpdateIconsForm : Form
{
private TProgressBar progressBar1;
private RyzStudio.Windows.ThemedForms.ThUserControl userControl1;
private Label label1;
private Label label2;
private readonly WebPageService _webPageService;
private readonly BookmarkTreeView _treeView = null;
private readonly bool _updateOnly;
private bool cancelRequested = false;
public UpdateIconsForm(BookmarkTreeView treeView, App6Options options, bool updateOnly)
{
InitializeComponent();
UISetup.Dialog(this, true);
this.Text = "Updating Icons";
_treeView = treeView;
_updateOnly = updateOnly;
_webPageService = new WebPageService(options.AllowUnsafeSSL, options.Timeout, options.AllowCookies, options.AllowRedirects);
}
private void InitializeComponent()
{
progressBar1 = new TProgressBar();
userControl1 = new RyzStudio.Windows.ThemedForms.ThUserControl();
label1 = new Label();
label2 = new Label();
userControl1.SuspendLayout();
SuspendLayout();
//
// progressBar1
//
progressBar1.BarColour = Color.FromArgb(25, 104, 218);
progressBar1.Dock = DockStyle.Fill;
progressBar1.EnableMovable = false;
progressBar1.Location = new Point(3, 3);
progressBar1.Maximum = 100;
progressBar1.Minimum = 0;
progressBar1.Name = "progressBar1";
progressBar1.OnProgressChanged = null;
progressBar1.ShowText = true;
progressBar1.Size = new Size(418, 18);
progressBar1.TabIndex = 156;
progressBar1.Value = 25;
//
// userControl1
//
userControl1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
userControl1.BackColor = Color.Transparent;
userControl1.Controls.Add(progressBar1);
userControl1.EnableMovable = false;
userControl1.Location = new Point(10, 64);
userControl1.Name = "userControl1";
userControl1.Size = new Size(424, 24);
userControl1.TabIndex = 157;
//
// label1
//
label1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
label1.AutoEllipsis = true;
label1.Location = new Point(10, 20);
label1.Name = "label1";
label1.Size = new Size(424, 15);
label1.TabIndex = 159;
//
// label2
//
label2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
label2.AutoEllipsis = true;
label2.Location = new Point(10, 40);
label2.Name = "label2";
label2.Size = new Size(424, 15);
label2.TabIndex = 160;
//
// LoadIconsForm
//
BackColor = Color.White;
ClientSize = new Size(444, 117);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(userControl1);
Name = "LoadIconsForm";
Text = "Update Icons";
userControl1.ResumeLayout(false);
ResumeLayout(false);
}
protected async override void OnShown(EventArgs e)
{
base.OnShown(e);
await Task.Run(async () =>
{
this.Clear();
var model = _treeView.ToNodeList<App6Options.Item>();
// Update only
if (_updateOnly)
{
model = model.Where(x => x.Value.Icon == null)?.ToList() ?? new List<KeyValuePair<TreeNode, App6Options.Item>>();
}
// Update progress bars
progressBar1.Maximum = model.Count;
progressBar1.Value = 0;
UIControl.SetText(label1, "Updating...");
UIControl.SetText(label2, "");
foreach (var item in model)
{
if (cancelRequested)
{
break;
}
UIControl.SetText(label2, "... " + item.Value.Title);
progressBar1.Value++;
if (!_webPageService.IsValidUrl(item.Value.Address))
{
continue;
}
// Update only
if (_updateOnly)
{
if (item.Value.Icon != null)
{
continue;
}
}
var newModel = item.Value;
HtmlAgilityPack.HtmlDocument htmlDocument = null;
try
{
htmlDocument = await _webPageService.GetDocument(newModel.Address);
}
catch (Exception)
{
continue;
}
if (htmlDocument == null)
{
continue;
}
var faviconUrl = _webPageService.ParseFavicon(htmlDocument);
if (!string.IsNullOrWhiteSpace(faviconUrl))
{
var favicon = await _webPageService.GetImage(faviconUrl);
if (favicon != null)
{
if (favicon.Width > 16)
{
favicon = RyzStudio.Drawing.ImageEditor.Resize(favicon, 16, 16);
}
}
newModel.Icon = favicon;
}
_treeView.UpdateNode(item.Key, newModel);
}
UIControl.SetText(label1, "");
UIControl.SetText(label2, "Done");
});
this.DialogResult = DialogResult.OK;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
base.OnFormClosing(e);
if (this.DialogResult != DialogResult.OK)
{
e.Cancel = true;
if (!cancelRequested)
{
UIControl.SetText(label1, "Cancelling...");
cancelRequested = true;
}
}
}
public void Clear()
{
UIControl.SetText(label1, "Ready");
UIControl.SetText(label2, "");
progressBar1.Value = progressBar1.Maximum = 0;
}
}
}

120
Forms/UpdateIconsForm.resx Normal file
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>

142
MainForm.Designer.cs generated
View File

@ -1,8 +1,9 @@
using RyzStudio;
using BukkuBuddy.Resources;
using RyzStudio;
using RyzStudio.IO;
using RyzStudio.Windows.ThemedForms;
namespace FizzyLauncher
namespace BukkuBuddy
{
partial class MainForm
{
@ -54,7 +55,9 @@ namespace FizzyLauncher
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
alwaysOnTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem12 = new System.Windows.Forms.ToolStripMenuItem();
updateAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
@ -64,6 +67,7 @@ namespace FizzyLauncher
openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
rootContextMenu = new System.Windows.Forms.ContextMenuStrip(components);
addPageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
addFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -91,7 +95,8 @@ namespace FizzyLauncher
moveUpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
moveDownToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView();
toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
menuStrip1.SuspendLayout();
rootContextMenu.SuspendLayout();
folderContextMenu.SuspendLayout();
@ -122,7 +127,6 @@ namespace FizzyLauncher
//
// newToolStripMenuItem
//
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);
@ -131,7 +135,7 @@ namespace FizzyLauncher
//
// openToolStripMenuItem
//
openToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
openToolStripMenuItem.Image = MainMenuResource.folder_minus;
openToolStripMenuItem.Name = "openToolStripMenuItem";
openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O;
openToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
@ -157,7 +161,7 @@ namespace FizzyLauncher
//
// saveToolStripMenuItem
//
saveToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
saveToolStripMenuItem.Image = MainMenuResource.save;
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S;
saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
@ -192,7 +196,7 @@ namespace FizzyLauncher
//
// findToolStripMenuItem
//
findToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
findToolStripMenuItem.Image = MainMenuResource.search;
findToolStripMenuItem.Name = "findToolStripMenuItem";
findToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F;
findToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
@ -234,29 +238,43 @@ namespace FizzyLauncher
//
// toolsToolStripMenuItem
//
toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripMenuItem9, toolStripSeparator2, optionsToolStripMenuItem });
toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripMenuItem12, toolStripSeparator2, optionsToolStripMenuItem });
toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
toolsToolStripMenuItem.Text = "&Tools";
//
// toolStripMenuItem9
// toolStripMenuItem12
//
toolStripMenuItem9.Name = "toolStripMenuItem9";
toolStripMenuItem9.Size = new System.Drawing.Size(168, 22);
toolStripMenuItem9.Text = "Update &Icons";
toolStripMenuItem9.Click += toolStripMenuItem9_Click;
toolStripMenuItem12.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripMenuItem9, updateAllToolStripMenuItem, toolStripSeparator3, clearToolStripMenuItem });
toolStripMenuItem12.Name = "toolStripMenuItem12";
toolStripMenuItem12.Size = new System.Drawing.Size(180, 22);
toolStripMenuItem12.Text = "&Icons";
//
// updateAllToolStripMenuItem
//
updateAllToolStripMenuItem.Name = "updateAllToolStripMenuItem";
updateAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
updateAllToolStripMenuItem.Text = "Update &All";
updateAllToolStripMenuItem.Click += updateAllToolStripMenuItem_Click;
//
// clearToolStripMenuItem
//
clearToolStripMenuItem.Name = "clearToolStripMenuItem";
clearToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
clearToolStripMenuItem.Text = "&Clear All";
clearToolStripMenuItem.Click += clearToolStripMenuItem_Click;
//
// toolStripSeparator2
//
toolStripSeparator2.Name = "toolStripSeparator2";
toolStripSeparator2.Size = new System.Drawing.Size(165, 6);
toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
//
// optionsToolStripMenuItem
//
optionsToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
optionsToolStripMenuItem.Image = MainMenuResource.settings;
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;
//
@ -269,7 +287,7 @@ namespace FizzyLauncher
//
// viewHelpToolStripMenuItem1
//
viewHelpToolStripMenuItem1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
viewHelpToolStripMenuItem1.Image = MainMenuResource.help_circle;
viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
@ -298,43 +316,52 @@ namespace FizzyLauncher
//
rootContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addPageToolStripMenuItem, toolStripMenuItem11, addFolderToolStripMenuItem, toolStripMenuItem2, editToolStripMenuItem, toolStripMenuItem3, sortToolStripMenuItem });
rootContextMenu.Name = "rootContextMenu";
rootContextMenu.Size = new System.Drawing.Size(181, 148);
rootContextMenu.Size = new System.Drawing.Size(167, 126);
//
// addPageToolStripMenuItem
//
addPageToolStripMenuItem.Image = TreeViewResource.plus;
addPageToolStripMenuItem.Name = "addPageToolStripMenuItem";
addPageToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
addPageToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
addPageToolStripMenuItem.Text = "Add &Page";
addPageToolStripMenuItem.Click += addPageToolStripMenuItem_Click;
//
// toolStripMenuItem11
//
toolStripMenuItem11.Name = "toolStripMenuItem11";
toolStripMenuItem11.Size = new System.Drawing.Size(166, 22);
toolStripMenuItem11.Text = "Add Page (&Batch)";
toolStripMenuItem11.Click += toolStripMenuItem11_Click;
//
// addFolderToolStripMenuItem
//
addFolderToolStripMenuItem.Image = TreeViewResource.plus_square;
addFolderToolStripMenuItem.Name = "addFolderToolStripMenuItem";
addFolderToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
addFolderToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
addFolderToolStripMenuItem.Text = "Add &Folder";
addFolderToolStripMenuItem.Click += addFolderToolStripMenuItem_Click;
//
// toolStripMenuItem2
//
toolStripMenuItem2.Name = "toolStripMenuItem2";
toolStripMenuItem2.Size = new System.Drawing.Size(177, 6);
toolStripMenuItem2.Size = new System.Drawing.Size(163, 6);
//
// editToolStripMenuItem
//
editToolStripMenuItem.Name = "editToolStripMenuItem";
editToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
editToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
editToolStripMenuItem.Text = "&Edit";
editToolStripMenuItem.Click += editToolStripMenuItem_Click;
//
// toolStripMenuItem3
//
toolStripMenuItem3.Name = "toolStripMenuItem3";
toolStripMenuItem3.Size = new System.Drawing.Size(177, 6);
toolStripMenuItem3.Size = new System.Drawing.Size(163, 6);
//
// sortToolStripMenuItem
//
sortToolStripMenuItem.Name = "sortToolStripMenuItem";
sortToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
sortToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
sortToolStripMenuItem.Text = "&Sort";
sortToolStripMenuItem.Click += sortToolStripMenuItem_Click;
//
@ -342,87 +369,88 @@ namespace FizzyLauncher
//
folderContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addPageToolStripMenuItem1, toolStripMenuItem10, addFolderToolStripMenuItem1, toolStripMenuItem4, openAllToolStripMenuItem, editToolStripMenuItem1, deleteToolStripMenuItem, toolStripMenuItem5, sortToolStripMenuItem1, toolStripMenuItem6, moveUpToolStripMenuItem, moveDownToolStripMenuItem });
folderContextMenu.Name = "folderContextMenu";
folderContextMenu.Size = new System.Drawing.Size(167, 220);
folderContextMenu.Size = new System.Drawing.Size(178, 220);
//
// addPageToolStripMenuItem1
//
addPageToolStripMenuItem1.Image = TreeViewResource.plus;
addPageToolStripMenuItem1.Name = "addPageToolStripMenuItem1";
addPageToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
addPageToolStripMenuItem1.Size = new System.Drawing.Size(177, 22);
addPageToolStripMenuItem1.Text = "Add &Page";
addPageToolStripMenuItem1.Click += addPageToolStripMenuItem1_Click;
//
// toolStripMenuItem10
//
toolStripMenuItem10.Name = "toolStripMenuItem10";
toolStripMenuItem10.Size = new System.Drawing.Size(166, 22);
toolStripMenuItem10.Text = "Add Page (&Batch)";
toolStripMenuItem10.Size = new System.Drawing.Size(177, 22);
toolStripMenuItem10.Text = "Add &Multiple Pages";
toolStripMenuItem10.Click += toolStripMenuItem10_Click;
//
// addFolderToolStripMenuItem1
//
addFolderToolStripMenuItem1.Image = TreeViewResource.plus_square;
addFolderToolStripMenuItem1.Name = "addFolderToolStripMenuItem1";
addFolderToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
addFolderToolStripMenuItem1.Size = new System.Drawing.Size(177, 22);
addFolderToolStripMenuItem1.Text = "Add &Folder";
addFolderToolStripMenuItem1.Click += addFolderToolStripMenuItem1_Click;
//
// toolStripMenuItem4
//
toolStripMenuItem4.Name = "toolStripMenuItem4";
toolStripMenuItem4.Size = new System.Drawing.Size(163, 6);
toolStripMenuItem4.Size = new System.Drawing.Size(174, 6);
//
// openAllToolStripMenuItem
//
openAllToolStripMenuItem.Image = BookmarkManager.AppResource.bookmark;
openAllToolStripMenuItem.Name = "openAllToolStripMenuItem";
openAllToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
openAllToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
openAllToolStripMenuItem.Text = "&Open All";
openAllToolStripMenuItem.Click += openAllToolStripMenuItem_Click;
//
// editToolStripMenuItem1
//
editToolStripMenuItem1.Name = "editToolStripMenuItem1";
editToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
editToolStripMenuItem1.Size = new System.Drawing.Size(177, 22);
editToolStripMenuItem1.Text = "&Edit";
editToolStripMenuItem1.Click += editToolStripMenuItem1_Click;
//
// deleteToolStripMenuItem
//
deleteToolStripMenuItem.Image = BookmarkManager.AppResource.trash;
deleteToolStripMenuItem.Image = TreeViewResource.trash_2;
deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
deleteToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
deleteToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
deleteToolStripMenuItem.Text = "&Delete";
deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click;
//
// toolStripMenuItem5
//
toolStripMenuItem5.Name = "toolStripMenuItem5";
toolStripMenuItem5.Size = new System.Drawing.Size(163, 6);
toolStripMenuItem5.Size = new System.Drawing.Size(174, 6);
//
// sortToolStripMenuItem1
//
sortToolStripMenuItem1.Name = "sortToolStripMenuItem1";
sortToolStripMenuItem1.Size = new System.Drawing.Size(166, 22);
sortToolStripMenuItem1.Size = new System.Drawing.Size(177, 22);
sortToolStripMenuItem1.Text = "&Sort";
sortToolStripMenuItem1.Click += sortToolStripMenuItem1_Click;
//
// toolStripMenuItem6
//
toolStripMenuItem6.Name = "toolStripMenuItem6";
toolStripMenuItem6.Size = new System.Drawing.Size(163, 6);
toolStripMenuItem6.Size = new System.Drawing.Size(174, 6);
//
// moveUpToolStripMenuItem
//
moveUpToolStripMenuItem.Image = BookmarkManager.AppResource.arrow_up_circle;
moveUpToolStripMenuItem.Image = TreeViewResource.arrow_up;
moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem";
moveUpToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
moveUpToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
moveUpToolStripMenuItem.Text = "Move &Up";
moveUpToolStripMenuItem.Click += moveUpToolStripMenuItem_Click;
//
// moveDownToolStripMenuItem
//
moveDownToolStripMenuItem.Image = BookmarkManager.AppResource.arrow_down_circle;
moveDownToolStripMenuItem.Image = TreeViewResource.arrow_down;
moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem";
moveDownToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
moveDownToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
moveDownToolStripMenuItem.Text = "Move &Down";
moveDownToolStripMenuItem.Click += moveDownToolStripMenuItem_Click;
//
@ -434,7 +462,6 @@ namespace FizzyLauncher
//
// openToolStripMenuItem1
//
openToolStripMenuItem1.Image = BookmarkManager.AppResource.bookmark;
openToolStripMenuItem1.Name = "openToolStripMenuItem1";
openToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
openToolStripMenuItem1.Text = "&Open";
@ -454,7 +481,7 @@ namespace FizzyLauncher
//
// deleteToolStripMenuItem1
//
deleteToolStripMenuItem1.Image = BookmarkManager.AppResource.trash;
deleteToolStripMenuItem1.Image = TreeViewResource.trash_2;
deleteToolStripMenuItem1.Name = "deleteToolStripMenuItem1";
deleteToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
deleteToolStripMenuItem1.Text = "&Delete";
@ -467,7 +494,7 @@ namespace FizzyLauncher
//
// moveUpToolStripMenuItem1
//
moveUpToolStripMenuItem1.Image = BookmarkManager.AppResource.arrow_up_circle;
moveUpToolStripMenuItem1.Image = TreeViewResource.arrow_up;
moveUpToolStripMenuItem1.Name = "moveUpToolStripMenuItem1";
moveUpToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
moveUpToolStripMenuItem1.Text = "Move &Up";
@ -475,7 +502,7 @@ namespace FizzyLauncher
//
// moveDownToolStripMenuItem1
//
moveDownToolStripMenuItem1.Image = BookmarkManager.AppResource.arrow_down_circle;
moveDownToolStripMenuItem1.Image = TreeViewResource.arrow_down;
moveDownToolStripMenuItem1.Name = "moveDownToolStripMenuItem1";
moveDownToolStripMenuItem1.Size = new System.Drawing.Size(138, 22);
moveDownToolStripMenuItem1.Text = "Move &Down";
@ -491,12 +518,17 @@ namespace FizzyLauncher
treeView1.Size = new System.Drawing.Size(300, 556);
treeView1.TabIndex = 5;
//
// toolStripMenuItem11
// toolStripMenuItem9
//
toolStripMenuItem11.Name = "toolStripMenuItem11";
toolStripMenuItem11.Size = new System.Drawing.Size(180, 22);
toolStripMenuItem11.Text = "Add Page (&Batch)";
toolStripMenuItem11.Click += toolStripMenuItem11_Click;
toolStripMenuItem9.Name = "toolStripMenuItem9";
toolStripMenuItem9.Size = new System.Drawing.Size(180, 22);
toolStripMenuItem9.Text = "&Update";
toolStripMenuItem9.Click += toolStripMenuItem9_Click_1;
//
// toolStripSeparator3
//
toolStripSeparator3.Name = "toolStripSeparator3";
toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
//
// MainForm
//
@ -576,11 +608,15 @@ namespace FizzyLauncher
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;
private RyzStudio.Windows.Forms.BookmarkTreeView treeView1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem10;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem12;
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateAllToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
}
}

View File

@ -8,38 +8,32 @@ using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using BookmarkManager;
using BookmarkManager.Models;
using bzit.bomg.Models;
using FizzyLauncher.Models;
using BukkuBuddy.DTOs.SaveFile;
using BukkuBuddy.Forms;
using BukkuBuddy.Resources;
using RyzStudio;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using static RyzStudio.Windows.Forms.BookmarkTreeView;
namespace FizzyLauncher
namespace BukkuBuddy
{
public partial class MainForm : Form
{
private readonly FileSessionManager _fileSessionManager;
private readonly IFileSessionManager _fileSessionManager;
private bool _isBusy = false;
private App6Options currentSession = null;
private bool isBusy = false;
public MainForm()
{
InitializeComponent();
this.AutoScaleMode = AutoScaleMode.None;
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
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;
@ -49,14 +43,13 @@ namespace FizzyLauncher
_fileSessionManager.OnClearing += fileSessionManager_OnClearSession;
_fileSessionManager.OnFilenameChanged += fileSessionManager_OnFilenameChanged;
this.AutoScaleMode = AutoScaleMode.None;
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
treeView1.RootContextMenu = rootContextMenu;
treeView1.FolderContextMenu = folderContextMenu;
treeView1.PageContextMenu = pageContextMenu;
treeView1.OnEditNode += treeView1_OnEditNode;
treeView1.NodeMouseDoubleClick += treeView1_NodeMouseDoubleClick;
treeView1.PreviewKeyDown += treeView1_PreviewKeyDown;
treeView1.OnChanged += treeView1_OnChanged;
}
protected async override void OnShown(EventArgs e)
@ -77,41 +70,78 @@ namespace FizzyLauncher
}
else
{
this.CurrentSession = new AppOptions();
//this.CurrentSession = new AppOptions();
InvalidateOptions();
//InvalidateOptions();
}
UIControl.SetFocus(this);
}
protected async override void OnClosing(CancelEventArgs e)
protected async override void OnFormClosing(FormClosingEventArgs e)
{
base.OnClosing(e);
base.OnFormClosing(e);
await _fileSessionManager.CloseSession();
}
public AppOptions CurrentSession { get; set; } = null;
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public App6Options CurrentSession
{
get
{
if (currentSession == null)
{
currentSession = new App6Options();
}
return currentSession;
}
set => currentSession = value;
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsBusy
{
get => _isBusy;
get => isBusy;
set
{
treeView1.Enabled = !value;
isBusy = value;
UIControl.SetEnable(treeView1, !isBusy);
}
}
private void InvalidateOptions()
private void InvalidateOptions(bool resize)
{
UIControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
if (resize)
{
if (!this.CurrentSession.StartPosition.IsEmpty)
{
UIControl.SetLocation(this, this.CurrentSession.StartPosition);
}
if (this.CurrentSession.Width > 0)
{
UIControl.SetClientWidth(this, this.CurrentSession.Width);
}
if (this.CurrentSession.Height > 0)
{
UIControl.SetClientHeight(this, this.CurrentSession.Height);
}
}
}
private void menuStrip1_MenuActivate(object sender, EventArgs e)
{
closeToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open) && treeView1.HasChanged;
//saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open) && treeView1.HasChanged;
saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open) && _fileSessionManager.HasChanged;
saveAsToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
findToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
@ -121,6 +151,8 @@ namespace FizzyLauncher
alwaysOnTopToolStripMenuItem.Checked = this.CurrentSession?.AlwaysOnTop ?? false;
toolStripMenuItem9.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
updateAllToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
clearToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
}
@ -239,7 +271,7 @@ namespace FizzyLauncher
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void expandAllToolStripMenuItem_Click(object sender, EventArgs e)
private async void expandAllToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
@ -251,14 +283,20 @@ namespace FizzyLauncher
return;
}
if (treeView1.SelectedNode == null)
await Task.Run(() =>
{
treeView1.ExpandAll();
}
else
{
treeView1.SelectedNode.ExpandAll();
}
UIControl.Invoke(treeView1, (x) =>
{
if (treeView1.SelectedNode == null)
{
treeView1.ExpandAll();
}
else
{
treeView1.SelectedNode.ExpandAll();
}
});
});
}
/// <summary>
@ -266,7 +304,7 @@ namespace FizzyLauncher
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void collapseAllToolStripMenuItem_Click(object sender, EventArgs e)
private async void collapseAllToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
@ -278,14 +316,20 @@ namespace FizzyLauncher
return;
}
if (treeView1.SelectedNode == null)
await Task.Run(() =>
{
treeView1.CollapseAll();
}
else
{
treeView1.SelectedNode.Collapse(false);
}
UIControl.Invoke(treeView1, (x) =>
{
if (treeView1.SelectedNode == null)
{
treeView1.CollapseAll();
}
else
{
treeView1.SelectedNode.Collapse(false);
}
});
});
}
/// <summary>
@ -305,21 +349,123 @@ namespace FizzyLauncher
this.TopMost = this.CurrentSession.AlwaysOnTop;
}
/// <summary>
/// Update icons
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem9_Click(object sender, EventArgs e)
private async void toolStripMenuItem9_Click_1(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
}
var form = new UpdateIconsForm(treeView1);
form.ShowDialog();
this.IsBusy = true;
await Task.Run(() =>
{
UIControl.Invoke(treeView1, (x) =>
{
if (treeView1.GetNodeCount(true) <= 0)
{
return;
}
if (MessageBox.Show("Are you sure you want to update (missing) icons?", "Update Icons", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
var form = new UpdateIconsForm(treeView1, this.CurrentSession, true);
form.ShowDialog();
}
});
});
this.IsBusy = false;
}
/// <summary>
/// Update all icons.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void updateAllToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
}
this.IsBusy = true;
await Task.Run(() =>
{
UIControl.Invoke(treeView1, (x) =>
{
if (treeView1.GetNodeCount(true) <= 0)
{
return;
}
if (MessageBox.Show("Are you sure you want to update all icons?", "Update Icons", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
var form = new UpdateIconsForm(treeView1, this.CurrentSession, false);
form.ShowDialog();
}
});
});
this.IsBusy = false;
}
/// <summary>
/// Clear All Icons
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void clearToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
}
this.IsBusy = true;
await Task.Run(() =>
{
UIControl.Invoke(treeView1, (x) =>
{
if (treeView1.GetNodeCount(true) <= 0)
{
return;
}
if (MessageBox.Show("Are you sure you want to clear all icons?", "Clear Icons", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
var form = new ClearIconsForm(treeView1);
form.ShowDialog();
}
});
});
this.IsBusy = false;
}
/// <summary>
/// Update icons
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void toolStripMenuItem9_Click(object sender, EventArgs e)
{
//if (this.IsBusy)
//{
// return;
//}
//var form = new UpdateIconsForm(treeView1);
//form.ShowDialog();
}
/// <summary>
@ -337,9 +483,15 @@ namespace FizzyLauncher
var form = new OptionsForm(this.CurrentSession);
if (form.ShowDialog() == DialogResult.OK)
{
this.CurrentSession = form.Result;
this.CurrentSession.StartPosition = form.Result.StartPosition;
this.CurrentSession.RunCommand = form.Result.RunCommand;
this.CurrentSession.AlwaysOnTop = form.Result.AlwaysOnTop;
this.CurrentSession.AllowUnsafeSSL = form.Result.AllowUnsafeSSL;
this.CurrentSession.Timeout = form.Result.Timeout;
this.CurrentSession.AllowCookies = form.Result.AllowCookies;
this.CurrentSession.AllowRedirects = form.Result.AllowRedirects;
InvalidateOptions();
InvalidateOptions(false);
}
}
@ -351,7 +503,7 @@ namespace FizzyLauncher
/// <param name="e"></param>
private void viewHelpToolStripMenuItem1_Click(object sender, EventArgs e)
{
RyzStudio.Diagnostics.Process.Execute(AppResource.AppHelpURL);
RyzStudio.Diagnostics.Process.Execute(MainMenuResource.AppHelpURL);
}
/// <summary>
@ -362,11 +514,11 @@ namespace FizzyLauncher
private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
{
var form = new RyzStudio.Windows.ThemedForms.AboutForm();
form.ProductURL = AppResource.AppProductURL;
form.AuthorURL = AppResource.AppAuthorURL;
form.CompanyURL = AppResource.AppCompanyURL;
form.ProductURL = MainMenuResource.AppProductURL;
form.AuthorURL = MainMenuResource.AppAuthorURL;
form.CompanyURL = MainMenuResource.AppCompanyURL;
form.ProductCopyrightStartYear = 2012;
form.ProductLogo = AppResource.icon_64;
form.ProductLogo = MainMenuResource.icon_64;
form.ShowDialog();
}
@ -380,7 +532,7 @@ namespace FizzyLauncher
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addPageToolStripMenuItem_Click(object sender, EventArgs e)
private async void addPageToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
@ -390,16 +542,22 @@ namespace FizzyLauncher
var nodeType = treeView1.GetNodeType();
if ((nodeType == BookmarkTreeView.NodeType.Root) || (nodeType == BookmarkTreeView.NodeType.Folder))
{
treeView1.AddNode();
await Task.Run(() =>
{
UIControl.Invoke(treeView1, (x) =>
{
treeView1.AddNode();
});
});
}
}
/// <summary>
/// Add page (batch)
/// Add multiple pages
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem11_Click(object sender, EventArgs e)
private async void toolStripMenuItem11_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
@ -414,13 +572,19 @@ namespace FizzyLauncher
var nodePath = treeView1.GetNodePath();
var form = new AddBatchPageForm(nodePath);
var form = new AddMultiPageForm(nodePath, this.CurrentSession);
if (form.ShowDialog() == DialogResult.OK)
{
foreach (var item in form.Result)
await Task.Run(async () =>
{
treeView1.AddNode(item);
}
foreach (var item in form.Result)
{
UIControl.Invoke(treeView1, (x) =>
{
treeView1.AddNode(item);
});
}
});
}
}
@ -429,7 +593,7 @@ namespace FizzyLauncher
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addFolderToolStripMenuItem_Click(object sender, EventArgs e)
private async void addFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
@ -439,7 +603,13 @@ namespace FizzyLauncher
var nodeType = treeView1.GetNodeType();
if ((nodeType == BookmarkTreeView.NodeType.Root) || (nodeType == BookmarkTreeView.NodeType.Folder))
{
treeView1.AddFolder();
await Task.Run(() =>
{
UIControl.Invoke(treeView1, (x) =>
{
treeView1.AddFolder();
});
});
}
}
@ -463,14 +633,24 @@ namespace FizzyLauncher
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void sortToolStripMenuItem_Click(object sender, EventArgs e)
private async void sortToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
}
treeView1.Sort();
this.IsBusy = true;
await Task.Run(() =>
{
UIControl.Invoke(treeView1, (x) =>
{
treeView1.Sort();
});
});
this.IsBusy = false;
}
#endregion
@ -550,7 +730,7 @@ namespace FizzyLauncher
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
private async void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
@ -559,7 +739,13 @@ namespace FizzyLauncher
if (MessageBox.Show("Delete?", "Delete?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
treeView1.DeleteNode();
await Task.Run(() =>
{
UIControl.Invoke(treeView1, (x) =>
{
treeView1.DeleteNode();
});
});
}
}
@ -666,122 +852,47 @@ namespace FizzyLauncher
{
return await Task.Run(() =>
{
treeView1.Clear("New Session");
if (treeView1.Nodes.Count >= 0)
UIControl.Invoke(treeView1, (x) =>
{
UIControl.Invoke(treeView1, (x) =>
treeView1.Clear(true, true, "New Session");
if (treeView1.Nodes.Count >= 0)
{
treeView1.Nodes[0].Expand();
treeView1.SelectedNode = treeView1.Nodes[0];
});
}
}
});
UIControl.SetFocus(treeView1);
sender.HasChanged = true;
return true;
});
}
private async Task<bool> fileSessionManager_OnLoadSession(FileSessionManager sender, string filename, int formatType)
{
return await Task.Run(async () =>
var loadingForm = new LoadingForm();
var result = await loadingForm.ShowDialog(filename, treeView1);
if (result != DialogResult.OK)
{
var result = GenericResult.Create();
return false;
}
switch (Path.GetExtension(filename?.ToLower()?.Trim() ?? string.Empty))
{
case ".json":
this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<AppOptions>(filename);
await Task.Run(() =>
{
this.CurrentSession = loadingForm.Result;
if (this.CurrentSession == null)
{
this.CurrentSession = LoadR4SaveFile(filename);
}
break;
case ".jsnx":
this.CurrentSession = await RyzStudio.IO.Compression.ZFile.ReadFile<AppOptions>(filename, "Document.json");
if (this.CurrentSession == null)
{
this.CurrentSession = new AppOptions();
}
// Load icons
this.CurrentSession = await LoadIconsFromZipFile(filename, this.CurrentSession);
break;
default:
this.CurrentSession = null;
break;
}
if (this.CurrentSession == null)
{
ThMessageBox.Show(this, "Unable to read session", "Load session", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
if (this.CurrentSession == null)
{
this.CurrentSession = new AppOptions();
}
// Reposition + resize
if (!this.CurrentSession.StartPosition.IsEmpty)
{
UIControl.SetLocation(this, this.CurrentSession.StartPosition);
}
if (this.CurrentSession.Height > 0)
{
UIControl.SetHeight(this, this.CurrentSession.Height);
}
if (this.CurrentSession.Width > 0)
{
UIControl.SetWidth(this, this.CurrentSession.Width);
}
InvalidateOptions();
// Clear treeview
treeView1.Clear("New Session");
// Load directories
foreach (var item in this.CurrentSession.Directories ?? new List<string>())
{
if (string.IsNullOrWhiteSpace(item))
{
continue;
}
treeView1.CreateNodePath(item, (int)NodeIcon.Folder1, (int)NodeIcon.Folder2);
}
// Load bookmarks
foreach (var item in this.CurrentSession.Items ?? new List<BookmarkModel>())
{
treeView1.AddNode(item);
}
if (treeView1.Nodes.Count >= 0)
{
UIControl.Invoke(treeView1, (x) =>
{
treeView1.Nodes[0].Expand();
treeView1.SelectedNode = treeView1.Nodes[0];
});
}
UIControl.SetFocus(treeView1);
return true;
this.InvalidateOptions(true);
});
UIControl.SetFocus(treeView1);
sender.HasChanged = false;
return true;
}
private async Task<bool> fileSessionManager_OnSaveSession(FileSessionManager sender, string filename, int formatType, bool showNotices)
@ -793,28 +904,28 @@ namespace FizzyLauncher
return await Task.Run(async () =>
{
if (_isBusy)
if (isBusy)
{
return false;
}
_isBusy = true;
isBusy = true;
// update session
if (this.CurrentSession == null)
{
this.CurrentSession = new AppOptions();
this.CurrentSession = new App6Options();
}
this.CurrentSession.StartPosition = this.Location;
this.CurrentSession.Width = this.Width;
this.CurrentSession.Height = this.Height;
var directoryList = treeView1.GetAllDirectories();
var bookmarkList = treeView1.GetAllNodes();
var directoryList = treeView1.GetAllNodePaths();
var bookmarkList = treeView1.GetAllItems();
this.CurrentSession.Directories = directoryList ?? new List<string>();
this.CurrentSession.Items = bookmarkList.Select(x => x.Value)?.ToList() ?? new List<BookmarkModel>();
this.CurrentSession.Items = bookmarkList.Select(x => x.Value)?.ToList() ?? new List<App6Options.Item>();
var result = GenericResult.Create();
@ -861,7 +972,12 @@ namespace FizzyLauncher
}
}
_isBusy = false;
isBusy = false;
if (result.IsSuccess)
{
sender.HasChanged = false;
}
return result.IsSuccess;
});
@ -869,12 +985,11 @@ namespace FizzyLauncher
private async Task<bool> fileSessionManager_OnClearSession(FileSessionManager sender)
{
return await Task.Run(() =>
{
UIControl.Clear(treeView1);
UIControl.Clear(treeView1);
return true;
});
sender.HasChanged = false;
return true;
}
private async Task fileSessionManager_OnFilenameChanged(FileSessionManager sender, string filename)
@ -895,13 +1010,12 @@ namespace FizzyLauncher
default:
break;
}
treeView1.HasChanged = false;
});
}
#endregion
private async void treeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
TreeNode node = treeView1.SelectedNode;
@ -927,77 +1041,33 @@ namespace FizzyLauncher
await OpenBookmark(e.Node);
}
private AppOptions LoadR4SaveFile(string filename)
private bool treeView1_OnEditNode(BookmarkTreeView sender, TreeNode node, App6Options.Item model)
{
var session = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<List<R4SaveFileModel>>(filename);
if (session == null)
if (this.IsBusy)
{
return null;
return false;
}
var result = new AppOptions();
result.Items = new List<BookmarkModel>();
foreach (var item in session)
var form = new EditBookmarkForm(model, this.CurrentSession);
if (form.ShowDialog() == DialogResult.OK)
{
result.Items.Add(new BookmarkModel()
{
Title = item.SiteName,
Address = item.SiteAddress,
Description = item.SiteDescription,
Notes = item.Notes,
Path = item.Path
});
sender.UpdateNode(node, form.Result);
return true;
}
return result;
return false;
}
private async Task<AppOptions> LoadIconsFromZipFile(string filename, AppOptions session)
private void treeView1_OnChanged(BookmarkTreeView sender, bool hasChanged)
{
if (string.IsNullOrWhiteSpace(filename))
if (hasChanged)
{
return session;
_fileSessionManager.HasChanged = hasChanged;
}
return await Task.Run(() =>
{
try
{
using (var archive = ZipFile.Open(filename, ZipArchiveMode.Read))
{
foreach (var item in session.Items)
{
if (item.Id == Guid.Empty)
{
continue;
}
var key = "icon\\" + item.Id.ToString() + ".png";
var zipEntry = archive.GetEntry(key);
if (zipEntry == null)
{
continue;
}
using (Stream entryStream = zipEntry.Open())
{
item.Icon = Image.FromStream(entryStream);
}
}
}
}
catch (Exception)
{
// do nothing
}
return session;
});
}
private async Task OpenBookmark(TreeNode node)
{
await Task.Run(() =>
@ -1007,7 +1077,7 @@ namespace FizzyLauncher
return;
}
var model = UIControl.GetTag<BookmarkModel>(node);
var model = UIControl.GetTag<App6Options.Item>(node);
if (model == null)
{
return;
@ -1024,7 +1094,7 @@ namespace FizzyLauncher
});
}
private GenericResult AddImagesToZipFile(string zipFilename, List<KeyValuePair<TreeNode, BookmarkModel>> items)
private GenericResult AddImagesToZipFile(string zipFilename, List<KeyValuePair<TreeNode, App6Options.Item>> items)
{
if (string.IsNullOrWhiteSpace(zipFilename))
{

View File

@ -121,19 +121,19 @@
<value>172, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>716, 17</value>
<value>331, 14</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="rootContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>831, 17</value>
<value>478, 19</value>
</metadata>
<metadata name="folderContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>979, 17</value>
<value>665, 16</value>
</metadata>
<metadata name="pageContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1137, 17</value>
<value>834, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@ -1,28 +0,0 @@
using System.Collections.Generic;
using System.Drawing;
using bzit.bomg.Models;
namespace FizzyLauncher.Models
{
public class AppOptions
{
public bool RestorePosition { get; set; } = true;
public bool AlwaysOnTop { get; set; } = false;
public string RunCommand { get; set; } = "{0}";
//public bool IgnoreSSL { get; set; } = false;
public Point StartPosition { get; set; } = Point.Empty;
public int Width { get; set; } = 0;
public int Height { get; set; } = 0;
public List<string> Directories { get; set; } = new List<string>();
public List<BookmarkModel> Items { get; set; } = new List<BookmarkModel>();
}
}

View File

@ -1,49 +0,0 @@
using System.Text;
namespace BookmarkManager.Models
{
public class R4SaveFileModel
{
public string SiteName { get; set; }
public string SiteAddress { get; set; }
public string SiteDescription { get; set; }
public string TreeviewPath { get; set; }
public string Notes { get; set; }
public string Path
{
get
{
if (string.IsNullOrWhiteSpace(TreeviewPath))
{
return string.Empty;
}
var path = this.TreeviewPath?.Trim('\\')?.Trim() ?? string.Empty;
if (!path.Contains("\\"))
{
return path?.Trim() ?? string.Empty;
}
var sb = new StringBuilder();
var parts = path.Split("\\");
for (var i = 1; i < parts.Length; i++)
{
var item = System.Web.HttpUtility.UrlDecode(parts[i]);
sb.Append(item);
sb.Append("\n");
}
return sb.ToString()?.Trim() ?? string.Empty;
}
}
}
}

View File

@ -1,269 +0,0 @@
using System.Windows.Forms;
using FizzyLauncher.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms.PickerBox;
namespace FizzyLauncher
{
public class OptionsForm : Form
{
private TTogglePanelC panel1;
private TTogglePanelC panel3;
private ThYesNoPickerBox yesNoPickerBox1;
private Label label2;
private TTogglePanelC panel2;
private Label label1;
private ThYesNoPickerBox yesNoPickerBox2;
private Label label3;
private RyzStudio.Windows.ThemedForms.ButtonTextBox.ThClearableTextBox textBox1;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private TFlowLayoutContainer flowLayoutContainer1;
private AppOptions _appSession = null;
public OptionsForm(AppOptions appSession)
{
InitializeComponent();
UISetup.Dialog(this);
_appSession = appSession;
if (_appSession != null)
{
yesNoPickerBox1.Value = _appSession.RestorePosition;
yesNoPickerBox2.Value = _appSession.AlwaysOnTop;
textBox1.Text = _appSession.RunCommand ?? string.Empty;
}
}
private void InitializeComponent()
{
panel1 = new TTogglePanelC();
yesNoPickerBox1 = new ThYesNoPickerBox();
label2 = new Label();
panel2 = new TTogglePanelC();
yesNoPickerBox2 = new ThYesNoPickerBox();
label1 = new Label();
panel3 = new TTogglePanelC();
textBox1 = new RyzStudio.Windows.ThemedForms.ButtonTextBox.ThClearableTextBox();
label3 = new Label();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
flowLayoutContainer1 = new TFlowLayoutContainer();
panel1.SuspendLayout();
panel2.SuspendLayout();
panel3.SuspendLayout();
flowLayoutContainer1.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
panel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
panel1.Controls.Add(yesNoPickerBox1);
panel1.Controls.Add(label2);
panel1.ExpandedHeight = 86;
panel1.ForeColor = System.Drawing.Color.FromArgb(31, 31, 31);
panel1.IsOpen = true;
panel1.Location = new System.Drawing.Point(10, 10);
panel1.Margin = new Padding(0, 0, 0, 5);
panel1.Name = "panel1";
panel1.Padding = new Padding(4, 32, 3, 3);
panel1.Size = new System.Drawing.Size(427, 86);
panel1.TabIndex = 0;
panel1.Title = "On Start-Up";
panel1.TitleContextMenuStrip = null;
panel1.TitleCursor = Cursors.Default;
//
// yesNoPickerBox1
//
yesNoPickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
yesNoPickerBox1.BackColor = System.Drawing.Color.Transparent;
yesNoPickerBox1.EnableReactiveVisual = true;
yesNoPickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
yesNoPickerBox1.Location = new System.Drawing.Point(330, 42);
yesNoPickerBox1.Name = "yesNoPickerBox1";
yesNoPickerBox1.Padding = new Padding(4, 4, 3, 3);
yesNoPickerBox1.SelectedIndex = 1;
yesNoPickerBox1.Size = new System.Drawing.Size(84, 34);
yesNoPickerBox1.TabIndex = 197;
yesNoPickerBox1.TabStop = false;
yesNoPickerBox1.Value = true;
//
// label2
//
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent;
label2.ForeColor = System.Drawing.SystemColors.ControlText;
label2.Location = new System.Drawing.Point(9, 42);
label2.Margin = new Padding(0);
label2.Name = "label2";
label2.Padding = new Padding(0, 8, 0, 0);
label2.Size = new System.Drawing.Size(92, 23);
label2.TabIndex = 196;
label2.Text = "Restore Position";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panel2
//
panel2.AutoScrollMargin = new System.Drawing.Size(0, 0);
panel2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
panel2.Controls.Add(yesNoPickerBox2);
panel2.Controls.Add(label1);
panel2.ExpandedHeight = 86;
panel2.ForeColor = System.Drawing.Color.FromArgb(31, 31, 31);
panel2.IsOpen = true;
panel2.Location = new System.Drawing.Point(10, 101);
panel2.Margin = new Padding(0, 0, 0, 5);
panel2.Name = "panel2";
panel2.Padding = new Padding(4, 32, 3, 3);
panel2.Size = new System.Drawing.Size(427, 86);
panel2.TabIndex = 2;
panel2.Title = "Appearance";
panel2.TitleContextMenuStrip = null;
panel2.TitleCursor = Cursors.Default;
//
// yesNoPickerBox2
//
yesNoPickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
yesNoPickerBox2.BackColor = System.Drawing.Color.Transparent;
yesNoPickerBox2.EnableReactiveVisual = true;
yesNoPickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F);
yesNoPickerBox2.Location = new System.Drawing.Point(330, 42);
yesNoPickerBox2.Name = "yesNoPickerBox2";
yesNoPickerBox2.Padding = new Padding(4, 4, 3, 3);
yesNoPickerBox2.SelectedIndex = 1;
yesNoPickerBox2.Size = new System.Drawing.Size(84, 34);
yesNoPickerBox2.TabIndex = 198;
yesNoPickerBox2.TabStop = false;
yesNoPickerBox2.Value = true;
//
// label1
//
label1.AutoSize = true;
label1.BackColor = System.Drawing.Color.Transparent;
label1.ForeColor = System.Drawing.SystemColors.ControlText;
label1.Location = new System.Drawing.Point(9, 42);
label1.Margin = new Padding(0);
label1.Name = "label1";
label1.Padding = new Padding(0, 8, 0, 0);
label1.Size = new System.Drawing.Size(85, 23);
label1.TabIndex = 196;
label1.Text = "Always On Top";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panel3
//
panel3.AutoScrollMargin = new System.Drawing.Size(0, 0);
panel3.AutoScrollMinSize = new System.Drawing.Size(0, 0);
panel3.Controls.Add(textBox1);
panel3.Controls.Add(label3);
panel3.ExpandedHeight = 86;
panel3.ForeColor = System.Drawing.Color.FromArgb(31, 31, 31);
panel3.IsOpen = true;
panel3.Location = new System.Drawing.Point(10, 192);
panel3.Margin = new Padding(0, 0, 0, 5);
panel3.Name = "panel3";
panel3.Padding = new Padding(4, 32, 3, 3);
panel3.Size = new System.Drawing.Size(427, 86);
panel3.TabIndex = 1;
panel3.Title = "Behaviour";
panel3.TitleContextMenuStrip = null;
panel3.TitleCursor = Cursors.Default;
//
// textBox1
//
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = System.Drawing.Color.Transparent;
textBox1.ClearedValue = "{0}";
textBox1.EnableReactiveVisual = true;
textBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
textBox1.Icon = "O";
textBox1.IconSize = 13F;
textBox1.Location = new System.Drawing.Point(165, 42);
textBox1.Name = "textBox1";
textBox1.Padding = new Padding(4, 4, 3, 3);
textBox1.Size = new System.Drawing.Size(249, 32);
textBox1.TabIndex = 203;
textBox1.TabStop = false;
textBox1.UseSystemPasswordChar = false;
//
// label3
//
label3.AutoSize = true;
label3.BackColor = System.Drawing.Color.Transparent;
label3.ForeColor = System.Drawing.SystemColors.ControlText;
label3.Location = new System.Drawing.Point(9, 42);
label3.Margin = new Padding(0);
label3.Name = "label3";
label3.Padding = new Padding(0, 8, 0, 0);
label3.Size = new System.Drawing.Size(88, 23);
label3.TabIndex = 199;
label3.Text = "Run Command";
label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// dialogFooter1
//
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
dialogFooter1.Button1Text = "&Save";
dialogFooter1.Dialog = this;
dialogFooter1.Dock = DockStyle.Bottom;
dialogFooter1.IsBusy = false;
dialogFooter1.Location = new System.Drawing.Point(0, 477);
dialogFooter1.Name = "dialogFooter1";
dialogFooter1.Size = new System.Drawing.Size(444, 84);
//
// flowLayoutContainer1
//
flowLayoutContainer1.AutoScroll = true;
flowLayoutContainer1.Controls.Add(panel1);
flowLayoutContainer1.Controls.Add(panel2);
flowLayoutContainer1.Controls.Add(panel3);
flowLayoutContainer1.Dock = DockStyle.Fill;
flowLayoutContainer1.Location = new System.Drawing.Point(0, 0);
flowLayoutContainer1.Name = "flowLayoutContainer1";
flowLayoutContainer1.Padding = new Padding(10, 10, 10, 30);
flowLayoutContainer1.Size = new System.Drawing.Size(444, 477);
flowLayoutContainer1.TabIndex = 195;
//
// OptionsForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = System.Drawing.Color.WhiteSmoke;
ClientSize = new System.Drawing.Size(444, 561);
Controls.Add(flowLayoutContainer1);
Controls.Add(dialogFooter1);
MinimumSize = new System.Drawing.Size(460, 600);
Name = "OptionsForm";
Text = "Options";
panel1.ResumeLayout(false);
panel1.PerformLayout();
panel2.ResumeLayout(false);
panel2.PerformLayout();
panel3.ResumeLayout(false);
panel3.PerformLayout();
flowLayoutContainer1.ResumeLayout(false);
ResumeLayout(false);
}
public AppOptions Result
{
get
{
if (_appSession == null)
{
_appSession = new AppOptions();
}
_appSession.RestorePosition = yesNoPickerBox1.Value;
_appSession.AlwaysOnTop = yesNoPickerBox2.Value;
_appSession.RunCommand = textBox1.Text ?? string.Empty;
return _appSession;
}
}
}
}

View File

@ -1,9 +1,7 @@
using BookmarkManager;
using RyzStudio.IO;
using System;
using System.Windows.Forms;
namespace FizzyLauncher
namespace BukkuBuddy
{
static class Program
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
Resources/MainMenu/save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace BookmarkManager {
namespace BukkuBuddy.Resources {
using System;
@ -19,17 +19,17 @@ namespace BookmarkManager {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class AppResource {
internal class MainMenuResource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal AppResource() {
internal MainMenuResource() {
}
/// <summary>
@ -39,7 +39,7 @@ namespace BookmarkManager {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BookmarkManager.AppResource", typeof(AppResource).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BukkuBuddy.Resources.MainMenuResource", typeof(MainMenuResource).Assembly);
resourceMan = temp;
}
return resourceMan;
@ -99,9 +99,9 @@ namespace BookmarkManager {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap arrow_down_circle {
internal static System.Drawing.Bitmap folder_minus {
get {
object obj = ResourceManager.GetObject("arrow_down_circle", resourceCulture);
object obj = ResourceManager.GetObject("folder_minus", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
@ -109,59 +109,9 @@ namespace BookmarkManager {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap arrow_up_circle {
internal static System.Drawing.Bitmap help_circle {
get {
object obj = ResourceManager.GetObject("arrow_up_circle", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap bookmark {
get {
object obj = ResourceManager.GetObject("bookmark", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap file_text {
get {
object obj = ResourceManager.GetObject("file_text", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap folder {
get {
object obj = ResourceManager.GetObject("folder", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap folder_explore {
get {
object obj = ResourceManager.GetObject("folder_explore", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap hexagon {
get {
object obj = ResourceManager.GetObject("hexagon", resourceCulture);
object obj = ResourceManager.GetObject("help_circle", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
@ -179,9 +129,29 @@ namespace BookmarkManager {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap trash {
internal static System.Drawing.Bitmap save {
get {
object obj = ResourceManager.GetObject("trash", resourceCulture);
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));
}
}

View File

@ -130,31 +130,22 @@
<value>https://www.hiimray.co.uk/software-bookmark-manager</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="arrow_down_circle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\arrow-down-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="folder_minus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>MainMenu\folder-minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="arrow_up_circle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\arrow-up-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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_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>
<data name="folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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="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 name="help_circle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>MainMenu\help-circle.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>
<value>icon-64.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 name="save" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>MainMenu\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>MainMenu\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>MainMenu\settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-bookmark-icon lucide-bookmark"
version="1.1"
id="svg4"
sodipodi:docname="bookmark16.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
inkscape:export-filename="L:\gitea-hiimray\bukkubuddy-bookmark-manager\Resources\TreeView\bookmark16.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs8" />
<sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="17.333333"
inkscape:cx="-2.1634616"
inkscape:cy="9.4326925"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
d="m 11.3333,2.0044719 a 1.33332,1.33332 0 0 1 1.33332,1.33332 v 9.9999001 a 0.66666,0.66666 0 0 1 -0.997323,0.578661 l -3.00797,-1.71865 a 1.33332,1.33332 0 0 0 -1.322654,0 l -3.0079696,1.71865 A 0.66666,0.66666 0 0 1 3.33338,13.337692 V 3.3377919 a 1.33332,1.33332 0 0 1 1.33332,-1.33332 z"
id="path2"
style="stroke-width:1.33332;fill:#e80900;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-file-question-mark-icon lucide-file-question-mark"
version="1.1"
id="svg8"
sodipodi:docname="file-question-mark16.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
inkscape:export-filename="L:\gitea-hiimray\bukkubuddy-bookmark-manager\Resources\TreeView\file-question-mark16.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs12" />
<sodipodi:namedview
id="namedview10"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="17.333333"
inkscape:cx="1.5865385"
inkscape:cy="10.701923"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<g
id="g837"
transform="matrix(0.66666,0,0,0.66666,7.8944395e-5,8.1050459e-5)"
style="stroke:#000000;stroke-opacity:1">
<path
d="M 6,22 A 2,2 0 0 1 4,20 V 4 A 2,2 0 0 1 6,2 h 8 a 2.4,2.4 0 0 1 1.704,0.706 l 3.588,3.588 A 2.4,2.4 0 0 1 20,8 v 12 a 2,2 0 0 1 -2,2 z"
id="path2"
style="stroke:#000000;stroke-opacity:1" />
<path
d="m 12,17 h 0.01"
id="path4"
style="stroke:#000000;stroke-opacity:1" />
<path
d="m 9.1,9 a 3,3 0 0 1 5.82,1 c 0,2 -3,3 -3,3"
id="path6"
style="stroke:#000000;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-folder-symlink-icon lucide-folder-symlink"
version="1.1"
id="svg6"
sodipodi:docname="folder-symlink16.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
inkscape:export-filename="L:\gitea-hiimray\bukkubuddy-bookmark-manager\Resources\folder-symlink16.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs10" />
<sodipodi:namedview
id="namedview8"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="17.333333"
inkscape:cx="-0.9519231"
inkscape:cy="16.875"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg6"
inkscape:lockguides="true" />
<path
d="m 13.090781,13.36712 a 1.2727138,1.2630066 0 0 0 1.272714,-1.263006 V 5.7890805 A 1.2727138,1.2630066 0 0 0 13.090781,4.5260739 H 8.0635618 A 1.2727138,1.2630066 0 0 1 6.9881186,3.9577209 L 6.4726695,3.1999169 A 1.2727138,1.2630066 0 0 0 5.4099535,2.6315639 H 2.9090708 A 1.2727138,1.2630066 0 0 0 1.6363569,3.8945706 v 8.2095434 a 1.2727138,1.2630066 0 0 0 1.2727139,1.263006 z"
id="path2-7"
style="fill:#f8db64;fill-opacity:1;stroke:none;stroke-width:1.26785;stroke-opacity:1"
inkscape:export-filename="L:\gitea-hiimray\bukkubuddy-bookmark-manager\Resources\folder-symlink16.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<path
d="M 1.6363569,6.64161 V 3.8945706 A 1.2727138,1.2630066 0 0 1 2.9090708,2.6315639 h 2.4817919 a 1.2727138,1.2630066 0 0 1 1.0754432,0.568353 l 0.5154491,0.757804 a 1.2727138,1.2630066 0 0 0 1.0627161,0.568353 h 5.0463099 a 1.2727138,1.2630066 0 0 1 1.272714,1.2630066 V 12.104114 A 1.2727138,1.2630066 0 0 1 13.090781,13.36712 H 2.9090708 A 1.2727138,1.2630066 0 0 1 1.6363569,12.104114 v -1.89451 A 1.2727138,1.2630066 0 0 1 2.9090708,8.9465971 h 4.4544984"
id="path2"
style="stroke-width:1.26785"
inkscape:export-filename="L:\gitea-hiimray\bukkubuddy-bookmark-manager\Resources\folder-symlink16.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<path
d="M 5.4544984,10.841107 7.3635692,8.9465971 5.4544984,7.0520872"
id="path4"
style="stroke-width:1.26785"
inkscape:export-filename="L:\gitea-hiimray\bukkubuddy-bookmark-manager\Resources\folder-symlink16.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-folder-symlink-icon lucide-folder-symlink"
version="1.1"
id="svg6"
sodipodi:docname="folder-symlink2.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
inkscape:export-filename="L:\gitea-hiimray\bukkubuddy-bookmark-manager\Resources\folder16.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs10" />
<sodipodi:namedview
id="namedview8"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="17.333333"
inkscape:cx="-0.9519231"
inkscape:cy="16.875"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg6"
inkscape:lockguides="true" />
<path
d="m 13.090781,13.36712 a 1.2727138,1.2630066 0 0 0 1.272714,-1.263006 V 5.7890805 A 1.2727138,1.2630066 0 0 0 13.090781,4.5260739 H 8.0635618 A 1.2727138,1.2630066 0 0 1 6.9881186,3.9577209 L 6.4726695,3.1999169 A 1.2727138,1.2630066 0 0 0 5.4099535,2.6315639 H 2.9090708 A 1.2727138,1.2630066 0 0 0 1.6363569,3.8945706 v 8.2095434 a 1.2727138,1.2630066 0 0 0 1.2727139,1.263006 z"
id="path2-7"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.26785;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

BIN
Resources/TreeView/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

153
Resources/TreeViewResource.Designer.cs generated Normal file
View File

@ -0,0 +1,153 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BukkuBuddy.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class TreeViewResource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal TreeViewResource() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BukkuBuddy.Resources.TreeViewResource", typeof(TreeViewResource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap arrow_down {
get {
object obj = ResourceManager.GetObject("arrow_down", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap arrow_up {
get {
object obj = ResourceManager.GetObject("arrow_up", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap bookmark_root {
get {
object obj = ResourceManager.GetObject("bookmark_root", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap file_question_mark {
get {
object obj = ResourceManager.GetObject("file_question_mark", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap folder {
get {
object obj = ResourceManager.GetObject("folder", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap folder_symlink {
get {
object obj = ResourceManager.GetObject("folder_symlink", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap plus {
get {
object obj = ResourceManager.GetObject("plus", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap plus_square {
get {
object obj = ResourceManager.GetObject("plus_square", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap trash_2 {
get {
object obj = ResourceManager.GetObject("trash_2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,148 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="arrow_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\arrow-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="arrow_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\arrow-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bookmark_root" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\bookmark_root.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="file_question_mark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\file-question-mark.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder_symlink" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\folder-symlink.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="plus_square" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\plus-square.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="trash_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TreeView\trash-2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

View File

@ -1,184 +1,126 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using HtmlAgilityPack;
using RyzStudio.Net;
namespace BookmarkManager.Services
namespace BukkuBuddy.Services
{
public class WebProvider
public class WebPageService
{
private readonly WebClientProvider _webClientProvider;
private readonly HttpClient _httpClient;
public WebProvider()
public WebPageService(bool allowUnsafeSSL, int timeout, bool allowCookies, bool allowRedirect)
{
_webClientProvider = new WebClientProvider();
_webClientProvider.Timeout = 4;
}
var handler = new HttpClientHandler();
handler.AllowAutoRedirect = allowRedirect;
public bool IgnoreSSL
{
get => _webClientProvider.IgnoreSSL;
set
if (allowUnsafeSSL)
{
_webClientProvider.IgnoreSSL = value;
handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
}
if (allowCookies)
{
handler.UseCookies = allowCookies;
handler.CookieContainer = new CookieContainer();
}
_httpClient = new HttpClient(handler);
_httpClient.Timeout = TimeSpan.FromSeconds(timeout);
}
public async Task<HtmlAgilityPack.HtmlDocument> RetrieveHtmlDocument(string url)
public async Task<HtmlAgilityPack.HtmlDocument> GetDocument(string url, CancellationToken cancellationToken = default)
{
var sourceCode = await this.RetrieveSourceCode(url);
var sourceCode = await this.GetSource(url, cancellationToken);
if (string.IsNullOrWhiteSpace(sourceCode))
{
return null;
}
var document = new HtmlAgilityPack.HtmlDocument();
try
{
document.LoadHtml(sourceCode);
}
catch (Exception)
{
return null;
}
document.LoadHtml(sourceCode);
return document;
}
public async Task<string> RetrieveSourceCode(string url)
public async Task<string> GetSource(string url, CancellationToken cancellationToken = default)
{
if (string.IsNullOrWhiteSpace(url))
{
return null;
}
if (!Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
var userAgent = GenerateUserAgent();
using var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.UserAgent.ParseAdd(userAgent);
using var response = await _httpClient.SendAsync(request, cancellationToken);
if (!response.IsSuccessStatusCode)
{
return null;
}
System.Net.Http.HttpResponseMessage response;
response.EnsureSuccessStatusCode();
try
{
response = await _webClientProvider.Get(url?.Trim());
}
catch (Exception)
{
return null;
}
if (response == null)
{
return null;
}
if (response.StatusCode != HttpStatusCode.OK)
{
return null;
}
var sourceCode = "";
try
{
sourceCode = await response?.Content?.ReadAsStringAsync();
}
catch (Exception)
{
// do nothing
}
if (string.IsNullOrWhiteSpace(sourceCode))
{
return null;
}
return sourceCode;
return await response.Content.ReadAsStringAsync(cancellationToken);
}
public async Task<Image> RetrieveImage(string url)
public async Task<Image> GetImage(string url, CancellationToken cancellationToken = default)
{
if (string.IsNullOrWhiteSpace(url))
{
return null;
}
if (!Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
{
return null;
}
System.Net.Http.HttpResponseMessage response;
try
{
response = await _webClientProvider.Get(url?.Trim());
var userAgent = GenerateUserAgent();
using var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.UserAgent.ParseAdd(userAgent);
using var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
if (!response.IsSuccessStatusCode)
{
return null;
}
response.EnsureSuccessStatusCode();
var contentType = response.Content.Headers.ContentType?.MediaType;
if (contentType == null || !contentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
{
return null;
}
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken);
using var memoryStream = new MemoryStream();
await stream.CopyToAsync(memoryStream, cancellationToken);
memoryStream.Position = 0;
var image = Image.FromStream(memoryStream);
return new Bitmap(image);
}
catch (Exception)
{
return null;
// Do nothing
}
if (response.StatusCode != HttpStatusCode.OK)
{
return null;
}
var stream = await response?.Content?.ReadAsStreamAsync();
Image result = null;
try
{
result = Image.FromStream(stream);
}
catch (Exception)
{
return null;
}
return result;
}
public async Task<Image> RetrieveImage(string url, HtmlAgilityPack.HtmlDocument document)
{
var iconUrl = this.ParseFavicon(document);
if (string.IsNullOrWhiteSpace(iconUrl))
{
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 null;
}
public string ParseTitle(HtmlAgilityPack.HtmlDocument document)
{
string result = null;
// Find basic title
result = FindNodeValue(document, "//title", string.Empty)?.Trim();
var result = FindNodeValue(document, "//title", string.Empty)?.Trim();
if (!string.IsNullOrWhiteSpace(result))
{
return result;
@ -204,7 +146,7 @@ namespace BookmarkManager.Services
return result;
}
return string.Empty;
return null;
}
public string ParseDescription(HtmlAgilityPack.HtmlDocument document)
@ -272,6 +214,22 @@ namespace BookmarkManager.Services
return string.Empty;
}
public bool IsValidUrl(string url)
{
if (string.IsNullOrWhiteSpace(url))
{
return false;
}
if (!url.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) && !url.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
{
return false;
}
return true;
}
private string FindNodeValue(HtmlAgilityPack.HtmlDocument document, string xPath, string defaultValue = "")
{
var hnc = document.DocumentNode.SelectNodes(xPath);
@ -423,5 +381,48 @@ namespace BookmarkManager.Services
return false;
}
private string GenerateUserAgent()
{
var os = GetWindowsVersion();
var arch = RuntimeInformation.OSArchitecture switch
{
Architecture.X64 => "Win64; x64",
Architecture.X86 => "Win32",
Architecture.Arm64 => "ARM64",
_ => "Win64; x64"
};
var chromeVersion = GetChromeLikeVersion();
return $"Mozilla/5.0 (Windows NT {os}; {arch}) Momozilla/5.0 () AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{chromeVersion} Safari/537.36";
}
private string GetWindowsVersion()
{
var v = Environment.OSVersion.Version;
// Map to common Windows NT versions
return v.Major switch
{
10 => "10.0", // Windows 10/11 both report 10.0
6 when v.Minor == 3 => "6.3", // Windows 8.1
6 when v.Minor == 2 => "6.2", // Windows 8
6 when v.Minor == 1 => "6.1", // Windows 7
_ => $"{v.Major}.{v.Minor}"
};
}
private string GetChromeLikeVersion()
{
// You can hardcode or randomize within a realistic range
var rnd = new Random();
int major = rnd.Next(120, 126); // recent Chrome versions
int build = rnd.Next(0, 7000);
int patch = rnd.Next(0, 200);
return $"{major}.0.{build}.{patch}";
}
}
}

View File

@ -1,438 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using BookmarkManager.Services;
using bzit.bomg.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.PickerBox;
namespace FizzyLauncher
{
public class UpdateIconsForm : Form
{
private System.Windows.Forms.Label label1;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
private Label label2;
private ThYesNoPickerBox pickerBox1;
private ThButton button2;
private RyzStudio.Windows.ThemedForms.ThProgressBar progressBar1;
private readonly WebProvider _webProvider;
private BookmarkTreeView _treeView;
private bool _isBusy = false;
private Label label4;
private THorizontalSeparator tHorizontalSeparator3;
private ThButton button3;
private ThProgressBar progressBar2;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private bool _requestCancel = false;
public UpdateIconsForm(BookmarkTreeView treeView)
{
InitializeComponent();
UISetup.Dialog(this);
_webProvider = new WebProvider();
_webProvider.IgnoreSSL = true;
_treeView = treeView;
}
private void InitializeComponent()
{
label1 = new Label();
tHorizontalSeparator2 = new THorizontalSeparator();
label2 = new Label();
pickerBox1 = new ThYesNoPickerBox();
button2 = new ThButton();
progressBar1 = new ThProgressBar();
label4 = new Label();
tHorizontalSeparator3 = new THorizontalSeparator();
button3 = new ThButton();
progressBar2 = new ThProgressBar();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
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(156, 23);
label1.TabIndex = 153;
label1.Text = "Update Missing Icons (Only)";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tHorizontalSeparator2
//
tHorizontalSeparator2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tHorizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
tHorizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
tHorizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
tHorizontalSeparator2.Location = new System.Drawing.Point(10, 64);
tHorizontalSeparator2.Margin = new Padding(0, 10, 0, 0);
tHorizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
tHorizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
tHorizontalSeparator2.Name = "tHorizontalSeparator2";
tHorizontalSeparator2.Size = new System.Drawing.Size(424, 22);
tHorizontalSeparator2.TabIndex = 190;
tHorizontalSeparator2.TabStop = false;
//
// label2
//
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent;
label2.ForeColor = System.Drawing.SystemColors.ControlText;
label2.Location = new System.Drawing.Point(10, 136);
label2.Margin = new Padding(0);
label2.Name = "label2";
label2.Padding = new Padding(0, 8, 0, 0);
label2.Size = new System.Drawing.Size(231, 23);
label2.TabIndex = 195;
label2.Text = "Retrieve supported icons from bookmarks.";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox1
//
pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox1.BackColor = System.Drawing.Color.Transparent;
pickerBox1.EnableReactiveVisual = true;
pickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
pickerBox1.Location = new System.Drawing.Point(350, 20);
pickerBox1.Name = "pickerBox1";
pickerBox1.Padding = new Padding(4, 4, 3, 3);
pickerBox1.SelectedIndex = 1;
pickerBox1.Size = new System.Drawing.Size(84, 35);
pickerBox1.TabIndex = 0;
pickerBox1.TabStop = false;
pickerBox1.Value = true;
//
// button2
//
button2.ActiveImage = null;
button2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
button2.BackColor = System.Drawing.Color.Transparent;
button2.EnableMenuOnClick = false;
button2.EnableReactiveVisual = true;
button2.HoverImage = null;
button2.IdleImage = null;
button2.LabelText = "&Run";
button2.Location = new System.Drawing.Point(306, 136);
button2.Name = "button2";
button2.Padding = new Padding(4, 4, 3, 3);
button2.Size = new System.Drawing.Size(128, 32);
button2.TabIndex = 1;
button2.TabStop = false;
button2.MouseClick += button2_MouseClick;
//
// progressBar1
//
progressBar1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
progressBar1.BackColor = System.Drawing.Color.Transparent;
progressBar1.BarColour = System.Drawing.Color.FromArgb(79, 202, 130);
progressBar1.BarTextColour = System.Drawing.Color.Black;
progressBar1.EnableReactiveVisual = false;
progressBar1.Font = new System.Drawing.Font("Segoe UI", 9F);
progressBar1.Location = new System.Drawing.Point(10, 96);
progressBar1.Maximum = 100;
progressBar1.Minimum = 0;
progressBar1.Name = "progressBar1";
progressBar1.Padding = new Padding(4, 4, 3, 3);
progressBar1.ProgressText = "50/100";
progressBar1.ShowProgressText = true;
progressBar1.Size = new System.Drawing.Size(424, 20);
progressBar1.TabIndex = 206;
progressBar1.TabStop = false;
progressBar1.Value = 50;
//
// label4
//
label4.AutoSize = true;
label4.BackColor = System.Drawing.Color.Transparent;
label4.ForeColor = System.Drawing.SystemColors.ControlText;
label4.Location = new System.Drawing.Point(10, 250);
label4.Margin = new Padding(0);
label4.Name = "label4";
label4.Padding = new Padding(0, 8, 0, 0);
label4.Size = new System.Drawing.Size(83, 23);
label4.TabIndex = 208;
label4.Text = "Clear all icons.";
label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tHorizontalSeparator3
//
tHorizontalSeparator3.Anchor = AnchorStyles.Top | 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, 178);
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.BackColor = System.Drawing.Color.Transparent;
button3.EnableMenuOnClick = false;
button3.EnableReactiveVisual = true;
button3.HoverImage = null;
button3.IdleImage = null;
button3.LabelText = "Clear &All";
button3.Location = new System.Drawing.Point(306, 250);
button3.Name = "button3";
button3.Padding = new Padding(4, 4, 3, 3);
button3.Size = new System.Drawing.Size(128, 32);
button3.TabIndex = 209;
button3.TabStop = false;
button3.MouseClick += button3_MouseClick;
//
// progressBar2
//
progressBar2.Anchor = AnchorStyles.Top | 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, 210);
progressBar2.Maximum = 100;
progressBar2.Minimum = 0;
progressBar2.Name = "progressBar2";
progressBar2.Padding = new Padding(4, 4, 3, 3);
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, 477);
dialogFooter1.Name = "dialogFooter1";
dialogFooter1.Size = new System.Drawing.Size(444, 84);
//
// UpdateIconsForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = System.Drawing.Color.White;
ClientSize = new System.Drawing.Size(444, 561);
Controls.Add(dialogFooter1);
Controls.Add(progressBar2);
Controls.Add(button3);
Controls.Add(label4);
Controls.Add(tHorizontalSeparator3);
Controls.Add(progressBar1);
Controls.Add(button2);
Controls.Add(pickerBox1);
Controls.Add(label2);
Controls.Add(tHorizontalSeparator2);
Controls.Add(label1);
KeyPreview = true;
MinimumSize = new System.Drawing.Size(460, 600);
Name = "UpdateIconsForm";
Text = "Update Icons";
ResumeLayout(false);
PerformLayout();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
var model = _treeView.ToNodeList<BookmarkModel>();
if (pickerBox1.Value)
{
model = model.Where(x => x.Value.Icon == null)?.ToList() ?? new List<KeyValuePair<TreeNode, BookmarkModel>>();
}
progressBar1.Minimum = 0;
progressBar1.Value = 0;
progressBar1.Maximum = model.Count;
progressBar2.Minimum = 0;
progressBar2.Value = 0;
progressBar2.Maximum = model.Count;
pickerBox1.Focus();
}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
if (this.IsBusy)
{
e.Cancel = true;
}
}
protected bool IsBusy
{
get => _isBusy;
set
{
_isBusy = value;
UIControl.SetEnable(pickerBox1, !this.IsBusy);
UIControl.Invoke(button2, (x) =>
{
button2.LabelText = (this.IsBusy ? "&Stop" : "&Run");
});
UIControl.Invoke(button3, (x) =>
{
button3.LabelText = (this.IsBusy ? "&Stop" : "Clear &All");
});
dialogFooter1.IsBusy = _isBusy;
}
}
private async void button2_MouseClick(object sender, MouseEventArgs e)
{
await Task.Run(async () =>
{
if (this.IsBusy)
{
_requestCancel = true;
return;
}
this.IsBusy = true;
var model = _treeView.ToNodeList<BookmarkModel>();
if (pickerBox1.Value)
{
model = model.Where(x => x.Value.Icon == null)?.ToList() ?? new List<KeyValuePair<TreeNode, BookmarkModel>>();
}
progressBar1.Minimum = 0;
progressBar1.Value = 0;
progressBar1.Maximum = model.Count;
foreach (var item in model)
{
progressBar1.Value++;
if (string.IsNullOrWhiteSpace(item.Value.Address))
{
continue;
}
if (_requestCancel)
{
break;
}
var document = await _webProvider.RetrieveHtmlDocument(item.Value.Address);
if (document == null)
{
continue;
}
if (_requestCancel)
{
break;
}
var newModel = item.Value;
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);
}
_requestCancel = false;
this.IsBusy = false;
});
}
private async void button3_MouseClick(object sender, MouseEventArgs e)
{
await Task.Run(() =>
{
if (this.IsBusy)
{
_requestCancel = true;
return;
}
this.IsBusy = true;
var model = _treeView.ToNodeList<BookmarkModel>();
progressBar2.Minimum = 0;
progressBar2.Value = 0;
progressBar2.Maximum = model.Count;
foreach (var item in model)
{
progressBar2.Value++;
if (item.Value.Icon == null)
{
continue;
}
if (_requestCancel)
{
break;
}
var newModel = item.Value;
newModel.Icon = null;
_treeView.UpdateNode(item.Key, newModel);
}
_requestCancel = false;
this.IsBusy = false;
});
}
}
}

View File

@ -4,14 +4,17 @@ using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using bzit.bomg.Models;
using FizzyLauncher;
using Resources = BookmarkManager.AppResource;
using BukkuBuddy;
using BukkuBuddy.DTOs.SaveFile;
using BukkuBuddy.Resources;
namespace RyzStudio.Windows.Forms
{
public partial class BookmarkTreeView : TTreeView
{
public delegate bool EditNodeDelegate(BookmarkTreeView sender, TreeNode node, App6Options.Item model);
public delegate void OnChangedDelegate(BookmarkTreeView sender, bool hasChanged);
public enum NodeIcon
{
Root = 0,
@ -30,6 +33,7 @@ namespace RyzStudio.Windows.Forms
protected const string DEFAULT_NEW_FOLDER_NAME = "New Folder";
protected const string DEFAULT_NEW_PAGE_NAME = "New Page";
public BookmarkTreeView()
@ -43,7 +47,7 @@ namespace RyzStudio.Windows.Forms
this.ImageList.ImageSize = new Size(16, 16);
this.ImageList.TransparentColor = Color.Transparent;
ClearImageList();
this.Clear(false, true);
}
@ -74,7 +78,7 @@ namespace RyzStudio.Windows.Forms
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
{
TreeNode tn = this.SelectedNode;
var tn = this.SelectedNode;
if (tn == null)
{
return;
@ -142,7 +146,7 @@ namespace RyzStudio.Windows.Forms
break;
case NodeType.Page:
var viewModel = UIControl.GetTag<BookmarkModel>(this.SelectedNode);
var viewModel = UIControl.GetTag<App6Options.Item>(this.SelectedNode);
if (viewModel != null)
{
try
@ -203,11 +207,22 @@ namespace RyzStudio.Windows.Forms
set
{
base.HasChanged = value;
if (this.OnChanged != null)
{
this.OnChanged(this, value);
}
}
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public EditNodeDelegate OnEditNode { get; set; }
public TreeNode AddFolder(TreeNode node = null, string name = "", bool quol = true)
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new OnChangedDelegate OnChanged { get; set; }
public TreeNode AddFolder(TreeNode node = null, string name = "")
{
if (node == null)
{
@ -228,14 +243,11 @@ namespace RyzStudio.Windows.Forms
var key = EncodeNodeName(name);
var treeNode = node.Nodes.Add(key, name, (int)NodeIcon.Folder1, (int)NodeIcon.Folder2);
if (quol)
{
node.Expand();
node.Expand();
this.SelectedNode = treeNode;
this.SelectedNode = treeNode;
this.EditNode(treeNode);
}
this.EditNode(treeNode);
this.HasChanged = true;
@ -249,45 +261,65 @@ namespace RyzStudio.Windows.Forms
node = this.SelectedNode;
}
if (this.OnEditNode == null)
{
return null;
}
var nodeType = GetNodeType(node);
if ((nodeType != NodeType.Root) && (nodeType != NodeType.Folder))
{
return null;
}
var form = new EditBookmarkForm();
if (form.ShowDialog() == DialogResult.OK)
var newItem = new App6Options.Item()
{
var model = form.Result;
model.Path = GetNodePath(node);
Id = Guid.NewGuid(),
Title = DEFAULT_NEW_PAGE_NAME,
Path = GetNodePath(node)
};
var newNode = this.AddNode(model);
if (newNode != null)
{
newNode.EnsureVisible();
var newNode = this.AddNode(newItem);
this.SelectedNode = newNode;
var result = this.OnEditNode(this, newNode, newItem);
if (result)
{
newNode.EnsureVisible();
this.HasChanged = true;
this.SelectedNode = newNode;
this.HasChanged = true;
return newNode;
}
return newNode;
}
else
{
this.DeleteNode(newNode);
return null;
return null;
}
}
public TreeNode AddNode(BookmarkModel model)
public TreeNode AddNode(App6Options.Item model)
{
if (model.Id == Guid.Empty)
{
model.Id = Guid.NewGuid();
}
var parentNode = this.CreateNodePath(model?.Path?.Trim() ?? string.Empty, (int)NodeIcon.Folder1, (int)NodeIcon.Folder2);
// Add custom favicon
var n = AddImage(model.Id.ToString(), model.Icon);
var hasIcon = AddImage(model.Id.ToString(), model.Icon);
TreeNode newNode = new TreeNode(model?.Title?.Trim() ?? string.Empty, n, n);
var newNode = new TreeNode(model?.Title?.Trim() ?? string.Empty, (int)NodeIcon.Default, (int)NodeIcon.Default);
newNode.Tag = model;
newNode.ToolTipText = model.ToString();
if (hasIcon)
{
newNode.ImageKey = newNode.SelectedImageKey = model.Id.ToString();
}
UIControl.Add(parentNode, newNode);
this.HasChanged = true;
@ -295,16 +327,28 @@ namespace RyzStudio.Windows.Forms
return newNode;
}
public void Clear(string rootName)
public void Clear(bool deleteNodes, bool deleteIcons, string rootName = "")
{
ClearImageList();
UIControl.Clear(this);
UIControl.Invoke(this, (x) =>
if (deleteNodes)
{
this.Nodes.Add("", rootName?.Trim() ?? string.Empty, (int)NodeIcon.Root, (int)NodeIcon.Root);
});
UIControl.Invoke(this, (x) =>
{
this.Nodes.Clear();
this.Nodes.Add("", rootName?.Trim() ?? string.Empty, (int)NodeIcon.Root, (int)NodeIcon.Root);
});
}
if (deleteIcons)
{
UIControl.Invoke(this, (x) =>
{
this.ImageList.Images.Clear();
this.ImageList.Images.Add(TreeViewResource.bookmark_root);
this.ImageList.Images.Add(TreeViewResource.folder);
this.ImageList.Images.Add(TreeViewResource.folder_symlink);
this.ImageList.Images.Add("default", TreeViewResource.file_question_mark);
});
}
this.HasChanged = true;
}
@ -330,14 +374,10 @@ namespace RyzStudio.Windows.Forms
}
else if (nodeType == NodeType.Page)
{
var model = UIControl.GetTag<BookmarkModel>(node);
var model = UIControl.GetTag<App6Options.Item>(node);
model.Path = GetNodePath(node);
var form = new EditBookmarkForm(model);
if (form.ShowDialog() == DialogResult.OK)
{
this.UpdateNode(node, form.Result);
}
if (this.OnEditNode != null) this.OnEditNode(this, node, model);
}
return node;
@ -368,7 +408,7 @@ namespace RyzStudio.Windows.Forms
}
else
{
if (node.Tag is BookmarkModel)
if (node.Tag is App6Options.Item)
{
return NodeType.Page;
}
@ -379,11 +419,10 @@ namespace RyzStudio.Windows.Forms
}
}
public void UpdateNode(TreeNode node, BookmarkModel model)
public void UpdateNode(TreeNode node, App6Options.Item model)
{
if (node == null)
{
node = this.SelectedNode;
return;
}
@ -397,32 +436,38 @@ namespace RyzStudio.Windows.Forms
return;
}
// Update custom favicon
var n = AddImage(model.Id.ToString(), model.Icon);
// Replace icon
var hasIcon = AddImage(model.Id.ToString(), model.Icon);
UIControl.Invoke(this, (x) =>
{
node.Text = model.Title;
node.ImageIndex = node.SelectedImageIndex = n;
node.ImageIndex = node.SelectedImageIndex = (int)NodeIcon.Default;
node.Tag = model;
node.ToolTipText = model.ToString();
if (hasIcon)
{
node.ImageKey = node.SelectedImageKey = model.Id.ToString();
}
});
this.HasChanged = true;
}
public List<string> GetAllDirectories()
public List<string> GetAllNodePaths()
{
var result = GetAllNodes(this.Nodes);
var result = this.GetAllNodes(this.Nodes);
return result.Where(x => this.GetNodeType(x) == NodeType.Folder)
.Select(x => this.GetNodePath(x))
?.ToList() ?? new List<string>();
.Select(x => this.GetNodePath(x))
?.ToList()
?? new List<string>();
}
public List<KeyValuePair<TreeNode, BookmarkModel>> GetAllNodes()
public List<KeyValuePair<TreeNode, App6Options.Item>> GetAllItems()
{
var result = this.ToNodeList<BookmarkModel>() ?? new List<KeyValuePair<TreeNode, BookmarkModel>>();
var result = this.ToNodeList<App6Options.Item>() ?? new List<KeyValuePair<TreeNode, App6Options.Item>>();
foreach (var node in result)
{
node.Value.Path = this.GetNodePath(node.Key);
@ -436,60 +481,49 @@ namespace RyzStudio.Windows.Forms
return result;
}
private void ClearImageList()
private bool AddImage(string key, Image image)
{
UIControl.Invoke(this, (x) =>
{
this.ImageList.Images.Clear();
this.ImageList.Images.Add(Resources.hexagon);
this.ImageList.Images.Add(Resources.folder);
this.ImageList.Images.Add(Resources.folder_explore);
this.ImageList.Images.Add("default", Resources.file_text);
if (this.ImageList.Images.ContainsKey(key))
{
this.ImageList.Images.RemoveByKey(key);
}
});
}
private int AddImage(string key, Image image)
{
if (image == null)
{
return (int)NodeIcon.Default;
return false;
}
try
{
if (image.Width <= 0)
{
return (int)NodeIcon.Default;
return false;
}
}
catch (Exception)
{
return (int)NodeIcon.Default;
return false;
}
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);
this.ImageList.Images.Add(key, new Bitmap(image));
});
return this.ImageList.Images.IndexOfKey(key);
return true;
}
private List<TreeNode> GetAllNodes(TreeNodeCollection nodes)
{
var result = new List<TreeNode>();
foreach (TreeNode node in nodes)
foreach (var node in nodes.OfType<TreeNode>())
{
result.Add(node);
result.AddRange(GetAllNodes(node.Nodes));
result.AddRange(this.GetAllNodes(node.Nodes));
}
return result;

View File

@ -4,12 +4,12 @@ RMDIR /s /q "obj\"
MKDIR bin
dotnet restore skye.sln
dotnet build skye.sln -c Release -o ./bin/
#dotnet build skye.sln -c Release -o ./bin/
dotnet publish skye.sln -r win-x64 -c Release /p:PublishSingleFile=true /p:SelfContained=false /p:PublishReadyToRunfalse=true /p:PublishDir="bin\"
"C:\B\Portable Files (dev)\Inno Setup\v6.0.4-2\app\ISCC.exe" "build-installer.iss"
"C:\B\Portable Files\7-Zip (Portable)\23.01\App\7-Zip64\7z.exe" a -t7z "bin\bukkubuddy.7z" ".\bin\bukkubuddy.exe" -mx9
"C:\B\Portable Files\7-Zip (Portable)\25.01\App\7-Zip64\7z.exe" a -t7z "bin\bukkubuddy.7z" ".\bin\bukkubuddy.exe" -mx9
RMDIR /s /q "bin\debug"
RMDIR /s /q "bin\release"

View File

@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
# Visual Studio Version 18
VisualStudioVersion = 18.5.11801.241 oobstable
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookmarkManager", "BookmarkManager.csproj", "{4833FB27-0817-4720-A54B-180369B0C374}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BukkuBuddy", "BukkuBuddy.csproj", "{4833FB27-0817-4720-A54B-180369B0C374}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution