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

View File

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

View File

@ -3,7 +3,7 @@ using System.Drawing;
using System.IO;
using RyzStudio.Data.SQLite;
namespace bzit.bomg
namespace bzit.bomg.Data
{
public class IconDatabase : SQLiteDatabase2
{
@ -30,8 +30,6 @@ namespace bzit.bomg
") >= 0;
}
#region public methods
public bool HasIcon(string 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) + "';");
}
#endregion
protected string imageToSQLString(Image image)
{
MemoryStream stream = new MemoryStream();
@ -115,10 +111,7 @@ namespace bzit.bomg
return bytesToSQLString(byteArray);
}
protected string bytesToSQLString(byte[] image)
{
return Convert.ToBase64String(image);
}
protected string bytesToSQLString(byte[] image) => Convert.ToBase64String(image);
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.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem22 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView();
this.pageTreeNodeMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
@ -326,7 +327,7 @@ namespace bzit.bomg
this.findEditMenuItem.Image = global::bzit.bomg.Properties.Resources.magnifier;
this.findEditMenuItem.Name = "findEditMenuItem";
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.Click += new System.EventHandler(this.toolStripButton5_Click);
//
@ -346,7 +347,7 @@ namespace bzit.bomg
//
this.expandAllViewMenuItem.Enabled = false;
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.Click += new System.EventHandler(this.expandAllToolStripMenuItem_Click);
//
@ -354,7 +355,7 @@ namespace bzit.bomg
//
this.collapseAllViewMenuItem.Enabled = false;
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.Click += new System.EventHandler(this.collapseAllToolStripMenuItem_Click);
//
@ -374,14 +375,14 @@ namespace bzit.bomg
// 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.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
// toolStripSeparator14
//
this.toolStripSeparator14.Name = "toolStripSeparator14";
this.toolStripSeparator14.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator14.Size = new System.Drawing.Size(140, 6);
//
// optionsToolMenuItem
//
@ -389,7 +390,7 @@ namespace bzit.bomg
this.optionsToolMenuItem.Image = global::bzit.bomg.Properties.Resources.cog;
this.optionsToolMenuItem.Name = "optionsToolMenuItem";
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.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.Name = "viewHelpHelpMenuItem";
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.Click += new System.EventHandler(this.documentationToolStripMenuItem_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator12.Size = new System.Drawing.Size(143, 6);
//
// aboutHelpMenuItem
//
this.aboutHelpMenuItem.Image = global::bzit.bomg.Properties.Resources.comment;
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.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
//
@ -544,8 +545,8 @@ namespace bzit.bomg
//
// saveFileDialog
//
this.saveFileDialog.DefaultExt = "ryz";
this.saveFileDialog.Filter = "Bookmarks file|*.ryz|Bookmarks file (password protected)|*.ryz";
this.saveFileDialog.DefaultExt = "jsnx";
this.saveFileDialog.Filter = "Bookmarks file|*.jsnx|Bookmarks file (password protected)|*.jsnx";
this.saveFileDialog.Title = "Save bookmarks file";
//
// toolStrip2
@ -556,7 +557,8 @@ namespace bzit.bomg
this.newMenuBarItem,
this.openMenuBarItem,
this.saveMenuBarItem,
this.toolStripSeparator9});
this.toolStripSeparator9,
this.toolStripButton1});
this.toolStrip2.Location = new System.Drawing.Point(0, 25);
this.toolStrip2.Name = "toolStrip2";
this.toolStrip2.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
@ -652,17 +654,29 @@ namespace bzit.bomg
this.toolStripMenuItem22.Text = "&Sort";
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
//
this.treeView1.AllowDrop = true;
this.treeView1.BackColor = System.Drawing.Color.White;
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.HasChanged = false;
this.treeView1.HideSelection = false;
this.treeView1.HotTracking = true;
this.treeView1.ImageIndex = 0;
this.treeView1.LabelEdit = true;
this.treeView1.Location = new System.Drawing.Point(0, 50);
this.treeView1.Name = "treeView1";
this.treeView1.PathSeparator = "\n";
this.treeView1.SelectedImageIndex = 0;
this.treeView1.ShowNodeToolTips = true;
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 updateIconsToolMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
private System.Windows.Forms.ToolStripButton toolStripButton1;
}
}

View File

@ -1,8 +1,10 @@
using bzit.bomg.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;
using static RyzStudio.Windows.Forms.BookmarkTreeView;
namespace bzit.bomg
{
@ -382,7 +384,7 @@ namespace bzit.bomg
/**
* File -> Exit
*/
private void exitMenuItem_Click(object sender, EventArgs e) { this.Close(); }
private void exitMenuItem_Click(object sender, EventArgs e) => this.Close();
/**
* Find
@ -490,89 +492,6 @@ namespace bzit.bomg
#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)
{
treeView1.HasChanged = false;
@ -640,6 +559,9 @@ namespace bzit.bomg
return rv;
}
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Button != MouseButtons.Right)
@ -673,59 +595,31 @@ namespace bzit.bomg
return;
}
NodeType nodeType = treeView1.SNode.GetNodeType();
switch (e.KeyCode)
{
case Keys.Apps:
treeView1_NodeMouseClick(sender, new TreeNodeMouseClickEventArgs(tn, MouseButtons.Right, 1, tn.Bounds.X, tn.Bounds.Y));
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:
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;
default: break;
}
@ -881,8 +775,15 @@ namespace bzit.bomg
private void moveUpContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp();
private void moveDownContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown();
#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">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHaSURBVDhPjZO9S1tRGMZtnfo/VHASCkWkCRlFKB0KdVB0
KIWCDgpuanHoWOlklxJCcBG3QoeCe5dEpEXRBBW/oCIOSfNlbnI/zjn3Xn36vofe670mpb7wI8N9n1+e
c3LTE5nHRIJI/Yd+4iHRMQnHcYxcLnft+z66IaVEOp3+TLtdJSkOW5YF27ZDWq0Wms0mKpWKlpTLZWQy
mQ7JAyLFC0IIKKX0J2OaJgzDQLVa1QJqCf6SbDYbSPRogdcqQl7taEEg4UC73UatVosdh+GMTtNogThd
gDiaDRc8z9PnDo5Sr9d1k1KpdCu4uZx/ZB68Gdn79nxNHs9A7r+GPF+B29iC71oxCTfh+2g0GrcCeTK9
qk7mIM8W4V6sQP36ALE3BmvzGcTBUqwJH4fvhEWhAJjsdfbHN+TZOxJ8IsEynOIEnMIUfE/pRcZ1XX0v
LGFCAc/V7uigKL6COl+GOn0PK/cUrnEYhhluEVwut4kJrO0XL0VhFPaPIZibT6h+Aur3dx0K4AYMhzsF
P4ffFr4MrPuyDo8Qxx8hL792hKPEBDThi3SXaIso/IwzOk2jBfl8/uau4F/Q7jVndPrvJOnnsflBt0AU
3qHX2aQM/3vD6SOSBFvvA4V7+v4ABhqcM6lhVZQAAAAASUVORK5CYII=
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHZSURBVDhPjZM7SxxRGIY1qfwPClaCICFkZUsRxELQQkmK
EAjEQsHOCxYpFSttZFmWNJJOsAik2yKwBAkJiu6i4g0iYrGbvbmzO5dzzszE1+87OOOOay4fPEyx5332
PWfmtDVNJxEj4v+gm3hCtEzMcRwjk8n89n0fjyGlRCKRWKe1j0riHLYsC7Zth9TrddRqNRSLRS0pFApI
JpMtknYizguEEFBK6SdjmiYMw0CpVNICagn+k1QqFUj0aIFXz0Fe72pBIOFAo9FAuVyObIfhjE7TaIE4
m4M4ng4XeJ6n9x1spVKp6Cb5fP5ecHM122Eevhnc/zS0IU+mIA9eQ16swq1+g+9aEQk34fOoVqv3Ank6
+UGdzkCez8O9XIX6uQSxPw5r+wXE4WKkCW+Hz4RFoQB49dQ5mPgszxdIsEaCZTi5l3Cy7+B7Si9kXNfV
58ISJhTwXO+NPRO5UaiLZaiz97C+9sE1jsIwwy2Cw+U2EYG1MzwismOwvz+Hud1L9WNQv77oUAA3YDjc
Kvgx8Da72fPRlxV4hDhZgbzaagk3ExHQhB/SQ5pbNMO/cUanabQgnU7fPBT8Cf7sOaPTd9NPr8f+22UK
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>
</data>
<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.Name = "textBox2";
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;
//
// label2
@ -98,6 +98,7 @@ namespace bzit.bomg
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "New Session";
this.ResumeLayout(false);
this.PerformLayout();

View File

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

View File

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

View File

@ -1,9 +1,12 @@
using bzit.bomg;
using bzit.bomg.Data;
using bzit.bomg.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Resources = bzit.bomg.Properties.Resources;
@ -37,12 +40,12 @@ namespace RyzStudio.Windows.Forms
//public EventHandler OnChanged = null;
//public NodeCountUpdated OnNodeCountUpdate = null;
protected const char pathSeparator = '|';
//protected const char pathSeparator = '|';
protected TreeNode draggingNode = null;
protected bool allowBeginEdit = false;
//protected ulong nodeCount = 0;
protected bool hasChanged = false;
//protected ulong nodeCount = 0;
public BookmarkTreeView() : base()
{
@ -62,30 +65,32 @@ namespace RyzStudio.Windows.Forms
this.ImageList.Images.Add(Resources.folder);
this.ImageList.Images.Add(Resources.folder_explore);
this.ImageList.Images.Add(Resources.page_white_world_bw);
this.PathSeparator = "\n";
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; }
[Browsable(false)]
public TreeNode[] NodeList
{
get
{
TreeNode[] rv = new TreeNode[0];
if (this.Nodes.Count <= 0)
{
return rv;
}
//[Browsable(false)]
//public TreeNode[] NodeList
//{
// get
// {
// TreeNode[] rv = new TreeNode[0];
// if (this.Nodes.Count <= 0)
// {
// return rv;
// }
foreach (TreeNode tn in this.Nodes)
{
traverseNodeList(ref rv, tn);
}
// foreach (TreeNode tn in this.Nodes)
// {
// traverseNodeList(ref rv, tn);
// }
return rv;
}
}
// return rv;
// }
//}
//[Browsable(false)]
//public ulong NodeCount
@ -172,6 +177,27 @@ namespace RyzStudio.Windows.Forms
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)
{
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);
TreeNode tn = node;
while (true)
string[] folderList = node.FullPath.Split('\n');
if (folderList.Length < 2)
{
tn = tn.Parent;
if (tn == null)
{
break;
return null;
}
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)
{
if (node == null)
@ -470,16 +543,22 @@ namespace RyzStudio.Windows.Forms
return;
}
NodeType nodeType = this.SNode.GetNodeType();
switch (e.KeyCode)
{
case Keys.Insert:
if (e.Modifiers == Keys.Shift)
{
if ((nodeType == NodeType.Root) || (nodeType == NodeType.Folder))
{
this.SelectedNode = this.SNode.AddFolder();
}
else
else if (nodeType == NodeType.Page)
{
//##AddBookmarkPage();
this.SelectedNode = tn.Parent;
this.SelectedNode = this.SNode.AddFolder();
}
}
break;
@ -494,6 +573,39 @@ namespace RyzStudio.Windows.Forms
allowBeginEdit = true;
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;
case Keys.Up:
if (e.Modifiers == Keys.Control)
@ -617,6 +729,32 @@ namespace RyzStudio.Windows.Forms
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)
{
if (this.SelectedNode == null)
@ -654,36 +792,36 @@ namespace RyzStudio.Windows.Forms
return false;
}
protected void traverseNodeList(ref TreeNode[] results, TreeNode node)
{
foreach (TreeNode tn in node.Nodes)
{
if (tn.Tag == null)
{
traverseNodeList(ref results, tn);
}
else
{
Array.Resize(ref results, (results.Length + 1));
results[(results.Length - 1)] = tn;
}
}
}
//protected void traverseNodeList(ref TreeNode[] results, TreeNode node)
//{
// foreach (TreeNode tn in node.Nodes)
// {
// if (tn.Tag == null)
// {
// traverseNodeList(ref results, tn);
// }
// else
// {
// Array.Resize(ref results, (results.Length + 1));
// results[(results.Length - 1)] = tn;
// }
// }
//}
protected void traverseNodeCount(ref ulong results, TreeNode node)
{
foreach (TreeNode tn in node.Nodes)
{
if (tn.Tag == null)
{
traverseNodeCount(ref results, tn);
}
else
{
results++;
}
}
}
//protected void traverseNodeCount(ref ulong results, TreeNode node)
//{
// foreach (TreeNode tn in node.Nodes)
// {
// if (tn.Tag == null)
// {
// traverseNodeCount(ref results, tn);
// }
// else
// {
// results++;
// }
// }
//}
@ -698,8 +836,7 @@ namespace RyzStudio.Windows.Forms
////protected string PathEncode(string text) { return RyzStudio.String.EncodeTo64(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;
}
protected string encodeName(string name) => Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(name));
public TreeNode AddFolder() => this.Treeview.AddFolder(this.SelectedNode);
public TreeNode AddFolder()
{
//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 AddFolder(string name) => this.Treeview.AddFolder(this.SelectedNode, name);
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 BookmarkItemViewModel GetViewModel() => this.Treeview.GetViewModel(this.SelectedNode);
public void MoveDown()
{
if (this.SelectedNode == null)

View File

@ -159,7 +159,7 @@
<DependentUpon>UpdateIconForm.cs</DependentUpon>
</Compile>
<Compile Include="SessionFileFormat.cs" />
<Compile Include="IconDatabase.cs" />
<Compile Include="Data\IconDatabase.cs" />
<Compile Include="BookmarkEditForm.cs">
<SubType>Form</SubType>
</Compile>
@ -311,9 +311,7 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="Data\" />
</ItemGroup>
<ItemGroup />
<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')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">