mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Genericize conversions from instance/expressions to XML
This commit is contained in:
@@ -347,15 +347,20 @@ public class Disassembler
|
||||
}
|
||||
|
||||
var runtimeType = constantValue.GetType();
|
||||
var typeSchema = loadResult.ImportTables.TypeImports.FirstOrDefault(t => t.RuntimeType == runtimeType)
|
||||
?? loadResult.ImportTables.TypeImports.FirstOrDefault(t => t.RuntimeType == runtimeType.BaseType)
|
||||
?? throw new Exception($"Failed to find type schema for '{runtimeType.Name}' in {loadResult.Uri}");
|
||||
var typeSchema = GuessTypeSchema(runtimeType, loadResult);
|
||||
|
||||
yield return new(c, typeSchema, constantValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static TypeSchema GuessTypeSchema(Type runtimeType, MarkupLoadResult loadResult)
|
||||
{
|
||||
return loadResult.ImportTables.TypeImports.FirstOrDefault(t => t.RuntimeType == runtimeType)
|
||||
?? loadResult.ImportTables.TypeImports.FirstOrDefault(t => t.RuntimeType == runtimeType.BaseType)
|
||||
?? throw new Exception($"Failed to find type schema for '{runtimeType.Name}' in {loadResult.Uri}");
|
||||
}
|
||||
|
||||
private ConstantDirective EncodeConstant(object constantValue, string constantName, TypeSchema typeSchema)
|
||||
{
|
||||
var qualifiedTypeName = GetQualifiedName(typeSchema);
|
||||
|
||||
Reference in New Issue
Block a user