Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Implementation.cs
1using System;
3
5{
9 public class Implementation
10 {
14 public string? Version { get; internal set; }
15
23 public string? Description { get; internal set; }
24
28 public Uri? WebsiteUrl { get; internal set; }
29
33 public BaseMetadata? Metadata { get; internal set; }
34
38 public Icons? Icons { get; internal set; }
39
46 public static bool TryParse(Dictionary<string, object> Generic,
47 out Implementation Typed)
48 {
49 Implementation Result = new Implementation();
50
51 if (Generic.TryGetValue("version", out object? Obj))
52 Result.Version = Obj as string;
53
54 if (Generic.TryGetValue("description", out Obj))
55 Result.Description = Obj as string;
56
57 if (Generic.TryGetValue("websiteUrl", out Obj) &&
58 Obj is string WebsiteUrl &&
59 Uri.TryCreate(WebsiteUrl, UriKind.Absolute, out Uri WebsiteUrlUri))
60 {
61 Result.WebsiteUrl = WebsiteUrlUri;
62 }
63
64 if (BaseMetadata.TryParse(Generic, out BaseMetadata? Metadata))
65 Result.Metadata = Metadata;
66
67 if (Icons.TryParse(Generic, out Icons? IconsParsed))
68 Result.Icons = IconsParsed;
69
70 Typed = Result;
71 return true;
72 }
73 }
74}
Base interface for metadata with name (identifier) and title (display name) properties.
Definition: BaseMetadata.cs:10
static bool TryParse(Dictionary< string, object > Generic, out BaseMetadata Typed)
Tries to parse a generic structure into a typed structure.
Definition: BaseMetadata.cs:33
string? Version
Version of the implementation, if available.
static bool TryParse(Dictionary< string, object > Generic, out Implementation Typed)
Tries to parse a generic structure into a typed structure.
Uri? WebsiteUrl
An optional URL of the website for this implementation.
string? Description
An optional human-readable description of what this implementation does.
BaseMetadata? Metadata
Base metadata about the implementation, if available.
Base interface to add icons property.
Definition: Icons.cs:11
static bool TryParse(Dictionary< string, object > Generic, out Icons Typed)
Tries to parse a generic structure into a typed structure.
Definition: Icons.cs:52