Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TextFileEventSinkNode.cs
2using System.Threading.Tasks;
3using System.Xml;
6using Waher.Things;
9
11{
16 {
21 : base()
22 {
23 }
24
34 string SinkId, string FileName, int DeleteAfterDays)
35 : base(Source, Parent, SinkId)
36 {
37 this.FileName = FileName;
38 this.DeleteAfterDays = DeleteAfterDays;
39 }
40
44 [Page(7, "Configuration")]
45 [Header(148, "File Name:")]
46 [ToolTip(149, "Name of file where events will be logged.")]
47 [Text(TextPosition.AfterField, 154, "The substrings %YEAR%, %MONTH%, %DAY%, %HOUR%, %MINUTE and %SECOND% will be replaced by the current year, month, day, hour, minute and second respectively.")]
48 [Required]
49 public string FileName { get; set; }
50
54 [Page(7, "Configuration")]
55 [Header(150, "Delete After Days:")]
56 [ToolTip(151, "Number of days after which log files are deleted.")]
57 [Required]
58 [Range(1, int.MaxValue)]
59 public int DeleteAfterDays { get; set; }
60
65 public override Task<string> GetTypeNameAsync(Language Language)
66 {
67 return Language.GetStringAsync(typeof(GatewayConfigSource), 153, "Text File Event Sink");
68 }
69
76 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
77 {
78 LinkedList<Parameter> Parameters = (LinkedList<Parameter>)await base.GetDisplayableParametersAsync(Language, Caller);
80
81 Parameters.AddLast(new StringParameter("FileName", await Namespace.GetStringAsync(152, "File Name"), this.FileName));
82
83 return Parameters;
84 }
85
90 public override void Export(XmlWriter Output)
91 {
92 Output.WriteStartElement("TextFileEventSink");
93 Output.WriteAttributeString("id", this.SinkId);
94 Output.WriteAttributeString("fileName", this.FileName);
95 Output.WriteAttributeString("deleteAfterDays", this.DeleteAfterDays.ToString());
96 Output.WriteEndElement();
97 }
98 }
99}
Contains information about a language.
Definition: Language.cs:17
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
virtual INode Parent
Parent Node, or null if a root node.
GatewayConfigSource Source
Source hosting the node.
Abstract base class for event sink nodes.
TextFileEventSinkNode(GatewayConfigSource Source, ConfigurationNode Parent, string SinkId, string FileName, int DeleteAfterDays)
Representation of a TextFileEventSink
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
override void Export(XmlWriter Output)
Exports the event sink definition to XML.
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
Tokens available in request.
Definition: RequestOrigin.cs:9
TextPosition
Where the instructions are to be place.
Definition: TextAttribute.cs:9