Added search/find form

Added update-icon form
Changed build script
Removed unused offline references
This commit is contained in:
Ray 2024-07-18 17:28:21 +01:00
parent 9b7dd4bdc9
commit 9c461c74d1
9 changed files with 241 additions and 99 deletions

View File

@ -14,7 +14,7 @@
<Copyright>Ray Lam</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Version>0.6.0.607</Version>
<Version>0.6.0.716</Version>
<PackageId>bookmarkmanager</PackageId>
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
@ -115,11 +115,8 @@
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ryzstudio8\core\RyzStudio.csproj" />
<ProjectReference Include="..\ryzstudio8\windows.forms\RyzStudio.Windows.Forms.csproj" />
<PackageReference Include="RyzStudio" Version="8.1.2.249" />
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.229" />
</ItemGroup>
</Project>

View File

@ -1,6 +1,8 @@
using System;
using System.ComponentModel;
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;
@ -17,13 +19,18 @@ namespace FizzyLauncher
private BookmarkTreeView treeView1 = null;
private bool findNextNew = false;
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;
@ -139,16 +146,12 @@ namespace FizzyLauncher
}
[Browsable(false)]
public string Password => textBox1.Text;
private void textBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Enter:
if (findNextNew)
if (findPosition < 0)
{
button1_MouseClick(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
@ -161,39 +164,93 @@ namespace FizzyLauncher
case Keys.Escape:
this.Close();
break;
default: 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;
// findNextNew = false;
// treeView1.FindTextNode(treeView1.Nodes[0], textBox1.Text?.Trim());
//}
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 (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)
//{
// if (string.IsNullOrWhiteSpace(textBox1.Text)) return;
// if (treeView1.Nodes.Count <= 0) return;
// if (treeView1.SelectedNode == null) treeView1.SelectedNode = treeView1.Nodes[0];
// findNextNew = false;
// bool rv = treeView1.FindTextNode(treeView1.SelectedNode, textBox1.Text?.Trim());
// if (!rv)
// {
// findNextNew = true;
// }
// findPosition = -1;
//} else {
// findPosition = pos;
//}
findPosition++;
if (findPosition >= node.Count)
{
findPosition = 0;
}
treeView1.SelectedNode = node[findPosition];
treeView1.SelectedNode.EnsureVisible();
}
}
}
}

View File

@ -6,7 +6,6 @@ using System.Drawing.Imaging;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows.Forms;
using BookmarkManager;
@ -15,9 +14,6 @@ using bzit.bomg.Models;
using FizzyLauncher.Models;
using RyzStudio;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.TileForms;
using static System.Collections.Specialized.BitVector32;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace FizzyLauncher
{
@ -50,7 +46,6 @@ namespace FizzyLauncher
treeView1.FolderContextMenu = folderContextMenu;
treeView1.PageContextMenu = pageContextMenu;
treeView1.NodeMouseDoubleClick += treeView1_NodeMouseDoubleClick;
treeView1.OnChanged += treeView1_OnChanged;
treeView1.PreviewKeyDown += treeView1_PreviewKeyDown;
}
@ -82,11 +77,6 @@ namespace FizzyLauncher
{
base.OnClosing(e);
//if (this.CurrentSession == null)
//{
// this.CurrentSession = new AppOptions();
//}
await _fileSessionManager.CloseSession();
}
@ -111,7 +101,7 @@ namespace FizzyLauncher
{
closeToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open);
saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open) && treeView1.HasChanged;
saveAsToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
findToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
@ -224,13 +214,13 @@ namespace FizzyLauncher
/// <param name="e"></param>
private void findToolStripMenuItem_Click(object sender, EventArgs e)
{
//if (this.IsBusy)
//{
// return;
//}
if (this.IsBusy)
{
return;
}
//var form = new FindForm(treeView1);
//form.Show();
var form = new FindForm(treeView1);
form.ShowDialog();
}
@ -836,6 +826,8 @@ namespace FizzyLauncher
default:
break;
}
treeView1.HasChanged = false;
});
}
@ -866,14 +858,6 @@ namespace FizzyLauncher
await OpenBookmark(e.Node);
}
private void treeView1_OnChanged(object sender, EventArgs e)
{
if (treeView1.HasChanged)
{
_fileSessionManager.HasChanged = treeView1.HasChanged;
}
}
private AppOptions LoadR4SaveFile(string filename)
{
@ -999,11 +983,6 @@ namespace FizzyLauncher
{
foreach (var item in items)
{
if (item.Icon == null)
{
continue;
}
var key = "icon\\" + item.Id.ToString() + ".png";
var zipEntry = archive.GetEntry(key);
if (zipEntry != null)
@ -1011,6 +990,11 @@ namespace FizzyLauncher
zipEntry.Delete();
}
if (item.Icon == null)
{
continue;
}
zipEntry = archive.CreateEntry(key, CompressionLevel.SmallestSize);
using (Stream entryStream = zipEntry.Open())

Binary file not shown.

View File

@ -23,14 +23,14 @@ namespace FizzyLauncher
private ThYesNoPickerBox pickerBox1;
private ThButton button2;
private RyzStudio.Windows.ThemedForms.ThProgressBar progressBar1;
private Label label3;
private ThProgressBar thProgressBar1;
private System.ComponentModel.IContainer components;
private readonly WebProvider _webProvider;
private BookmarkTreeView _treeView;
private bool _isBusy = false;
private Label label4;
private THorizontalSeparator tHorizontalSeparator3;
private ThButton button3;
private bool _requestCancel = false;
@ -56,7 +56,10 @@ namespace FizzyLauncher
pickerBox1 = new ThYesNoPickerBox();
button2 = new ThButton();
progressBar1 = new ThProgressBar();
((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit();
label4 = new Label();
tHorizontalSeparator3 = new THorizontalSeparator();
button3 = new ThButton();
((ISupportInitialize)pictureBox2).BeginInit();
SuspendLayout();
//
// label1
@ -131,9 +134,9 @@ namespace FizzyLauncher
label2.Margin = new Padding(0);
label2.Name = "label2";
label2.Padding = new Padding(0, 8, 0, 0);
label2.Size = new System.Drawing.Size(289, 23);
label2.Size = new System.Drawing.Size(231, 23);
label2.TabIndex = 195;
label2.Text = "Attempt to retrieve supported icons from bookmarks.";
label2.Text = "Retrieve supported icons from bookmarks.";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pictureBox2
@ -208,11 +211,62 @@ namespace FizzyLauncher
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, 245);
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, 212);
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.AcceptButton = null;
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(10, 288);
button3.Margin = new Padding(10, 10, 10, 0);
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;
//
// UpdateIconsForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(444, 521);
Controls.Add(button3);
Controls.Add(label4);
Controls.Add(tHorizontalSeparator3);
Controls.Add(progressBar1);
Controls.Add(button2);
Controls.Add(pickerBox1);
@ -226,7 +280,7 @@ namespace FizzyLauncher
MinimumSize = new System.Drawing.Size(460, 560);
Name = "UpdateIconsForm";
Text = "Update Icons";
((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit();
((ISupportInitialize)pictureBox2).EndInit();
ResumeLayout(false);
PerformLayout();
}
@ -237,6 +291,11 @@ namespace FizzyLauncher
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;
@ -263,10 +322,12 @@ namespace FizzyLauncher
_isBusy = value;
UIControl.SetEnable(pickerBox1, !this.IsBusy);
UIControl.Invoke(button2, (x) => {
UIControl.Invoke(button2, (x) =>
{
button2.LabelText = (this.IsBusy ? "&Stop" : "&Run");
});
UIControl.SetValue(pictureBox2, (this.IsBusy ? RyzStudio.Windows.ThemedForms.Resource2.loading_block : null));
UIControl.SetEnable(button3, !this.IsBusy);
UIControl.SetEnable(button1, !this.IsBusy);
}
}
@ -338,5 +399,38 @@ namespace FizzyLauncher
});
}
private async void button3_MouseClick(object sender, MouseEventArgs e)
{
await Task.Run(() =>
{
if (this.IsBusy)
{
return;
}
this.IsBusy = true;
var model = _treeView.ToNodeList<BookmarkModel>();
foreach (var item in model)
{
progressBar1.Value++;
if (item.Value.Icon == null)
{
continue;
}
var newModel = item.Value;
newModel.Icon = null;
_treeView.UpdateNode(item.Key, newModel);
}
_requestCancel = false;
this.IsBusy = false;
});
}
}
}

View File

@ -202,6 +202,16 @@ namespace RyzStudio.Windows.Forms
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ContextMenuStrip PageContextMenu { get; set; } = null;
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new bool HasChanged
{
get => base.HasChanged;
set
{
base.HasChanged = value;
}
}
public TreeNode AddFolder(TreeNode node = null, string name = "", bool quol = true)
{
@ -409,8 +419,6 @@ namespace RyzStudio.Windows.Forms
var iconIndex = (int)NodeIcon.Default;
// Update custom favicon
if (model.Icon != null)
{
var iconKey = model.Id.ToString();
if (!string.IsNullOrWhiteSpace(iconKey))
{
@ -420,7 +428,12 @@ namespace RyzStudio.Windows.Forms
{
this.ImageList.Images.RemoveByKey(iconKey);
}
});
if (model.Icon != null)
{
UIControl.Invoke(this, (x) =>
{
this.ImageList.Images.Add(iconKey, model.Icon);
});

View File

@ -2,13 +2,13 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Bookmark Manager"
#define MyAppVersion "0.5.0.012"
#define MyAppVersion "0.6.0.716"
#define MyAppPublisher "Hi, I'm Ray"
#define MyAppURL "https://www.hiimray.co.uk/software-bookmark-manager"
#define MyAppExeName "bookmarkmanager.exe"
#define AppSourcePath "L:\gitea-hiimray\bookmark-manager-r4\bin\Release\64"
#define AppReleasePath "L:\gitea-hiimray\bookmark-manager-r4\bin\Release"
#define AppSourcePath "L:\gitea-hiimray\bookmark-manager-r4\bin"
#define AppReleasePath "L:\gitea-hiimray\bookmark-manager-r4\bin"
#define AppReleaseName "bookmark-manager"
[Setup]
@ -40,7 +40,6 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
[Files]
Source: "{#AppSourcePath}\bookmarkmanager.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#AppSourcePath}\e_sqlite3.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]

View File

@ -1,7 +1,17 @@
rmdir /s /q "bin\Release\"
dotnet publish skye.sln -r win-x64 -c Release /p:PublishSingleFile=true /p:SelfContained=false /p:PublishReadyToRunfalse=true /p:PublishDir="bin\Release\64\"
RMDIR /s /q "bin\"
RMDIR /s /q "obj\"
MKDIR bin
dotnet restore skye.sln
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"
cd "bin\Release\64\"
"C:\B\Portable Files\PeaZip (Portable)\v6.5.1\App\PeaZip\res\7z\7z.exe" a -t7z "..\bookmark-manager.7z" "*" -mx9
"C:\B\Portable Files\7-Zip (Portable)\23.01\App\7-Zip64\7z.exe" a -t7z "bin\bookmarkmanager.7z" ".\bin\bookmarkmanager.exe" -mx9
RMDIR /s /q "bin\debug"
RMDIR /s /q "bin\release"
RMDIR /s /q "obj\"
PAUSE

View File

@ -5,10 +5,6 @@ VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookmarkManager", "BookmarkManager.csproj", "{4833FB27-0817-4720-A54B-180369B0C374}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RyzStudio", "..\ryzstudio8\core\RyzStudio.csproj", "{6AF988B5-DA13-46F2-B3D0-505C2681A296}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RyzStudio.Windows.Forms", "..\ryzstudio8\windows.forms\RyzStudio.Windows.Forms.csproj", "{A1656CB4-4A0A-469B-9DC9-8C89188FEC98}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -19,14 +15,6 @@ Global
{4833FB27-0817-4720-A54B-180369B0C374}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4833FB27-0817-4720-A54B-180369B0C374}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4833FB27-0817-4720-A54B-180369B0C374}.Release|Any CPU.Build.0 = Release|Any CPU
{6AF988B5-DA13-46F2-B3D0-505C2681A296}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6AF988B5-DA13-46F2-B3D0-505C2681A296}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AF988B5-DA13-46F2-B3D0-505C2681A296}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AF988B5-DA13-46F2-B3D0-505C2681A296}.Release|Any CPU.Build.0 = Release|Any CPU
{A1656CB4-4A0A-469B-9DC9-8C89188FEC98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1656CB4-4A0A-469B-9DC9-8C89188FEC98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1656CB4-4A0A-469B-9DC9-8C89188FEC98}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1656CB4-4A0A-469B-9DC9-8C89188FEC98}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE