1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-14 02:09:08 +01:00
MLEM/MLEM.Data/Content/XmlReader.cs

30 lines
905 B
C#
Raw Normal View History

2020-04-22 00:47:09 +02:00
using System;
using System.IO;
using System.Xml.Serialization;
namespace MLEM.Data.Content {
/// <inheritdoc />
2020-04-22 00:47:09 +02:00
public class XmlReader : RawContentReader {
/// <inheritdoc />
2020-04-22 00:47:09 +02:00
public override bool CanRead(Type t) {
return true;
}
/// <inheritdoc />
2022-12-13 13:11:36 +01:00
#if NET6_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "RawContentManager does not support XmlReader in a trimmed or AOT context, so this method is not expected to be called.")]
2022-12-13 13:11:36 +01:00
#endif
2020-04-22 00:47:09 +02:00
public override object Read(RawContentManager manager, string assetPath, Stream stream, Type t, object existing) {
return new XmlSerializer(t).Deserialize(stream);
}
/// <inheritdoc />
2020-04-22 00:47:09 +02:00
public override string[] GetFileExtensions() {
return new[] {"xml"};
}
}
2022-06-17 18:23:47 +02:00
}