2025-07-17 14:07:44 -05:00
|
|
|
using Microsoft.Iris.Asm;
|
|
|
|
|
using Microsoft.Iris.Markup;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Iris.DecompXml.Mock;
|
|
|
|
|
|
|
|
|
|
internal record IrisObject(object Object, TypeSchema Type)
|
|
|
|
|
{
|
2025-07-17 14:30:19 -05:00
|
|
|
public static IrisObject Create(object objIn, TypeSchema type, DecompileContext context)
|
2025-07-17 14:07:44 -05:00
|
|
|
{
|
|
|
|
|
object obj = objIn;
|
|
|
|
|
|
|
|
|
|
if (objIn is IrisObject irisObj)
|
|
|
|
|
{
|
|
|
|
|
return irisObj.Type is null
|
|
|
|
|
? (irisObj with { Type = type })
|
|
|
|
|
: irisObj;
|
|
|
|
|
}
|
2025-07-20 02:03:16 -05:00
|
|
|
else if (objIn is null)
|
|
|
|
|
{
|
|
|
|
|
type ??= UIXTypes.MapIDToType(UIXTypeID.Null);
|
|
|
|
|
}
|
2025-07-17 14:07:44 -05:00
|
|
|
|
|
|
|
|
if (objIn is Disassembler.RawConstantInfo constantInfo)
|
|
|
|
|
{
|
|
|
|
|
obj = constantInfo.Value;
|
|
|
|
|
type ??= constantInfo.Type;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-17 14:30:19 -05:00
|
|
|
type ??= Disassembler.GuessTypeSchema(obj.GetType(), context.LoadResult);
|
2025-07-17 14:07:44 -05:00
|
|
|
|
|
|
|
|
return new(obj, type);
|
|
|
|
|
}
|
|
|
|
|
}
|