// "Therefore those skilled at the unorthodox
// are infinite as heaven and earth,
// inexhaustible as the great rivers.
// When they come to an end,
// they begin again,
// like the days and months;
// they die and are reborn,
// like the four seasons."
//
// - Sun Tsu,
// "The Art of War"
using System;
using System.Collections.Generic;
namespace TheArtOfDev.HtmlRenderer.Core.Entities
{
///
/// Invoked when a stylesheet is about to be loaded by file path or URL in 'link' element.
/// Allows to overwrite the loaded stylesheet by providing the stylesheet data manually, or different source (file or URL) to load from.
/// Example: The stylesheet 'href' can be non-valid URI string that is interpreted in the overwrite delegate by custom logic to pre-loaded stylesheet object
/// If no alternative data is provided the original source will be used.
///
public sealed class HtmlStylesheetLoadEventArgs : EventArgs
{
#region Fields and Consts
///
/// the source of the stylesheet as found in the HTML (file path or URL)
///
private readonly string _src;
///
/// collection of all the attributes that are defined on the link element
///
private readonly Dictionary _attributes;
///
/// provide the new source (file path or URL) to load stylesheet from
///
private string _setSrc;
///
/// provide the stylesheet to load
///
private string _setStyleSheet;
///
/// provide the stylesheet data to load
///
private CssData _setStyleSheetData;
#endregion
///
/// Init.
///
/// the source of the image (file path or URL)
/// collection of all the attributes that are defined on the image element
internal HtmlStylesheetLoadEventArgs(string src, Dictionary attributes)
{
_src = src;
_attributes = attributes;
}
///
/// the source of the stylesheet as found in the HTML (file path or URL)
///
public string Src
{
get { return _src; }
}
///
/// collection of all the attributes that are defined on the link element
///
public Dictionary Attributes
{
get { return _attributes; }
}
///
/// provide the new source (file path or URL) to load stylesheet from
///
public string SetSrc
{
get { return _setSrc; }
set { _setSrc = value; }
}
///
/// provide the stylesheet to load
///
public string SetStyleSheet
{
get { return _setStyleSheet; }
set { _setStyleSheet = value; }
}
///
/// provide the stylesheet data to load
///
public CssData SetStyleSheetData
{
get { return _setStyleSheetData; }
set { _setStyleSheetData = value; }
}
}
}