Files
C4IT-F4SD-Client/F4SD-ActionConnector/Models/ExternalCommunicationConfiguration.cs
Meik 0b52999b1d feat: expand cockpit integrations and support workflows
Add Phoenix remote desktop, action connector, documentation engine, and gamification support. Refactor support-case processing and search/action UI, and update installer assets and dependencies.
2026-07-13 11:16:53 +02:00

75 lines
2.4 KiB
C#

using C4IT.XML;
using F4SD.ActionConnector.Enumerations;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Xml;
using static C4IT.Logging.cLogManager;
namespace F4SD.ActionConnector.Models
{
internal class ExternalCommunicationConfiguration
{
private const string FileNameConfig = "F4SD-ExternalCommunication-Configuration.xml";
private const string FileNameConfigSchema = "F4SD-ExternalCommunication-Configuration.xsd";
private const string ConfigRootElement = "F4SD-ExternalCommunication-Configuration";
public IDictionary<TriggerEvent, Trigger> Triggers { get; } = new Dictionary<TriggerEvent, Trigger>();
private const string TriggersNodeName = "Triggers";
private const string TriggerNodeName = "Trigger";
public void Initiate(XmlElement rootElement, cXmlParser parser)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
var triggersNode = rootElement.SelectSingleNode(TriggersNodeName);
parser.EnterElement(TriggersNodeName);
var triggerNodes = triggersNode.SelectNodes(TriggerNodeName);
if (triggerNodes is null || triggerNodes.Count == 0)
return;
parser.EnterElement(TriggerNodeName);
foreach (XmlElement triggerNodeElement in triggerNodes)
{
try
{
Trigger trigger = new Trigger(triggerNodeElement, parser);
if (trigger is null || !Triggers.ContainsKey(trigger.Event))
continue;
Triggers.Add(trigger.Event, trigger);
}
catch (Exception ex)
{
LogException(ex);
}
finally
{
parser.SelectElementNext();
}
}
parser.LeaveElement(TriggerNodeName);
}
catch (Exception ex)
{
LogException(ex);
}
finally
{
parser.LeaveElement(TriggersNodeName);
LogMethodEnd(CM);
}
}
}
}