Merge branch 'release/0.4.1.006' into 'master'

Release/0.4.1.006

See merge request SympatheticFire/bookmark-manager-r4!6
This commit is contained in:
Ray 2021-10-12 21:12:40 +00:00
commit 185d9aa253
11 changed files with 95 additions and 46 deletions

View File

@ -1,5 +1,6 @@
using BookmarkManager; using BookmarkManager;
using bzit.bomg.Models; using bzit.bomg.Models;
using FizzyLauncher.Models;
using RyzStudio.Windows.Forms; using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms;
using System; using System;
@ -34,12 +35,15 @@ namespace FizzyLauncher
protected WebParser webParser = null; protected WebParser webParser = null;
protected WebClient webClient = null; protected WebClient webClient = null;
protected bool isBusy = false; protected bool isBusy = false;
protected AppSession appSession = null;
public BookmarkForm(BookmarkItem model, Image icon) : base() public BookmarkForm(AppSession session, BookmarkItem model, Image icon) : base()
{ {
InitializeComponent(); InitializeComponent();
appSession = session;
textBox1.Text = model.SiteName?.Trim() ?? string.Empty; textBox1.Text = model.SiteName?.Trim() ?? string.Empty;
textBox2.Text = model.SiteAddress?.Trim() ?? string.Empty; textBox2.Text = model.SiteAddress?.Trim() ?? string.Empty;
memoBox1.Text = model.SiteDescription?.Trim() ?? string.Empty; memoBox1.Text = model.SiteDescription?.Trim() ?? string.Empty;
@ -293,6 +297,8 @@ namespace FizzyLauncher
base.OnShown(e); base.OnShown(e);
this.DialogResult = DialogResult.None; this.DialogResult = DialogResult.None;
textBox2.Focus();
} }
protected override void OnClosing(CancelEventArgs e) protected override void OnClosing(CancelEventArgs e)
@ -371,7 +377,7 @@ namespace FizzyLauncher
return; return;
} }
BookmarkResult rs = webParser.RetrieveDetails(textBox2.Text); BookmarkResult rs = webParser.RetrieveDetails(textBox2.Text, appSession.IgnoreSSL);
if (rs == null) if (rs == null)
{ {
IsBusy = false; IsBusy = false;

View File

@ -12,9 +12,9 @@
<Company>Hi, I'm Ray</Company> <Company>Hi, I'm Ray</Company>
<Product>Bookmark Manager</Product> <Product>Bookmark Manager</Product>
<Copyright>Ray Lam</Copyright> <Copyright>Ray Lam</Copyright>
<AssemblyVersion>0.4.0.132</AssemblyVersion> <AssemblyVersion>0.4.1.006</AssemblyVersion>
<FileVersion>0.4.0.132</FileVersion> <FileVersion>0.4.1.006</FileVersion>
<Version>0.4.0.132</Version> <Version>0.4.1.006</Version>
<PackageId>bookmarkmanager</PackageId> <PackageId>bookmarkmanager</PackageId>
</PropertyGroup> </PropertyGroup>

View File

@ -487,7 +487,7 @@ namespace FizzyLauncher
return; return;
} }
if (updateIconsForm == null) updateIconsForm = new UpdateIconsForm(treeView1, iconDatabase); if (updateIconsForm == null) updateIconsForm = new UpdateIconsForm(this.CurrentSession, treeView1, iconDatabase);
updateIconsForm.ShowDialog(); updateIconsForm.ShowDialog();
} }
@ -1184,6 +1184,10 @@ namespace FizzyLauncher
Result result = fileHandler.Save(treeView1, filename, password); Result result = fileHandler.Save(treeView1, filename, password);
if (result.IsSuccess) if (result.IsSuccess)
{ {
this.ApplicationMode = AppMode.Open;
sessionFilename = filename;
sessionPassword = password;
treeView1.SetNoChanges(); treeView1.SetNoChanges();
} }
@ -1201,14 +1205,7 @@ namespace FizzyLauncher
icon = iconDatabase.FindIcon(iconID); icon = iconDatabase.FindIcon(iconID);
//if (!string.IsNullOrWhiteSpace(model.SiteAddress)) BookmarkForm bookmarkForm = new BookmarkForm(this.CurrentSession, model, icon);
//{
// string iconID = model?.ToHash();
// icon = iconDatabase.FindIcon(iconID);
//}
BookmarkForm bookmarkForm = new BookmarkForm(model, icon);
if (bookmarkForm.ShowDialog() == DialogResult.OK) if (bookmarkForm.ShowDialog() == DialogResult.OK)
{ {
//string iconID = bookmarkForm.Model.Item?.ToHash(); //string iconID = bookmarkForm.Model.Item?.ToHash();

View File

@ -18,5 +18,7 @@
public string RunCommand { get; set; } = "{0}"; public string RunCommand { get; set; } = "{0}";
public bool IgnoreSSL { get; set; } = false;
} }
} }

View File

@ -14,9 +14,9 @@ namespace BookmarkManager
protected WebClient webClient2 = null; protected WebClient webClient2 = null;
public BookmarkResult RetrieveDetails(string url) public BookmarkResult RetrieveDetails(string url, bool ignoreSSL)
{ {
string sourceCode = retrieveSourceCode(url); string sourceCode = retrieveSourceCode(url, ignoreSSL);
if (string.IsNullOrWhiteSpace(sourceCode)) if (string.IsNullOrWhiteSpace(sourceCode))
{ {
return null; return null;
@ -77,9 +77,10 @@ namespace BookmarkManager
} }
protected string retrieveSourceCode(string url) protected string retrieveSourceCode(string url, bool ignoreSSL)
{ {
if (webClient == null) webClient = new HttpWeb(); if (webClient == null) webClient = new HttpWeb();
webClient.IgnoreSSL = ignoreSSL;
string sourceCode; string sourceCode;

View File

@ -19,8 +19,8 @@ namespace FizzyLauncher
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator3; private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator3;
private TTextBox textBox1; private TTextBox textBox1;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2; private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
private TYesNoPickerBox pickerBox4;
private Label label2;
protected MainForm parentForm = null; protected MainForm parentForm = null;
@ -54,6 +54,8 @@ namespace FizzyLauncher
this.tHorizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.tHorizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.tHorizontalSeparator3 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.tHorizontalSeparator3 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
this.pickerBox4 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@ -233,11 +235,41 @@ namespace FizzyLauncher
this.textBox1.TabIndex = 192; this.textBox1.TabIndex = 192;
this.textBox1.UseSystemPasswordChar = false; this.textBox1.UseSystemPasswordChar = false;
// //
// pickerBox4
//
this.pickerBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox4.BackColor = System.Drawing.Color.Transparent;
this.pickerBox4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.pickerBox4.Location = new System.Drawing.Point(285, 237);
this.pickerBox4.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.pickerBox4.Name = "pickerBox4";
this.pickerBox4.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox4.Size = new System.Drawing.Size(84, 34);
this.pickerBox4.SubmitButton = null;
this.pickerBox4.TabIndex = 194;
this.pickerBox4.Value = true;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.label2.Location = new System.Drawing.Point(10, 237);
this.label2.Margin = new System.Windows.Forms.Padding(0);
this.label2.Name = "label2";
this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
this.label2.Size = new System.Drawing.Size(95, 34);
this.label2.TabIndex = 193;
this.label2.Text = "Ignore SSL Errors";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// OptionsForm // OptionsForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(384, 521); this.ClientSize = new System.Drawing.Size(384, 521);
this.Controls.Add(this.pickerBox4);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Controls.Add(this.tHorizontalSeparator3); this.Controls.Add(this.tHorizontalSeparator3);
this.Controls.Add(this.tHorizontalSeparator2); this.Controls.Add(this.tHorizontalSeparator2);
@ -278,6 +310,7 @@ namespace FizzyLauncher
pickerBox1.Value = parentForm.CurrentSession.EnableAutoPosition; pickerBox1.Value = parentForm.CurrentSession.EnableAutoPosition;
pickerBox2.Value = parentForm.CurrentSession.AlwaysOnTop; pickerBox2.Value = parentForm.CurrentSession.AlwaysOnTop;
textBox1.Text = parentForm.CurrentSession.RunCommand ?? string.Empty; textBox1.Text = parentForm.CurrentSession.RunCommand ?? string.Empty;
pickerBox4.Value = parentForm.CurrentSession.IgnoreSSL;
} }
private void button1_MouseClick(object sender, MouseEventArgs e) private void button1_MouseClick(object sender, MouseEventArgs e)
@ -290,6 +323,7 @@ namespace FizzyLauncher
parentForm.CurrentSession.EnableAutoPosition = pickerBox1.Value; parentForm.CurrentSession.EnableAutoPosition = pickerBox1.Value;
parentForm.CurrentSession.AlwaysOnTop = pickerBox2.Value; parentForm.CurrentSession.AlwaysOnTop = pickerBox2.Value;
parentForm.CurrentSession.RunCommand = textBox1.Text?.Trim(); parentForm.CurrentSession.RunCommand = textBox1.Text?.Trim();
parentForm.CurrentSession.IgnoreSSL = pickerBox4.Value;
} }
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;

View File

@ -8,35 +8,41 @@ namespace RyzStudio.Net
{ {
public class HttpWeb public class HttpWeb
{ {
public string defaultUserAgent = "Momozilla/5.0 (" + Environment.OSVersion.Platform.ToString() + " ; " + Environment.OSVersion.VersionString + "; " + Application.CurrentCulture.TwoLetterISOLanguageName + ")";
public int defaultTimeout = 6000;
public int defaultMaxRedirect = 8;
public bool defaultAllowRedirect = true;
public CookieContainer defaultCookierContainer = null;
public HttpWeb() public HttpWeb()
{ {
} }
public HttpWebRequest CreateRequest(string url)
{ public string UserAgent { get; set; } = "Momozilla/5.0 (" + Environment.OSVersion.Platform.ToString() + " ; " + Environment.OSVersion.VersionString + "; " + Application.CurrentCulture.TwoLetterISOLanguageName + ")";
return this.CreateRequest(url, url);
} public int Timeout { get; set; } = 6000;
public int MaxRedirect { get; set; } = 8;
public bool AllowRedirect { get; set; } = true;
public bool IgnoreSSL { get; set; } = false;
public CookieContainer CookierJar { get; set; } = null;
public HttpWebRequest CreateRequest(string url) => this.CreateRequest(url, url);
public HttpWebRequest CreateRequest(string url, string referrerURL) public HttpWebRequest CreateRequest(string url, string referrerURL)
{ {
if (defaultCookierContainer == null) if (this.CookierJar == null) this.CookierJar = new CookieContainer();
{
defaultCookierContainer = new CookieContainer();
}
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); webRequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
webRequest.MaximumAutomaticRedirections = defaultMaxRedirect; webRequest.MaximumAutomaticRedirections = this.MaxRedirect;
webRequest.CookieContainer = defaultCookierContainer; webRequest.CookieContainer = this.CookierJar;
webRequest.UserAgent = defaultUserAgent; webRequest.UserAgent = this.UserAgent;
webRequest.AllowAutoRedirect = defaultAllowRedirect; webRequest.AllowAutoRedirect = this.AllowRedirect;
webRequest.Timeout = defaultTimeout; webRequest.Timeout = this.Timeout;
if (this.IgnoreSSL) webRequest.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
return webRequest; return webRequest;
} }
@ -164,5 +170,6 @@ namespace RyzStudio.Net
return rv; return rv;
} }
} }
} }

View File

@ -1,5 +1,6 @@
using BookmarkManager; using BookmarkManager;
using bzit.bomg.Models; using bzit.bomg.Models;
using FizzyLauncher.Models;
using RyzStudio.Windows.Forms; using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms;
using System; using System;
@ -27,6 +28,7 @@ namespace FizzyLauncher
protected BookmarkTreeView bookmarkTreeView = null; protected BookmarkTreeView bookmarkTreeView = null;
protected IconDatabase iconDatabase = null; protected IconDatabase iconDatabase = null;
protected AppSession appSession = null;
protected WebParser webParser = null; protected WebParser webParser = null;
protected WebClient webClient = null; protected WebClient webClient = null;
@ -39,12 +41,13 @@ namespace FizzyLauncher
protected bool requestCancellation = false; protected bool requestCancellation = false;
public UpdateIconsForm(BookmarkTreeView treeView, IconDatabase database) public UpdateIconsForm(AppSession session, BookmarkTreeView treeView, IconDatabase database)
{ {
InitializeComponent(); InitializeComponent();
bookmarkTreeView = treeView; bookmarkTreeView = treeView;
iconDatabase = database; iconDatabase = database;
appSession = session;
pickerBox1.InnerControl.SelectedIndexChanged += comboBox1_SelectedIndexChanged; pickerBox1.InnerControl.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
@ -314,7 +317,7 @@ namespace FizzyLauncher
BookmarkItem item = bookmarkList[i]; BookmarkItem item = bookmarkList[i];
BookmarkResult result = webParser.RetrieveDetails(item.SiteAddress); BookmarkResult result = webParser.RetrieveDetails(item.SiteAddress, appSession.IgnoreSSL);
if (result == null) if (result == null)
{ {
continue; continue;

View File

@ -817,6 +817,10 @@ namespace RyzStudio.Windows.Forms
if (string.IsNullOrWhiteSpace(item.SiteAddress)) return (int)IconSet.Default; if (string.IsNullOrWhiteSpace(item.SiteAddress)) return (int)IconSet.Default;
string iconID = item?.ToHash(); string iconID = item?.ToHash();
if (this.ImageList.Images.ContainsKey(iconID))
{
return this.ImageList.Images.IndexOfKey(iconID);
}
Image image = this.IconDatabase.FindIcon(iconID); Image image = this.IconDatabase.FindIcon(iconID);
if (image == null) if (image == null)
@ -824,11 +828,6 @@ namespace RyzStudio.Windows.Forms
return (int)IconSet.Default; return (int)IconSet.Default;
} }
if (this.ImageList.Images.ContainsKey(iconID))
{
this.ImageList.Images.RemoveByKey(iconID);
}
ThreadControl.Add(this, this.ImageList, iconID, image); ThreadControl.Add(this, this.ImageList, iconID, image);
return this.ImageList.Images.IndexOfKey(iconID); return this.ImageList.Images.IndexOfKey(iconID);

View File

@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Bookmark Manager" #define MyAppName "Bookmark Manager"
#define MyAppVersion "0.4.0.132" #define MyAppVersion "0.4.1.006"
#define MyAppPublisher "Hi, I'm Ray" #define MyAppPublisher "Hi, I'm Ray"
#define MyAppURL "https://www.hiimray.co.uk/software-bookmark-manager" #define MyAppURL "https://www.hiimray.co.uk/software-bookmark-manager"
#define MyAppExeName "bookmarkmanager.exe" #define MyAppExeName "bookmarkmanager.exe"

View File

@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Bookmark Manager" #define MyAppName "Bookmark Manager"
#define MyAppVersion "0.4.0.132" #define MyAppVersion "0.4.1.006"
#define MyAppPublisher "Hi, I'm Ray" #define MyAppPublisher "Hi, I'm Ray"
#define MyAppURL "https://www.hiimray.co.uk/software-bookmark-manager" #define MyAppURL "https://www.hiimray.co.uk/software-bookmark-manager"
#define MyAppExeName "bookmarkmanager.exe" #define MyAppExeName "bookmarkmanager.exe"