Changed: improved favicon parsing

This commit is contained in:
Ray 2019-04-28 16:54:59 +01:00
parent d232f7b5ec
commit ce49c7e062
4 changed files with 33 additions and 25 deletions

View File

@ -346,42 +346,50 @@ namespace bzit.bomg
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//link[@rel='shortcut icon']", "href", string.Empty); //rs = parseTagValue_Attr(doc, "//link[@rel='shortcut icon']", "href", string.Empty);
rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'shortcut icon']", "href", string.Empty);
} }
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//link[@rel='icon']", "href", string.Empty); //rs = parseTagValue_Attr(doc, "//link[@rel='icon']", "href", string.Empty);
rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'icon']", "href", string.Empty);
} }
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//link[@rel='apple-touch-icon']", "href", string.Empty); //rs = parseTagValue_Attr(doc, "//link[@rel='apple-touch-icon']", "href", string.Empty);
rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'apple-touch-icon']", "href", string.Empty);
} }
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//link[@rel='apple-touch-icon-precomposed']", "href", string.Empty); //rs = parseTagValue_Attr(doc, "//link[@rel='apple-touch-icon-precomposed']", "href", string.Empty);
rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'apple-touch-icon-precomposed']", "href", string.Empty);
} }
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//meta[@property='og:image']", "content", string.Empty); //rs = parseTagValue_Attr(doc, "//meta[@property='og:image']", "content", string.Empty);
rs = parseTagValue_Attr(doc, "//meta[translate(@property, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'og:image']", "content", string.Empty);
} }
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//meta[@name='twitter:image']", "content", string.Empty); //rs = parseTagValue_Attr(doc, "//meta[@name='twitter:image']", "content", string.Empty);
rs = parseTagValue_Attr(doc, "//meta[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'twitter:image']", "content", string.Empty);
} }
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//meta[@property='og:image']", "content", string.Empty); //rs = parseTagValue_Attr(doc, "//meta[@property='og:image']", "content", string.Empty);
rs = parseTagValue_Attr(doc, "//meta[translate(@property, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'og:image']", "content", string.Empty);
} }
if (string.IsNullOrWhiteSpace(rs)) if (string.IsNullOrWhiteSpace(rs))
{ {
rs = parseTagValue_Attr(doc, "//meta[@itemprop='image']", "content", string.Empty); //rs = parseTagValue_Attr(doc, "//meta[@itemprop='image']", "content", string.Empty);
rs = parseTagValue_Attr(doc, "//meta[translate(@itemprop, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'image']", "content", string.Empty);
} }
return rs; return rs;

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.0.013")] [assembly: AssemblyVersion("0.3.0.014")]
[assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]

View File

@ -89,7 +89,7 @@ namespace bzit.bomg.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to 0.3.0.013 beta. /// Looks up a localized string similar to 0.3.0.014 beta.
/// </summary> /// </summary>
internal static string app_version { internal static string app_version {
get { get {

View File

@ -128,7 +128,7 @@
<value>Bookmark Manager</value> <value>Bookmark Manager</value>
</data> </data>
<data name="app_version" xml:space="preserve"> <data name="app_version" xml:space="preserve">
<value>0.3.0.013 beta</value> <value>0.3.0.014 beta</value>
</data> </data>
<data name="arrow_down_circle" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="arrow_down_circle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\2\arrow-down-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\2\arrow-down-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>