2using System.Collections.Generic;
21 private string[] localeAlternate =
null;
22 private string title =
null;
23 private string type =
null;
24 private string url =
null;
25 private string description =
null;
26 private string determiner =
null;
27 private string locale =
null;
28 private string siteName =
null;
50 List<ImageInformation>
Images =
null;
51 List<AudioInformation>
Audio =
null;
52 List<VideoInformation>
Video =
null;
60 if (!(Doc.
Meta is
null))
87 if (
string.IsNullOrEmpty(Name) ||
string.IsNullOrEmpty(Value))
97 if (
string.IsNullOrEmpty(this.title))
106 if (
string.IsNullOrEmpty(this.type))
116 case "twitter:image":
123 if (
Image.Url == Value)
130 if (!(LastImage is
null))
140 Images =
new List<ImageInformation>();
145 case "og:image:secure_url":
146 if (!(LastImage is
null))
147 LastImage.SecureUrl = Value;
150 case "og:image:type":
151 if (!(LastImage is
null))
152 LastImage.ContentType = Value;
155 case "og:image:width":
156 if (!(LastImage is
null) &&
int.TryParse(Value, out
int i))
160 case "og:image:height":
161 if (!(LastImage is
null) &&
int.TryParse(Value, out i))
162 LastImage.Height = i;
166 case "twitter:image:alt":
167 if (!(LastImage is
null))
168 LastImage.Description = Value;
178 Audio =
new List<AudioInformation>();
180 Audio.Add(LastAudio);
183 case "og:audio:secure_url":
184 if (!(LastAudio is
null))
185 LastAudio.SecureUrl = Value;
188 case "og:audio:type":
189 if (!(LastAudio is
null))
190 LastAudio.ContentType = Value;
193 case "og:description":
194 this.description = Value;
197 case "twitter:description":
199 if (
string.IsNullOrEmpty(this.description))
200 this.description = Value;
203 case "og:determiner":
204 this.determiner = Value;
211 case "og:locale:alternate":
219 this.siteName = Value;
229 Video =
new List<VideoInformation>();
231 Video.Add(LastVideo);
234 case "og:video:secure_url":
235 if (!(LastVideo is
null))
236 LastVideo.SecureUrl = Value;
239 case "og:video:type":
240 if (!(LastVideo is
null))
241 LastVideo.ContentType = Value;
244 case "og:video:width":
245 if (!(LastVideo is
null) &&
int.TryParse(Value, out i))
249 case "og:video:height":
250 if (!(LastVideo is
null) &&
int.TryParse(Value, out i))
251 LastVideo.Height = i;
257 if (
string.IsNullOrEmpty(this.title) && !(Doc.
Title is
null))
260 this.images =
Images?.ToArray();
261 this.audio =
Audio?.ToArray();
262 this.video =
Video?.ToArray();
272 set => this.images = value;
281 set => this.audio = value;
290 set => this.video = value;
298 get => this.localeAlternate;
299 set => this.localeAlternate = value;
308 set => this.title = value;
317 set => this.type = value;
326 set => this.url = value;
334 get => this.description;
335 set => this.description = value;
343 get => this.determiner;
344 set => this.determiner = value;
353 set => this.locale = value;
361 get => this.siteName;
362 set => this.siteName = value;
371 if ((
this is
null) ^ (
Meta is
null))
377 if (this.title !=
Meta.title ||
378 this.type !=
Meta.type ||
379 this.url !=
Meta.url ||
380 this.description !=
Meta.description ||
381 this.determiner !=
Meta.determiner ||
382 this.locale !=
Meta.locale ||
383 this.siteName !=
Meta.siteName)
388 if ((this.localeAlternate is
null) ^ (
Meta.localeAlternate is
null))
391 if (!(this.localeAlternate is
null))
393 if ((c = this.localeAlternate.Length) !=
Meta.localeAlternate.Length)
396 for (i = 0; i < c; i++)
398 if (this.localeAlternate[i] !=
Meta.localeAlternate[i])
403 if ((this.images is
null) ^ (
Meta.images is
null))
406 if (!(this.images is
null))
408 if ((c = this.images.Length) !=
Meta.images.Length)
411 for (i = 0; i < c; i++)
418 if ((this.audio is
null) ^ (
Meta.audio is
null))
421 if (!(this.audio is
null))
423 if ((c = this.audio.Length) !=
Meta.audio.Length)
426 for (i = 0; i < c; i++)
433 if ((this.video is
null) ^ (
Meta.video is
null))
436 if (!(this.video is
null))
438 if ((c = this.video.Length) !=
Meta.video.Length)
441 for (i = 0; i < c; i++)
456 if (!(this.title is
null))
457 Result = this.title.GetHashCode();
459 if (!(this.type is
null))
460 Result ^= Result << 5 ^ this.type.GetHashCode();
462 if (!(this.url is
null))
463 Result ^= Result << 5 ^ this.url.GetHashCode();
465 if (!(this.description is
null))
466 Result ^= Result << 5 ^ this.description.GetHashCode();
468 if (!(this.determiner is
null))
469 Result ^= Result << 5 ^ this.determiner.GetHashCode();
471 if (!(this.locale is
null))
472 Result ^= Result << 5 ^ this.locale.GetHashCode();
474 if (!(this.siteName is
null))
475 Result ^= Result << 5 ^ this.siteName.GetHashCode();
477 if (!(this.localeAlternate is
null))
479 foreach (
string s
in this.localeAlternate)
480 Result ^= Result << 5 ^ s.GetHashCode();
483 if (!(this.images is
null))
489 if (!(this.audio is
null))
495 if (!(this.video is
null))
string Name
Attribute name.
string Value
Attribute value.
Title Title
First TITLE element of document, if found, null otherwise.
IEnumerable< Meta > Meta
META elements found in document, or null if none found.
string InnerText
Inner Text
IEnumerable< HtmlAttribute > Attributes
Attributes, or null if none.
bool HasAttributes
If the element has attributes.
Audio information, as defined by the Open Graph protocol.
Image information, as defined by the Open Graph protocol.
override int GetHashCode()
Video information, as defined by the Open Graph protocol.
Contains meta-data about a page.
PageMetaData()
Contains meta-data about a page.
ImageInformation[] Images
Image representing page.
override int GetHashCode()
string Description
A description of the page.
override bool Equals(object obj)
PageMetaData(HtmlDocument Doc)
Contains meta-data about a page.
string Determiner
A word that appears before the title.
string Url
Canonical URL of page.
string Locale
Locale of information.
string SiteName
Name of web site publishing page
string[] LocaleAlternate
Alternate locales