This commit is contained in:
Ray 2019-04-20 17:05:55 +01:00
parent 0e70f6b56e
commit 18dc43e491
12 changed files with 523 additions and 470 deletions

View File

@ -125,7 +125,7 @@ namespace bzit.bomg
this.memoBox1.Name = "memoBox1"; this.memoBox1.Name = "memoBox1";
this.memoBox1.Padding = new System.Windows.Forms.Padding(10, 10, 3, 9); this.memoBox1.Padding = new System.Windows.Forms.Padding(10, 10, 3, 9);
this.memoBox1.Size = new System.Drawing.Size(336, 83); this.memoBox1.Size = new System.Drawing.Size(336, 83);
this.memoBox1.TabIndex = 69; this.memoBox1.TabIndex = 3;
// //
// textBox2 // textBox2
// //
@ -137,7 +137,7 @@ namespace bzit.bomg
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox2.Size = new System.Drawing.Size(259, 32); this.textBox2.Size = new System.Drawing.Size(259, 32);
this.textBox2.TabIndex = 67; this.textBox2.TabIndex = 0;
// //
// textBox1 // textBox1
// //
@ -149,7 +149,7 @@ namespace bzit.bomg
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox1.Size = new System.Drawing.Size(259, 32); this.textBox1.Size = new System.Drawing.Size(259, 32);
this.textBox1.TabIndex = 66; this.textBox1.TabIndex = 2;
// //
// horizontalSeparator1 // horizontalSeparator1
// //
@ -174,7 +174,7 @@ namespace bzit.bomg
this.button1.OverImage = null; this.button1.OverImage = null;
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(64, 32); this.button1.Size = new System.Drawing.Size(64, 32);
this.button1.TabIndex = 2; this.button1.TabIndex = 1;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// button2 // button2

View File

@ -134,6 +134,16 @@ namespace bzit.bomg
return; return;
} }
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
return;
}
if (string.IsNullOrWhiteSpace(textBox2.Text))
{
return;
}
if (itemModel == null) if (itemModel == null)
{ {
itemModel = new BookmarkItemModel(); itemModel = new BookmarkItemModel();

View File

@ -3,7 +3,7 @@ using System.Drawing;
using System.IO; using System.IO;
using RyzStudio.Data.SQLite; using RyzStudio.Data.SQLite;
namespace bzit.bomg namespace bzit.bomg.Data
{ {
public class IconDatabase : SQLiteDatabase2 public class IconDatabase : SQLiteDatabase2
{ {
@ -30,8 +30,6 @@ namespace bzit.bomg
") >= 0; ") >= 0;
} }
#region public methods
public bool HasIcon(string url) public bool HasIcon(string url)
{ {
return this.DoQueryExist("SELECT 1 FROM bzt_app_bomg_icons WHERE ico_key='" + escapeValue(url) + "'"); return this.DoQueryExist("SELECT 1 FROM bzt_app_bomg_icons WHERE ico_key='" + escapeValue(url) + "'");
@ -102,8 +100,6 @@ namespace bzit.bomg
this.DoNonQuery("DELETE FROM bzt_app_bomg_icons WHERE ico_key='" + escapeValue(url) + "';"); this.DoNonQuery("DELETE FROM bzt_app_bomg_icons WHERE ico_key='" + escapeValue(url) + "';");
} }
#endregion
protected string imageToSQLString(Image image) protected string imageToSQLString(Image image)
{ {
MemoryStream stream = new MemoryStream(); MemoryStream stream = new MemoryStream();
@ -115,10 +111,7 @@ namespace bzit.bomg
return bytesToSQLString(byteArray); return bytesToSQLString(byteArray);
} }
protected string bytesToSQLString(byte[] image) protected string bytesToSQLString(byte[] image) => Convert.ToBase64String(image);
{
return Convert.ToBase64String(image);
}
protected Image sqlStringToImage(string base64_string) protected Image sqlStringToImage(string base64_string)
{ {

39
MainForm.Designer.cs generated
View File

@ -98,6 +98,7 @@ namespace bzit.bomg
this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem22 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem22 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView(); this.treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView();
this.pageTreeNodeMenu.SuspendLayout(); this.pageTreeNodeMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
@ -326,7 +327,7 @@ namespace bzit.bomg
this.findEditMenuItem.Image = global::bzit.bomg.Properties.Resources.magnifier; this.findEditMenuItem.Image = global::bzit.bomg.Properties.Resources.magnifier;
this.findEditMenuItem.Name = "findEditMenuItem"; this.findEditMenuItem.Name = "findEditMenuItem";
this.findEditMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); this.findEditMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
this.findEditMenuItem.Size = new System.Drawing.Size(180, 22); this.findEditMenuItem.Size = new System.Drawing.Size(137, 22);
this.findEditMenuItem.Text = "&Find"; this.findEditMenuItem.Text = "&Find";
this.findEditMenuItem.Click += new System.EventHandler(this.toolStripButton5_Click); this.findEditMenuItem.Click += new System.EventHandler(this.toolStripButton5_Click);
// //
@ -346,7 +347,7 @@ namespace bzit.bomg
// //
this.expandAllViewMenuItem.Enabled = false; this.expandAllViewMenuItem.Enabled = false;
this.expandAllViewMenuItem.Name = "expandAllViewMenuItem"; this.expandAllViewMenuItem.Name = "expandAllViewMenuItem";
this.expandAllViewMenuItem.Size = new System.Drawing.Size(180, 22); this.expandAllViewMenuItem.Size = new System.Drawing.Size(136, 22);
this.expandAllViewMenuItem.Text = "&Expand All"; this.expandAllViewMenuItem.Text = "&Expand All";
this.expandAllViewMenuItem.Click += new System.EventHandler(this.expandAllToolStripMenuItem_Click); this.expandAllViewMenuItem.Click += new System.EventHandler(this.expandAllToolStripMenuItem_Click);
// //
@ -354,7 +355,7 @@ namespace bzit.bomg
// //
this.collapseAllViewMenuItem.Enabled = false; this.collapseAllViewMenuItem.Enabled = false;
this.collapseAllViewMenuItem.Name = "collapseAllViewMenuItem"; this.collapseAllViewMenuItem.Name = "collapseAllViewMenuItem";
this.collapseAllViewMenuItem.Size = new System.Drawing.Size(180, 22); this.collapseAllViewMenuItem.Size = new System.Drawing.Size(136, 22);
this.collapseAllViewMenuItem.Text = "&Collapse All"; this.collapseAllViewMenuItem.Text = "&Collapse All";
this.collapseAllViewMenuItem.Click += new System.EventHandler(this.collapseAllToolStripMenuItem_Click); this.collapseAllViewMenuItem.Click += new System.EventHandler(this.collapseAllToolStripMenuItem_Click);
// //
@ -374,14 +375,14 @@ namespace bzit.bomg
// updateIconsToolMenuItem // updateIconsToolMenuItem
// //
this.updateIconsToolMenuItem.Name = "updateIconsToolMenuItem"; this.updateIconsToolMenuItem.Name = "updateIconsToolMenuItem";
this.updateIconsToolMenuItem.Size = new System.Drawing.Size(180, 22); this.updateIconsToolMenuItem.Size = new System.Drawing.Size(143, 22);
this.updateIconsToolMenuItem.Text = "&Update Icons"; this.updateIconsToolMenuItem.Text = "&Update Icons";
this.updateIconsToolMenuItem.Click += new System.EventHandler(this.toolStripMenuItem1_Click); this.updateIconsToolMenuItem.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
// //
// toolStripSeparator14 // toolStripSeparator14
// //
this.toolStripSeparator14.Name = "toolStripSeparator14"; this.toolStripSeparator14.Name = "toolStripSeparator14";
this.toolStripSeparator14.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator14.Size = new System.Drawing.Size(140, 6);
// //
// optionsToolMenuItem // optionsToolMenuItem
// //
@ -389,7 +390,7 @@ namespace bzit.bomg
this.optionsToolMenuItem.Image = global::bzit.bomg.Properties.Resources.cog; this.optionsToolMenuItem.Image = global::bzit.bomg.Properties.Resources.cog;
this.optionsToolMenuItem.Name = "optionsToolMenuItem"; this.optionsToolMenuItem.Name = "optionsToolMenuItem";
this.optionsToolMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12; this.optionsToolMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12;
this.optionsToolMenuItem.Size = new System.Drawing.Size(180, 22); this.optionsToolMenuItem.Size = new System.Drawing.Size(143, 22);
this.optionsToolMenuItem.Text = "&Options"; this.optionsToolMenuItem.Text = "&Options";
this.optionsToolMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem1_Click); this.optionsToolMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem1_Click);
// //
@ -411,20 +412,20 @@ namespace bzit.bomg
this.viewHelpHelpMenuItem.Image = global::bzit.bomg.Properties.Resources.help; this.viewHelpHelpMenuItem.Image = global::bzit.bomg.Properties.Resources.help;
this.viewHelpHelpMenuItem.Name = "viewHelpHelpMenuItem"; this.viewHelpHelpMenuItem.Name = "viewHelpHelpMenuItem";
this.viewHelpHelpMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1; this.viewHelpHelpMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1;
this.viewHelpHelpMenuItem.Size = new System.Drawing.Size(180, 22); this.viewHelpHelpMenuItem.Size = new System.Drawing.Size(146, 22);
this.viewHelpHelpMenuItem.Text = "View &Help"; this.viewHelpHelpMenuItem.Text = "View &Help";
this.viewHelpHelpMenuItem.Click += new System.EventHandler(this.documentationToolStripMenuItem_Click); this.viewHelpHelpMenuItem.Click += new System.EventHandler(this.documentationToolStripMenuItem_Click);
// //
// toolStripSeparator12 // toolStripSeparator12
// //
this.toolStripSeparator12.Name = "toolStripSeparator12"; this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator12.Size = new System.Drawing.Size(143, 6);
// //
// aboutHelpMenuItem // aboutHelpMenuItem
// //
this.aboutHelpMenuItem.Image = global::bzit.bomg.Properties.Resources.comment; this.aboutHelpMenuItem.Image = global::bzit.bomg.Properties.Resources.comment;
this.aboutHelpMenuItem.Name = "aboutHelpMenuItem"; this.aboutHelpMenuItem.Name = "aboutHelpMenuItem";
this.aboutHelpMenuItem.Size = new System.Drawing.Size(180, 22); this.aboutHelpMenuItem.Size = new System.Drawing.Size(146, 22);
this.aboutHelpMenuItem.Text = "&About"; this.aboutHelpMenuItem.Text = "&About";
this.aboutHelpMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click); this.aboutHelpMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
// //
@ -544,8 +545,8 @@ namespace bzit.bomg
// //
// saveFileDialog // saveFileDialog
// //
this.saveFileDialog.DefaultExt = "ryz"; this.saveFileDialog.DefaultExt = "jsnx";
this.saveFileDialog.Filter = "Bookmarks file|*.ryz|Bookmarks file (password protected)|*.ryz"; this.saveFileDialog.Filter = "Bookmarks file|*.jsnx|Bookmarks file (password protected)|*.jsnx";
this.saveFileDialog.Title = "Save bookmarks file"; this.saveFileDialog.Title = "Save bookmarks file";
// //
// toolStrip2 // toolStrip2
@ -556,7 +557,8 @@ namespace bzit.bomg
this.newMenuBarItem, this.newMenuBarItem,
this.openMenuBarItem, this.openMenuBarItem,
this.saveMenuBarItem, this.saveMenuBarItem,
this.toolStripSeparator9}); this.toolStripSeparator9,
this.toolStripButton1});
this.toolStrip2.Location = new System.Drawing.Point(0, 25); this.toolStrip2.Location = new System.Drawing.Point(0, 25);
this.toolStrip2.Name = "toolStrip2"; this.toolStrip2.Name = "toolStrip2";
this.toolStrip2.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; this.toolStrip2.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
@ -652,17 +654,29 @@ namespace bzit.bomg
this.toolStripMenuItem22.Text = "&Sort"; this.toolStripMenuItem22.Text = "&Sort";
this.toolStripMenuItem22.Click += new System.EventHandler(this.sortContextMenu_Click); this.toolStripMenuItem22.Click += new System.EventHandler(this.sortContextMenu_Click);
// //
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
this.toolStripButton1.Text = "toolStripButton1";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// treeView1 // treeView1
// //
this.treeView1.AllowDrop = true; this.treeView1.AllowDrop = true;
this.treeView1.BackColor = System.Drawing.Color.White; this.treeView1.BackColor = System.Drawing.Color.White;
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.HasChanged = false;
this.treeView1.HideSelection = false; this.treeView1.HideSelection = false;
this.treeView1.HotTracking = true; this.treeView1.HotTracking = true;
this.treeView1.ImageIndex = 0; this.treeView1.ImageIndex = 0;
this.treeView1.LabelEdit = true; this.treeView1.LabelEdit = true;
this.treeView1.Location = new System.Drawing.Point(0, 50); this.treeView1.Location = new System.Drawing.Point(0, 50);
this.treeView1.Name = "treeView1"; this.treeView1.Name = "treeView1";
this.treeView1.PathSeparator = "\n";
this.treeView1.SelectedImageIndex = 0; this.treeView1.SelectedImageIndex = 0;
this.treeView1.ShowNodeToolTips = true; this.treeView1.ShowNodeToolTips = true;
this.treeView1.Size = new System.Drawing.Size(304, 584); this.treeView1.Size = new System.Drawing.Size(304, 584);
@ -769,6 +783,7 @@ namespace bzit.bomg
private System.Windows.Forms.ToolStripMenuItem findEditMenuItem; private System.Windows.Forms.ToolStripMenuItem findEditMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateIconsToolMenuItem; private System.Windows.Forms.ToolStripMenuItem updateIconsToolMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14; private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
private System.Windows.Forms.ToolStripButton toolStripButton1;
} }
} }

View File

@ -1,8 +1,10 @@
using bzit.bomg.Models; using bzit.bomg.Models;
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using static RyzStudio.Windows.Forms.BookmarkTreeView;
namespace bzit.bomg namespace bzit.bomg
{ {
@ -382,7 +384,7 @@ namespace bzit.bomg
/** /**
* File -> Exit * File -> Exit
*/ */
private void exitMenuItem_Click(object sender, EventArgs e) { this.Close(); } private void exitMenuItem_Click(object sender, EventArgs e) => this.Close();
/** /**
* Find * Find
@ -490,89 +492,6 @@ namespace bzit.bomg
#endregion #endregion
//#region TreeView Menu - item
/**
* Node -> Open
*/
//private void toolStripMenuItem4_Click(object sender, EventArgs e)
//{
// openBookmark(treeView1.SelectedNode);
//}
/**
* Node -> Edit
*/
//private void toolStripMenuItem8_Click(object sender, EventArgs e)
//{
// if (treeView1.SelectedNode == null)
// {
// return;
// }
// treeView1.HasChanged = true;
// TreeNode tn = treeView1.SelectedNode;
// //##BookmarkEditForm oBookmarkEdit = new BookmarkEditForm(ref tn);
// //##oBookmarkEdit.ShowDialog();
//}
/**
* Node -> Delete
*/
//private void toolStripMenuItem6_Click(object sender, EventArgs e) => treeView1.SNode.Delete();
//{
// treeView1.DeleteNode();
//}
//#endregion
//#region TreeView Menu - folder
/**
* Add Page
*/
//private void toolStripMenuItem15_Click(object sender, EventArgs e) { treeView1.AddBookmarkPage(); }
/**
* Add Folder
*/
//private void toolStripMenuItem16_Click(object sender, EventArgs e) => treeView1.SelectedNode = treeView1.SNode.AddFolder();
/**
* Open All
*/
//private void toolStripMenuItem14_Click(object sender, EventArgs e)
//{
// if (treeView1.SelectedNode == null)
// {
// return;
// }
// foreach (TreeNode tn in treeView1.SelectedNode.Nodes)
// {
// if (tn.Tag == null)
// {
// continue;
// }
// openBookmark(tn);
// }
//}
/**
* Edit
*/
//private void toolStripMenuItem9_Click(object sender, EventArgs e)
//{
// treeView1.HasChanged = true;
// //##treeView1.EditNode();
//}
//#endregion
protected void OpenBookmarkFile(string filename) protected void OpenBookmarkFile(string filename)
{ {
treeView1.HasChanged = false; treeView1.HasChanged = false;
@ -640,6 +559,9 @@ namespace bzit.bomg
return rv; return rv;
} }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{ {
if (e.Button != MouseButtons.Right) if (e.Button != MouseButtons.Right)
@ -673,59 +595,31 @@ namespace bzit.bomg
return; return;
} }
NodeType nodeType = treeView1.SNode.GetNodeType();
switch (e.KeyCode) switch (e.KeyCode)
{ {
case Keys.Apps: case Keys.Apps:
treeView1_NodeMouseClick(sender, new TreeNodeMouseClickEventArgs(tn, MouseButtons.Right, 1, tn.Bounds.X, tn.Bounds.Y)); treeView1_NodeMouseClick(sender, new TreeNodeMouseClickEventArgs(tn, MouseButtons.Right, 1, tn.Bounds.X, tn.Bounds.Y));
return; return;
//case Keys.F2:
//if (tn.Tag == null)
//{
// return;
//}
//if (!(tn.Tag is BookmarkItem))
//{
// return;
//}
//toolStripMenuItem8_Click(sender, null);
//break;
case Keys.F3:
if (tn.Tag == null)
{
return;
}
if (!(tn.Tag is BookmarkItem))
{
return;
}
BookmarkItem bookmarkItem = (BookmarkItem)tn.Tag;
if (bookmarkItem == null)
{
return;
}
if (string.IsNullOrEmpty(bookmarkItem.SiteAddress))
{
return;
}
try
{
Clipboard.SetText(bookmarkItem.SiteAddress.Trim());
}
catch
{
// do nothing
}
break;
case Keys.Enter: case Keys.Enter:
openBookmark(tn); openBookmark(tn);
break;
case Keys.Insert:
if (e.Modifiers != Keys.Shift)
{
if ((nodeType == NodeType.Root) || (nodeType == NodeType.Folder))
{
(new BookmarkEditForm(treeView1)).ShowDialog();
}
else if (nodeType == NodeType.Page)
{
treeView1.SelectedNode = tn.Parent;
(new BookmarkEditForm(treeView1)).ShowDialog();
}
}
break; break;
default: break; default: break;
} }
@ -881,8 +775,15 @@ namespace bzit.bomg
private void moveUpContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp(); private void moveUpContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp();
private void moveDownContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown(); private void moveDownContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown();
#endregion #endregion
private void toolStripButton1_Click(object sender, EventArgs e)
{
List<BookmarkItemViewModel> rs = treeView1.GetBookmarkList();
//MessageBox.Show(treeView1.GetNodePath(treeView1.SelectedNode));
MessageBox.Show("!");
}
} }
} }

View File

@ -156,15 +156,30 @@
<data name="newMenuBarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="newMenuBarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHaSURBVDhPjZO9S1tRGMZtnfo/VHASCkWkCRlFKB0KdVB0 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHZSURBVDhPjZM7SxxRGIY1qfwPClaCICFkZUsRxELQQkmK
KIWCDgpuanHoWOlklxJCcBG3QoeCe5dEpEXRBBW/oCIOSfNlbnI/zjn3Xn36vofe670mpb7wI8N9n1+e EAjEQsHOCxYpFSttZFmWNJJOsAik2yKwBAkJiu6i4g0iYrGbvbmzO5dzzszE1+87OOOOay4fPEyx5332
c3LTE5nHRIJI/Yd+4iHRMQnHcYxcLnft+z66IaVEOp3+TLtdJSkOW5YF27ZDWq0Wms0mKpWKlpTLZWQy PWfmtDVNJxEj4v+gm3hCtEzMcRwjk8n89n0fjyGlRCKRWKe1j0riHLYsC7Zth9TrddRqNRSLRS0pFApI
mQ7JAyLFC0IIKKX0J2OaJgzDQLVa1QJqCf6SbDYbSPRogdcqQl7taEEg4UC73UatVosdh+GMTtNogThd JpMtknYizguEEFBK6SdjmiYMw0CpVNICagn+k1QqFUj0aIFXz0Fe72pBIOFAo9FAuVyObIfhjE7TaIE4
gDiaDRc8z9PnDo5Sr9d1k1KpdCu4uZx/ZB68Gdn79nxNHs9A7r+GPF+B29iC71oxCTfh+2g0GrcCeTK9 m4M4ng4XeJ6n9x1spVKp6Cb5fP5ecHM122Eevhnc/zS0IU+mIA9eQ16swq1+g+9aEQk34fOoVqv3Ank6
qk7mIM8W4V6sQP36ALE3BmvzGcTBUqwJH4fvhEWhAJjsdfbHN+TZOxJ8IsEynOIEnMIUfE/pRcZ1XX0v +UGdzkCez8O9XIX6uQSxPw5r+wXE4WKkCW+Hz4RFoQB49dQ5mPgszxdIsEaCZTi5l3Cy7+B7Si9kXNfV
LGFCAc/V7uigKL6COl+GOn0PK/cUrnEYhhluEVwut4kJrO0XL0VhFPaPIZibT6h+Aur3dx0K4AYMhzsF 58ISJhTwXO+NPRO5UaiLZaiz97C+9sE1jsIwwy2Cw+U2EYG1MzwismOwvz+Hud1L9WNQv77oUAA3YDjc
P4ffFr4MrPuyDo8Qxx8hL792hKPEBDThi3SXaIso/IwzOk2jBfl8/uau4F/Q7jVndPrvJOnnsflBt0AU Kvgx8Da72fPRlxV4hDhZgbzaagk3ExHQhB/SQ5pbNMO/cUanabQgnU7fPBT8Cf7sOaPTd9NPr8f+22UK
3qHX2aQM/3vD6SOSBFvvA4V7+v4ABhqcM6lhVZQAAAAASUVORK5CYII= uLszJmX49obTRfQTbP0fKNzWdQu5+pvuDaXQ3AAAAABJRU5ErkJggg==
</value>
</data>
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<metadata name="rootTreeNodeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="rootTreeNodeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@ -43,7 +43,7 @@ namespace bzit.bomg
this.textBox2.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); this.textBox2.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox2.Size = new System.Drawing.Size(276, 33); this.textBox2.Size = new System.Drawing.Size(276, 32);
this.textBox2.TabIndex = 68; this.textBox2.TabIndex = 68;
// //
// label2 // label2
@ -98,6 +98,7 @@ namespace bzit.bomg
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "New Session";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@ -60,34 +60,34 @@ namespace bzit.bomg
protected override void saveToXmlTextWriter(ref XmlTextWriter writer) protected override void saveToXmlTextWriter(ref XmlTextWriter writer)
{ {
if (parentForm.treeView1.Nodes.Count <= 0) //if (parentForm.treeView1.Nodes.Count <= 0)
{ //{
return; // return;
} //}
writer.Formatting = Formatting.Indented; //writer.Formatting = Formatting.Indented;
writer.WriteStartDocument(); //writer.WriteStartDocument();
writer.WriteStartElement(CONST_PRODUCT); //writer.WriteStartElement(CONST_PRODUCT);
writer.WriteStartElement("b"); //writer.WriteStartElement("b");
writer.WriteStartElement("g"); //writer.WriteStartElement("g");
writer.WriteAttributeString("name", parentForm.treeView1.Nodes[0].Text); //writer.WriteAttributeString("name", parentForm.treeView1.Nodes[0].Text);
foreach (TreeNode tn in parentForm.treeView1.NodeList) //foreach (TreeNode tn in parentForm.treeView1.NodeList)
{ //{
BookmarkItem bi = (BookmarkItem)tn.Tag; // BookmarkItem bi = (BookmarkItem)tn.Tag;
writer.WriteStartElement("m"); // writer.WriteStartElement("m");
writer.WriteElementString("name", parentForm.treeView1.GetNodeFullPath(tn)); // writer.WriteElementString("name", parentForm.treeView1.GetNodeFullPath(tn));
writer.WriteElementString("address", bi.SiteAddress); // writer.WriteElementString("address", bi.SiteAddress);
writer.WriteElementString("description", bi.Description); // writer.WriteElementString("description", bi.Description);
writer.WriteElementString("created", bi.Created.ToString()); // writer.WriteElementString("created", bi.Created.ToString());
writer.WriteEndElement(); // writer.WriteEndElement();
} //}
writer.WriteEndElement(); //writer.WriteEndElement();
writer.WriteEndElement(); //writer.WriteEndElement();
writer.WriteEndElement(); //writer.WriteEndElement();
writer.WriteEndDocument(); //writer.WriteEndDocument();
} }
} }
} }

View File

@ -59,57 +59,57 @@ namespace bzit.bomg
private void mainThread_DoWork(object sender, DoWorkEventArgs e) private void mainThread_DoWork(object sender, DoWorkEventArgs e)
{ {
TreeNode[] nodeList = parentForm.treeView1.NodeList; //TreeNode[] nodeList = parentForm.treeView1.NodeList;
for (int i=0; i< nodeList.Length; i++) //for (int i=0; i< nodeList.Length; i++)
{ //{
if (progressBar1.InvokeRequired) // if (progressBar1.InvokeRequired)
{ // {
progressBar1.Invoke(new Action(() => progressBar1.Value = (i + 1) )); // progressBar1.Invoke(new Action(() => progressBar1.Value = (i + 1) ));
} // }
else // else
{ // {
progressBar1.Value = (i + 1); // progressBar1.Value = (i + 1);
} // }
if (label2.InvokeRequired) // if (label2.InvokeRequired)
{ // {
label2.Invoke(new Action(() => label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString()))); // label2.Invoke(new Action(() => label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString())));
} // }
else // else
{ // {
label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString()); // label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString());
} // }
TreeNode node = nodeList[i]; // TreeNode node = nodeList[i];
if (node == null) // if (node == null)
{ // {
continue; // continue;
} // }
if (node.Tag == null) // if (node.Tag == null)
{ // {
continue; // continue;
} // }
if (!(node.Tag is BookmarkItem)) // if (!(node.Tag is BookmarkItem))
{ // {
continue; // continue;
} // }
BookmarkItem bookmarkItem = (BookmarkItem)node.Tag; // BookmarkItem bookmarkItem = (BookmarkItem)node.Tag;
if (bookmarkItem == null) // if (bookmarkItem == null)
{ // {
continue; // continue;
} // }
bookmarkItem.GetFaviconAddress(); // bookmarkItem.GetFaviconAddress();
if (bookmarkItem.IconData == null) // if (bookmarkItem.IconData == null)
{ // {
continue; // continue;
} // }
//##parentForm.treeView1.AddIcon(bookmarkItem); //##parentForm.treeView1.AddIcon(bookmarkItem);
} //}
} }
private void mainThread_OnCompleted(object sender, RunWorkerCompletedEventArgs e) private void mainThread_OnCompleted(object sender, RunWorkerCompletedEventArgs e)

View File

@ -1,9 +1,12 @@
using bzit.bomg; using bzit.bomg;
using bzit.bomg.Data;
using bzit.bomg.Models; using bzit.bomg.Models;
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using Resources = bzit.bomg.Properties.Resources; using Resources = bzit.bomg.Properties.Resources;
@ -37,12 +40,12 @@ namespace RyzStudio.Windows.Forms
//public EventHandler OnChanged = null; //public EventHandler OnChanged = null;
//public NodeCountUpdated OnNodeCountUpdate = null; //public NodeCountUpdated OnNodeCountUpdate = null;
protected const char pathSeparator = '|'; //protected const char pathSeparator = '|';
protected TreeNode draggingNode = null; protected TreeNode draggingNode = null;
protected bool allowBeginEdit = false; protected bool allowBeginEdit = false;
//protected ulong nodeCount = 0;
protected bool hasChanged = false; protected bool hasChanged = false;
//protected ulong nodeCount = 0;
public BookmarkTreeView() : base() public BookmarkTreeView() : base()
{ {
@ -62,30 +65,32 @@ namespace RyzStudio.Windows.Forms
this.ImageList.Images.Add(Resources.folder); this.ImageList.Images.Add(Resources.folder);
this.ImageList.Images.Add(Resources.folder_explore); this.ImageList.Images.Add(Resources.folder_explore);
this.ImageList.Images.Add(Resources.page_white_world_bw); this.ImageList.Images.Add(Resources.page_white_world_bw);
this.PathSeparator = "\n";
} }
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; } public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; }
[Browsable(false)] //[Browsable(false)]
public TreeNode[] NodeList //public TreeNode[] NodeList
{ //{
get // get
{ // {
TreeNode[] rv = new TreeNode[0]; // TreeNode[] rv = new TreeNode[0];
if (this.Nodes.Count <= 0) // if (this.Nodes.Count <= 0)
{ // {
return rv; // return rv;
} // }
foreach (TreeNode tn in this.Nodes) // foreach (TreeNode tn in this.Nodes)
{ // {
traverseNodeList(ref rv, tn); // traverseNodeList(ref rv, tn);
} // }
return rv; // return rv;
} // }
} //}
//[Browsable(false)] //[Browsable(false)]
//public ulong NodeCount //public ulong NodeCount
@ -172,6 +177,27 @@ namespace RyzStudio.Windows.Forms
return true; return true;
} }
public TreeNode AddFolder(TreeNode node)
{
//return this.AddFolder("New Folder " + (new Random()).Next(10001, 99999).ToString());
return this.AddFolder(node, "New Folder (" + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ")");
}
public TreeNode AddFolder(TreeNode node, string name)
{
if (node == null)
{
return null;
}
if (node.Tag != null)
{
return null;
}
return node.Nodes.Add(encodePath(name), name, (int)IconSet.Folder1, (int)IconSet.Folder2);
}
public void AddItem(BookmarkItemViewModel viewModel) public void AddItem(BookmarkItemViewModel viewModel)
{ {
int iconIndex = addIcon(viewModel); int iconIndex = addIcon(viewModel);
@ -233,31 +259,78 @@ namespace RyzStudio.Windows.Forms
} }
} }
public string GetNodeFullPath(TreeNode node) public string GetNodePath(TreeNode node)
{ {
string rv = PathEncode(node.Text); string[] folderList = node.FullPath.Split('\n');
if (folderList.Length < 2)
TreeNode tn = node;
while (true)
{ {
tn = tn.Parent; return null;
if (tn == null)
{
break;
} }
if (tn.Level == 0) if (folderList.Length < 2)
{ {
break; return "/";
} }
rv = PathEncode(tn.Text) + pathSeparator.ToString() + rv; StringBuilder sb = new StringBuilder();
for (int i=1; i<(folderList.Length - 1); i++)
{
sb.Append("\\");
sb.Append(encodePath(folderList[i] ?? string.Empty));
} }
return rv; sb.Append("\\");
return sb.ToString();
} }
public BookmarkItemViewModel GetViewModel(TreeNode node) => (BookmarkItemViewModel)node.Tag;
public List<BookmarkItemViewModel> GetBookmarkList()
{
List<BookmarkItemViewModel> rs = new List<BookmarkItemViewModel>();
if (this.Nodes.Count <= 0)
{
return rs;
}
traverseBookmarkList(rs, this.Nodes[0]);
return rs;
}
//public string GetNodeFullPath(TreeNode node)
//{
// string rv = PathEncode(node.Text);
// TreeNode tn = node;
// while (true)
// {
// tn = tn.Parent;
// if (tn == null)
// {
// break;
// }
// if (tn.Level == 0)
// {
// break;
// }
// //rv = PathEncode(tn.Text) + pathSeparator.ToString() + rv;
// }
// return rv;
//}
public bool FindTextNode(TreeNode node, string term) public bool FindTextNode(TreeNode node, string term)
{ {
if (node == null) if (node == null)
@ -470,16 +543,22 @@ namespace RyzStudio.Windows.Forms
return; return;
} }
NodeType nodeType = this.SNode.GetNodeType();
switch (e.KeyCode) switch (e.KeyCode)
{ {
case Keys.Insert: case Keys.Insert:
if (e.Modifiers == Keys.Shift) if (e.Modifiers == Keys.Shift)
{
if ((nodeType == NodeType.Root) || (nodeType == NodeType.Folder))
{ {
this.SelectedNode = this.SNode.AddFolder(); this.SelectedNode = this.SNode.AddFolder();
} }
else else if (nodeType == NodeType.Page)
{ {
//##AddBookmarkPage(); this.SelectedNode = tn.Parent;
this.SelectedNode = this.SNode.AddFolder();
}
} }
break; break;
@ -494,6 +573,39 @@ namespace RyzStudio.Windows.Forms
allowBeginEdit = true; allowBeginEdit = true;
this.SNode.Edit(); this.SNode.Edit();
break;
case Keys.F3:
switch (nodeType)
{
case NodeType.Root:
case NodeType.Folder:
try
{
Clipboard.SetText(tn.Text ?? string.Empty);
}
catch
{
}
break;
case NodeType.Page:
BookmarkItemViewModel viewModel = this.SNode.GetViewModel();
if (viewModel != null)
{
try
{
Clipboard.SetText(viewModel.SiteAddress ?? string.Empty);
}
catch
{
}
}
break;
default:
break;
}
break; break;
case Keys.Up: case Keys.Up:
if (e.Modifiers == Keys.Control) if (e.Modifiers == Keys.Control)
@ -617,6 +729,32 @@ namespace RyzStudio.Windows.Forms
this.SelectedNode = this.SelectedNode.Nodes[n]; this.SelectedNode = this.SelectedNode.Nodes[n];
} }
protected string decodePath(string value) => System.Web.HttpUtility.UrlDecode(value);
protected string encodePath(string value) => System.Web.HttpUtility.UrlEncode(value);
protected void traverseBookmarkList(List<BookmarkItemViewModel> rs, TreeNode node)
{
foreach (TreeNode tn in node.Nodes)
{
NodeType nodeType = this.GetNodeType(tn);
if (nodeType == NodeType.Folder)
{
traverseBookmarkList(rs, tn);
}
else if (nodeType == NodeType.Page)
{
BookmarkItemViewModel nodeTag = this.GetViewModel(tn);
nodeTag.TreeviewPath = this.GetNodePath(tn);
if (nodeTag != null)
{
rs.Add(nodeTag);
}
}
}
}
protected void updateItem_OnSelectedNode(BookmarkItemViewModel viewModel) protected void updateItem_OnSelectedNode(BookmarkItemViewModel viewModel)
{ {
if (this.SelectedNode == null) if (this.SelectedNode == null)
@ -654,36 +792,36 @@ namespace RyzStudio.Windows.Forms
return false; return false;
} }
protected void traverseNodeList(ref TreeNode[] results, TreeNode node) //protected void traverseNodeList(ref TreeNode[] results, TreeNode node)
{ //{
foreach (TreeNode tn in node.Nodes) // foreach (TreeNode tn in node.Nodes)
{ // {
if (tn.Tag == null) // if (tn.Tag == null)
{ // {
traverseNodeList(ref results, tn); // traverseNodeList(ref results, tn);
} // }
else // else
{ // {
Array.Resize(ref results, (results.Length + 1)); // Array.Resize(ref results, (results.Length + 1));
results[(results.Length - 1)] = tn; // results[(results.Length - 1)] = tn;
} // }
} // }
} //}
protected void traverseNodeCount(ref ulong results, TreeNode node) //protected void traverseNodeCount(ref ulong results, TreeNode node)
{ //{
foreach (TreeNode tn in node.Nodes) // foreach (TreeNode tn in node.Nodes)
{ // {
if (tn.Tag == null) // if (tn.Tag == null)
{ // {
traverseNodeCount(ref results, tn); // traverseNodeCount(ref results, tn);
} // }
else // else
{ // {
results++; // results++;
} // }
} // }
} //}
@ -698,8 +836,7 @@ namespace RyzStudio.Windows.Forms
////protected string PathEncode(string text) { return RyzStudio.String.EncodeTo64(text); } ////protected string PathEncode(string text) { return RyzStudio.String.EncodeTo64(text); }
//protected string PathDecode(string text) { return RyzStudio.String.DecodeFrom64(text); } //protected string PathDecode(string text) { return RyzStudio.String.DecodeFrom64(text); }
protected string PathEncode(string text) { return System.Web.HttpUtility.UrlEncode(text); }
protected string PathDecode(string text) { return System.Web.HttpUtility.UrlDecode(text); }

View File

@ -19,28 +19,9 @@ namespace RyzStudio.Windows.Forms
set => this.Treeview.SelectedNode = value; set => this.Treeview.SelectedNode = value;
} }
protected string encodeName(string name) => Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(name)); public TreeNode AddFolder() => this.Treeview.AddFolder(this.SelectedNode);
public TreeNode AddFolder() public TreeNode AddFolder(string name) => this.Treeview.AddFolder(this.SelectedNode, name);
{
//return this.AddFolder("New Folder " + (new Random()).Next(10001, 99999).ToString());
return this.AddFolder("New Folder (" + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ")");
}
public TreeNode AddFolder(string name)
{
if (this.SelectedNode == null)
{
return null;
}
if (this.SelectedNode.Tag != null)
{
return null;
}
return this.SelectedNode.Nodes.Add(encodeName(name), name, (int)BookmarkTreeView.IconSet.Folder1, (int)BookmarkTreeView.IconSet.Folder2);
}
public TreeNode AddItem(string name, object tag) public TreeNode AddItem(string name, object tag)
{ {
@ -124,6 +105,8 @@ namespace RyzStudio.Windows.Forms
public BookmarkTreeView.NodeType GetNodeType() => this.Treeview.GetNodeType(this.SelectedNode); public BookmarkTreeView.NodeType GetNodeType() => this.Treeview.GetNodeType(this.SelectedNode);
public BookmarkItemViewModel GetViewModel() => this.Treeview.GetViewModel(this.SelectedNode);
public void MoveDown() public void MoveDown()
{ {
if (this.SelectedNode == null) if (this.SelectedNode == null)

View File

@ -159,7 +159,7 @@
<DependentUpon>UpdateIconForm.cs</DependentUpon> <DependentUpon>UpdateIconForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="SessionFileFormat.cs" /> <Compile Include="SessionFileFormat.cs" />
<Compile Include="IconDatabase.cs" /> <Compile Include="Data\IconDatabase.cs" />
<Compile Include="BookmarkEditForm.cs"> <Compile Include="BookmarkEditForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -311,9 +311,7 @@
<Install>true</Install> <Install>true</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="Data\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets')" /> <Import Project="packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">