mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 01:05:32 +00:00
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System.Xml.Linq;
|
|
|
|
namespace HaDocument.Models {
|
|
public class App {
|
|
public string Index { get; } = "";
|
|
public string Name { get; } = "";
|
|
public string Category { get; } = "";
|
|
|
|
public XElement? XElement { get; }
|
|
|
|
public App(
|
|
string index,
|
|
string name,
|
|
string category,
|
|
XElement? xElement = null
|
|
) {
|
|
Index = index;
|
|
Name = name;
|
|
Category = category;
|
|
XElement = xElement;
|
|
}
|
|
|
|
public static App? FromXElement(XElement element) {
|
|
if (!element.HasAttributes || element.Name != "appDef") return null;
|
|
if (element.Attribute("index")?.Value == null || element.Attribute("name")?.Value == null || element.Attribute("category")?.Value == null) return null;
|
|
return new App(
|
|
element.Attribute("index")!.Value,
|
|
element.Attribute("name")!.Value,
|
|
element.Attribute("category")!.Value,
|
|
element
|
|
);
|
|
}
|
|
}
|
|
} |