Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
BooleanHumanReadableConverter.cs
浏览该文件的文档.
1namespace Engine.Serialization {
2 [HumanReadableConverter(typeof(bool))]
4 public string ConvertToString(object value) => !(bool)value ? "False" : "True";
5
6 public object ConvertFromString(Type type, string data) => string.Equals(data, "True", StringComparison.OrdinalIgnoreCase) ? true :
7 string.Equals(data, "False", StringComparison.OrdinalIgnoreCase) ? (object)false : throw new Exception();
8 }
9}