55 public Uri?
Source {
get;
internal set; }
70 public string[]?
Sizes {
get;
internal set; }
79 public string?
Theme {
get;
internal set; }
87 public static bool TryParse(Dictionary<string, object> Generic,
92 if (Generic.TryGetValue(
"src", out
object? Obj) &&
94 Uri.TryCreate(Src, UriKind.Absolute, out Uri
Source))
99 if (Generic.TryGetValue(
"mimeType", out Obj))
100 Result.MimeType = Obj as string;
102 if (Generic.TryGetValue(
"sizes", out Obj) && Obj is Array
Sizes)
104 int i, c =
Sizes.Length;
106 Result.Sizes =
new string[c];
107 for (i = 0; i < c; i++)
108 Result.
Sizes[i] =
Sizes.GetValue(i)?.ToString() ??
string.Empty;
111 if (Generic.TryGetValue(
"theme", out Obj))
112 Result.Theme = Obj as string;
122 public Dictionary<string, object>
ToJson()
124 Dictionary<string, object> Result =
new Dictionary<string, object>();
126 if (!(this.
Source is
null))
127 Result[
"src"] = this.
Source.ToString();
129 if (!
string.IsNullOrEmpty(this.
MimeType))
132 if (!(this.
Sizes is
null))
133 Result[
"sizes"] = this.
Sizes;
135 if (!
string.IsNullOrEmpty(this.
Theme))
136 Result[
"theme"] = this.
Theme;
An optionally-sized icon that can be displayed in a user interface.
static bool TryParse(Dictionary< string, object > Generic, out Icon Typed)
Tries to parse a generic structure into a typed structure.
string? MimeType
Optional MIME type override if the source MIME type is missing or generic. For example: "image/png",...
Icon(Uri Source, string MimeType, string[]? Sizes)
An optionally-sized icon that can be displayed in a user interface.
Dictionary< string, object > ToJson()
Converts object to a generic representation.
Icon(Uri Source, string MimeType)
An optionally-sized icon that can be displayed in a user interface.
Icon(Uri Source, string MimeType, string[]? Sizes, string? Theme)
An optionally-sized icon that can be displayed in a user interface.
string?[] Sizes
Optional array of strings that specify sizes at which the icon can be used. Each string should be in ...
Icon()
An optionally-sized icon that can be displayed in a user interface.
Uri? Source
A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a data: URI with Base64-enco...
string? Theme
Optional specifier for the theme this icon is designed for. light indicates the icon is designed to b...