Added: extra file type support

This commit is contained in:
Ray 2021-09-29 01:58:02 +01:00
parent fd087d2d0e
commit 646db1de56
3 changed files with 58 additions and 2 deletions

View File

@ -69,6 +69,10 @@ namespace BookmarkManager
public override Result Save(BookmarkTreeView treeview, string filename, string password)
{
List<BookmarkItem> rs = treeview.GetBookmarkList();
if (rs.Count <= 0)
{
return Result.Create(false, "No bookmarks to save");
}
bool rv = SharpZipLib.CreateSingle(filename, password, "bookmarks.json", JsonConvert.SerializeObject(rs));

View File

@ -2,6 +2,7 @@
using RyzStudio.IO;
using RyzStudio.Windows.Forms;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
@ -67,6 +68,9 @@ namespace BookmarkManager
case "description":
item.SiteDescription = xn2.InnerText?.Trim();
break;
case "notes":
item.Notes = xn2.InnerText?.Trim();
break;
//case "created":
// bi.Created = xn2.InnerText?.Trim();
// break;
@ -118,7 +122,54 @@ namespace BookmarkManager
public override Result Save(BookmarkTreeView treeview, string filename, string password)
{
return Result.Create(false);
List<BookmarkItem> rs = treeview.GetBookmarkList();
if (rs.Count <= 0)
{
return Result.Create(false, "No bookmarks to save");
}
return Result.Create(false, "Saving in this format is no longer supported");
//MemoryStream ms = new MemoryStream();
//XmlTextWriter writer = new XmlTextWriter(ms, Encoding.UTF8);
//writer.Formatting = Formatting.Indented;
//writer.WriteStartDocument();
//writer.WriteStartElement("bomg");
//writer.WriteStartElement("b");
//writer.WriteStartElement("g");
//writer.WriteAttributeString("name", treeview.Nodes[0].Text);
//foreach (BookmarkItem item in rs)
//{
// writer.WriteStartElement("m");
// writer.WriteElementString("name", item.TreeviewPath);
// writer.WriteElementString("address", item.SiteAddress);
// writer.WriteElementString("description", item.SiteDescription);
// writer.WriteElementString("created", "200101010000");
// writer.WriteEndElement();
//}
//writer.WriteEndElement();
//writer.WriteEndElement();
//writer.WriteEndElement();
//writer.WriteEndDocument();
//writer.Flush();
//ms.Position = 0;
//StreamReader sr = new StreamReader(ms);
//string sourceCode = sr.ReadToEnd();
//sr.Close();
//sr.Dispose();
//writer.Close();
//writer.Dispose();
//bool rv = SharpZipLib.CreateSingle(filename, password, "bookmarks.xml", sourceCode);
//return Result.Create(rv);
}
}

View File

@ -24,6 +24,7 @@ namespace FizzyLauncher
New
}
protected IconDatabase iconDatabase = null;
protected OptionsForm optionsForm = null;
protected FindForm findForm = null;
@ -688,9 +689,9 @@ namespace FizzyLauncher
/// <param name="e"></param>
private void moveDownToolStripMenuItem1_Click(object sender, EventArgs e) => treeView1.MoveDown();
#endregion
private async void treeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
TreeNode tn = treeView1.SelectedNode;