IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
MapXmlSerializer.cs
Go to the documentation of this file.
1using System;
2using System.Linq;
3using System.Xml.Linq;
4
6
8{
9
14 {
15
16 public static XNamespace NS = "http://ikvm.net/schemas/mapxml";
17
23 public static MapModifiers ReadMapModifiers(string value) => value != null ? value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Aggregate((MapModifiers)0, (i, j) => i | (Enum.TryParse<MapModifiers>(j, true, out var v) ? v : throw new MapXmlException($"Invalid modifiers value '{j}'."))) : 0;
24
30 public static Scope ReadScope(string value) => value != null ? (Enum.TryParse<Scope>(value, true, out var v) ? v : throw new MapXmlException($"Invalid scope value '{value}'.")) : 0;
31
37 public static MethodAttributes ReadMethodAttributes(string value) => value != null ? value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Aggregate((MethodAttributes)0, (i, j) => i | (Enum.TryParse<MethodAttributes>(j, true, out var v) ? v : throw new MapXmlException($"Invalid attributes value '{j}'."))) : 0;
38
44 public Root Read(XDocument document)
45 {
46 return Read(document.Root);
47 }
48
54 public Root Read(XElement element)
55 {
56 return Root.Read(element);
57 }
58
59 }
60
61}
Provides the ability to serialize MapXML.
static Scope ReadScope(string value)
Reads a single Scope value.
static MapModifiers ReadMapModifiers(string value)
Reads a list of MapModifiers values.
static MethodAttributes ReadMethodAttributes(string value)
Reads a list of MapModifiers values.
Root Read(XElement element)
Deserializes the given XML into a Root instance.
Root Read(XDocument document)
Deserializes the given XML into a Root instance.