Simplify load fix
This commit is contained in:
@@ -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, 体配色 体配色)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user