Simplify load fix

This commit is contained in:
AbdulmanovAI
2025-10-29 16:38:42 +04:00
parent fe3b681c66
commit 00aa9998c7

View File

@@ -78,23 +78,15 @@ namespace SlaveMatrix
[NonSerialized]
public Type ThisType;
// Храним только имя типа (можно AQN)
[OptionalField] private string _thisTypeName;
//Some how fixes saves (thx GPT)
[OnSerializing]
private void OnSerializing(StreamingContext _)
{
_thisTypeName = ThisType?.AssemblyQualifiedName
?? GetType().AssemblyQualifiedName;
}
//So how I am understend it (description)
//This Type is empty on deserialization because Type is not serializable
//We need just init it after deserialization
[OnDeserialized]
private void OnDeserialized(StreamingContext _)
{
ThisType = _thisTypeName != null
? Type.GetType(_thisTypeName, throwOnError: false) ?? GetType()
: GetType();
}
private void OnDeserialized(StreamingContext _) => ThisType = GetType();
public virtual Ele GetEle(double DisUnit, Med Med, )
{