mirror of
https://github.com/ZuneDev/Xune.git
synced 2026-07-27 13:13:10 -07:00
Added UIX library
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllConstructorSchema
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllConstructorSchema : ConstructorSchema
|
||||
{
|
||||
private TypeSchema[] _parameterTypes;
|
||||
private uint _id;
|
||||
|
||||
public DllConstructorSchema(DllTypeSchema owner, uint ID)
|
||||
: base(owner)
|
||||
=> _id = ID;
|
||||
|
||||
public bool Load(IntPtr constructor) => QueryForParameterTypes(constructor);
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public void DEBUG_Dump()
|
||||
{
|
||||
string str1 = string.Empty;
|
||||
if (_parameterTypes != null)
|
||||
{
|
||||
for (int index = 0; index < _parameterTypes.Length; ++index)
|
||||
{
|
||||
string str2 = "<null>";
|
||||
if (_parameterTypes[index] != null)
|
||||
str2 = _parameterTypes[index].Name;
|
||||
str1 = string.Format("{0}{1}{2}", str1, index > 0 ? ", " : string.Empty, str2);
|
||||
}
|
||||
}
|
||||
string.Format("0x{0:x8} {1}({2})", _id, Owner.Name, str1);
|
||||
}
|
||||
|
||||
public override TypeSchema[] ParameterTypes => _parameterTypes;
|
||||
|
||||
private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner.Owner;
|
||||
|
||||
private bool QueryForParameterTypes(IntPtr constructor)
|
||||
{
|
||||
bool flag1 = false;
|
||||
uint count;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryConstructorParameterCount(constructor, out count)))
|
||||
{
|
||||
uint[] IDs = new uint[count];
|
||||
if (CheckNativeReturn(NativeApi.SpGetConstructorParameterTypes(constructor, IDs, count)))
|
||||
{
|
||||
if (count > 0U)
|
||||
{
|
||||
_parameterTypes = new TypeSchema[count];
|
||||
bool flag2 = false;
|
||||
for (int index = 0; index < count; ++index)
|
||||
{
|
||||
TypeSchema typeSchema = DllLoadResult.MapType(IDs[index]);
|
||||
if (typeSchema != null)
|
||||
_parameterTypes[index] = typeSchema;
|
||||
else
|
||||
flag2 = true;
|
||||
}
|
||||
flag1 = !flag2;
|
||||
}
|
||||
else
|
||||
{
|
||||
_parameterTypes = TypeSchema.EmptyList;
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag1;
|
||||
}
|
||||
|
||||
public override object Construct(object[] parameters) => ((DllTypeSchema)Owner).Construct(_id, parameters);
|
||||
|
||||
private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXConstructor");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllEnumProxy
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllEnumProxy
|
||||
{
|
||||
private int _value;
|
||||
private DllEnumSchema _schema;
|
||||
|
||||
public DllEnumProxy(DllEnumSchema schema, int value)
|
||||
{
|
||||
_value = value;
|
||||
_schema = schema;
|
||||
}
|
||||
|
||||
public int Value => _value;
|
||||
|
||||
public DllEnumSchema Type => _schema;
|
||||
|
||||
public override string ToString() => _schema.InvokeToString(this);
|
||||
|
||||
public override int GetHashCode() => _value.GetHashCode();
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
bool flag = false;
|
||||
if (other is DllEnumProxy dllEnumProxy)
|
||||
flag = _schema == dllEnumProxy._schema && _value == dllEnumProxy._value;
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllEnumSchema
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using Microsoft.Iris.Session;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllEnumSchema : EnumSchema
|
||||
{
|
||||
private uint _id;
|
||||
private IntPtr _nativeSchema;
|
||||
|
||||
public DllEnumSchema(LoadResult owner, uint id, IntPtr nativeSchema)
|
||||
: base(owner)
|
||||
{
|
||||
_id = id;
|
||||
_nativeSchema = nativeSchema;
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public void DEBUG_DumpEnum()
|
||||
{
|
||||
int val1 = 0;
|
||||
foreach (KeyValueEntry<string, int> nameToValue in NameToValueMap)
|
||||
{
|
||||
if (nameToValue.Key != null)
|
||||
val1 = Math.Max(val1, nameToValue.Key.Length);
|
||||
}
|
||||
string.Format("{{0,{0}}} = 0x{{1:x8}}", val1);
|
||||
foreach (KeyValueEntry<string, int> nameToValue in NameToValueMap)
|
||||
;
|
||||
}
|
||||
|
||||
public uint ID => _id;
|
||||
|
||||
public bool Load()
|
||||
{
|
||||
string name;
|
||||
bool flag = QueryName(out name);
|
||||
if (flag)
|
||||
{
|
||||
bool isFlags;
|
||||
flag = QueryIsFlags(out isFlags);
|
||||
if (flag)
|
||||
{
|
||||
string[] names;
|
||||
int[] values;
|
||||
flag = QueryNamesAndValues(out names, out values);
|
||||
if (flag)
|
||||
{
|
||||
Initialize(name, typeof(DllEnumProxy), isFlags, names, values);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private unsafe bool QueryName(out string name)
|
||||
{
|
||||
char* name1;
|
||||
bool flag = CheckNativeReturn(NativeApi.SpQueryEnumName(_nativeSchema, out name1));
|
||||
name = !flag ? null : new string(name1);
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryIsFlags(out bool isFlags) => CheckNativeReturn(NativeApi.SpQueryEnumIsFlags(_nativeSchema, out isFlags));
|
||||
|
||||
private unsafe bool QueryNamesAndValues(out string[] names, out int[] values)
|
||||
{
|
||||
bool flag1 = false;
|
||||
names = null;
|
||||
values = null;
|
||||
uint valueCount;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryEnumValueCount(_nativeSchema, out valueCount)))
|
||||
{
|
||||
bool flag2 = false;
|
||||
if (valueCount > 0U)
|
||||
{
|
||||
names = new string[valueCount];
|
||||
values = new int[valueCount];
|
||||
for (uint index = 0; index < valueCount; ++index)
|
||||
{
|
||||
char* name;
|
||||
int num;
|
||||
if (CheckNativeReturn(NativeApi.SpGetEnumNameValue(_nativeSchema, index, out name, out num)))
|
||||
{
|
||||
if ((IntPtr)name != IntPtr.Zero)
|
||||
{
|
||||
names[index] = new string(name);
|
||||
values[index] = num;
|
||||
}
|
||||
else
|
||||
ErrorManager.ReportError("Script runtime failure: Invalid 'null' value for '{0}'", "Name");
|
||||
}
|
||||
else
|
||||
{
|
||||
flag2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
flag1 = !flag2;
|
||||
}
|
||||
return flag1;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
base.OnDispose();
|
||||
NativeApi.SpReleaseExternalObject(_nativeSchema);
|
||||
_nativeSchema = IntPtr.Zero;
|
||||
}
|
||||
|
||||
public object GetBoxedValue(int value) => EnumValueToObject(value);
|
||||
|
||||
protected override object EnumValueToObject(int value) => new DllEnumProxy(this, value);
|
||||
|
||||
protected override int ValueFromObject(object obj) => ((DllEnumProxy)obj).Value;
|
||||
|
||||
public string InvokeToString(DllEnumProxy proxy)
|
||||
{
|
||||
string str = null;
|
||||
IntPtr result;
|
||||
if (CheckNativeReturn(NativeApi.SpInvokeEnumToString(_nativeSchema, proxy.Value, out result)))
|
||||
str = DllProxyServices.GetString(result);
|
||||
return str;
|
||||
}
|
||||
|
||||
private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner;
|
||||
|
||||
private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXEnum");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllEventSchema
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllEventSchema : EventSchema
|
||||
{
|
||||
private string _name;
|
||||
private bool _isStatic;
|
||||
|
||||
public DllEventSchema(DllTypeSchema owner, uint ID)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Load(IntPtr eventSchema) => QueryEventName(eventSchema) && QueryIsStatic(eventSchema);
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public void DEBUG_Dump()
|
||||
{
|
||||
}
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public bool IsStatic => _isStatic;
|
||||
|
||||
private unsafe bool QueryEventName(IntPtr eventSchema)
|
||||
{
|
||||
bool flag = false;
|
||||
char* name;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryEventName(eventSchema, out name)))
|
||||
{
|
||||
_name = NotifyService.CanonicalizeString(new string(name));
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryIsStatic(IntPtr eventSchema) => CheckNativeReturn(NativeApi.SpQueryEventIsStatic(eventSchema, out _isStatic));
|
||||
|
||||
private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXEvent");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllInterfaceProxy
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal abstract class DllInterfaceProxy : DllProxyObject
|
||||
{
|
||||
protected IntPtr _interface;
|
||||
|
||||
~DllInterfaceProxy() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(_interface));
|
||||
|
||||
protected override void OnDispose() => new DllProxyObject.AppThreadReleaseEntry(_interface).Release();
|
||||
|
||||
protected override void LoadWorker(IntPtr nativeObject, IntPtr nativeMarshalAs)
|
||||
{
|
||||
_interface = nativeMarshalAs;
|
||||
base.LoadWorker(nativeObject, nativeMarshalAs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllIntrinsicTypeSchema
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.Markup.UIX;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllIntrinsicTypeSchema : DllTypeSchemaBase
|
||||
{
|
||||
public DllIntrinsicTypeSchema(DllLoadResult owner, uint ID, TypeSchema equivalentType)
|
||||
: base(owner, ID)
|
||||
{
|
||||
_baseType = ObjectSchema.Type;
|
||||
_name = InvariantString.Format("<DLL Intrinsic> {0}", equivalentType.Name);
|
||||
_marshalAs = ID;
|
||||
RegisterOneWayEquivalence(this, equivalentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllLoadResult
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.Markup.UIX;
|
||||
using Microsoft.Iris.OS;
|
||||
using Microsoft.Iris.Session;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllLoadResult : LoadResult
|
||||
{
|
||||
private DllLoadResultFactory _source;
|
||||
private LoadResultStatus _status;
|
||||
private LoadPass _loadPass;
|
||||
private IntPtr _schema;
|
||||
private Map<uint, TypeSchema> _userDefinedTypes;
|
||||
private Map<uint, TypeSchema> _intrinsicTypes;
|
||||
private static Map<uint, DllLoadResult.IntrinsicTypeData> s_intrinsicData;
|
||||
private ushort _component;
|
||||
private static ushort s_nextID = 1;
|
||||
private static LoadResult s_objectContext;
|
||||
|
||||
public static void Startup()
|
||||
{
|
||||
DllLoadResultFactory.Startup();
|
||||
DllProxyServices.Startup();
|
||||
LoadIntrinsicTypeData();
|
||||
}
|
||||
|
||||
private static void LoadIntrinsicTypeData()
|
||||
{
|
||||
s_intrinsicData = new Map<uint, DllLoadResult.IntrinsicTypeData>();
|
||||
s_intrinsicData[4294967294U] = new DllLoadResult.IntrinsicTypeData(BooleanSchema.Type);
|
||||
s_intrinsicData[4294967293U] = new DllLoadResult.IntrinsicTypeData(ByteSchema.Type);
|
||||
s_intrinsicData[4294967292U] = new DllLoadResult.IntrinsicTypeData(DoubleSchema.Type);
|
||||
s_intrinsicData[4294967285U] = new DllLoadResult.IntrinsicTypeData(ListSchema.Type, typeof(DllProxyList));
|
||||
s_intrinsicData[4294967284U] = new DllLoadResult.IntrinsicTypeData(ImageSchema.Type);
|
||||
s_intrinsicData[4294967283U] = new DllLoadResult.IntrinsicTypeData(Int32Schema.Type);
|
||||
s_intrinsicData[4294967282U] = new DllLoadResult.IntrinsicTypeData(Int64Schema.Type);
|
||||
s_intrinsicData[4294967280U] = new DllLoadResult.IntrinsicTypeData(ObjectSchema.Type);
|
||||
s_intrinsicData[4294967279U] = new DllLoadResult.IntrinsicTypeData(SingleSchema.Type);
|
||||
s_intrinsicData[4294967278U] = new DllLoadResult.IntrinsicTypeData(StringSchema.Type);
|
||||
s_intrinsicData[4294967277U] = new DllLoadResult.IntrinsicTypeData(VoidSchema.Type);
|
||||
}
|
||||
|
||||
public static void Shutdown() => DllProxyServices.Shutdown();
|
||||
|
||||
public static bool CheckNativeReturn(uint hr, string interfaceName)
|
||||
{
|
||||
if ((int)hr >= 0)
|
||||
return true;
|
||||
ErrorManager.ReportError("Schema API failure: A method on '{0}' failed with code '0x{1:X8}'", interfaceName, hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool CheckNativeReturn(uint hr) => CheckNativeReturn(hr, "IUIXTypeSchema");
|
||||
|
||||
public static void PushContext(LoadResult newContext) => s_objectContext = newContext;
|
||||
|
||||
public static LoadResult CurrentContext => s_objectContext;
|
||||
|
||||
public static void PopContext() => s_objectContext = null;
|
||||
|
||||
public static TypeSchema MapType(uint typeID)
|
||||
{
|
||||
uint schemaComponent = UIXID.GetSchemaComponent(typeID);
|
||||
TypeSchema typeSchema = null;
|
||||
DllLoadResult dllLoadResult = null;
|
||||
if (schemaComponent != ushort.MaxValue)
|
||||
{
|
||||
dllLoadResult = DllLoadResultFactory.GetLoadResultByID(schemaComponent);
|
||||
if (dllLoadResult != null)
|
||||
typeSchema = dllLoadResult.MapLocalType(typeID);
|
||||
}
|
||||
else if (CurrentContext is DllLoadResult currentContext)
|
||||
typeSchema = currentContext.MapIntrinsicType(typeID);
|
||||
if (typeSchema == null)
|
||||
ErrorManager.ReportError("Unable to find type with ID '0x{0:X8}' in '{1}'", typeID, dllLoadResult != null ? dllLoadResult.Uri : string.Empty);
|
||||
return typeSchema;
|
||||
}
|
||||
|
||||
private TypeSchema MapIntrinsicType(uint typeID)
|
||||
{
|
||||
if (_intrinsicTypes == null)
|
||||
_intrinsicTypes = new Map<uint, TypeSchema>();
|
||||
TypeSchema typeSchema;
|
||||
DllLoadResult.IntrinsicTypeData intrinsicTypeData;
|
||||
if (!_intrinsicTypes.TryGetValue(typeID, out typeSchema) && s_intrinsicData.TryGetValue(typeID, out intrinsicTypeData))
|
||||
{
|
||||
typeSchema = !intrinsicTypeData.DemandCreateTypeSchema ? intrinsicTypeData.FrameworkEquivalent : new DllIntrinsicTypeSchema(this, typeID, intrinsicTypeData.FrameworkEquivalent);
|
||||
_intrinsicTypes[typeID] = typeSchema;
|
||||
}
|
||||
return typeSchema;
|
||||
}
|
||||
|
||||
private TypeSchema MapLocalType(uint typeID)
|
||||
{
|
||||
TypeSchema typeSchema = null;
|
||||
_userDefinedTypes.TryGetValue(typeID, out typeSchema);
|
||||
return typeSchema;
|
||||
}
|
||||
|
||||
public DllLoadResult(DllLoadResultFactory sourceFactory, IntPtr nativeSchema, string uri)
|
||||
: base(uri)
|
||||
{
|
||||
_source = sourceFactory;
|
||||
_status = LoadResultStatus.Loading;
|
||||
_schema = nativeSchema;
|
||||
_loadPass = LoadPass.Invalid;
|
||||
_component = s_nextID++;
|
||||
}
|
||||
|
||||
public override void Load(LoadPass pass)
|
||||
{
|
||||
if (pass <= _loadPass || pass != LoadPass.DeclareTypes)
|
||||
return;
|
||||
_status = !SetSchemaID() || !LoadTypes() ? LoadResultStatus.Error : LoadResultStatus.Success;
|
||||
_loadPass = LoadPass.Done;
|
||||
}
|
||||
|
||||
public ushort SchemaComponent => _component;
|
||||
|
||||
private bool SetSchemaID() => CheckNativeReturn(NativeApi.SpSetSchemaID(_schema, SchemaComponent));
|
||||
|
||||
private bool LoadTypes()
|
||||
{
|
||||
bool flag = false;
|
||||
UIXIDVerifier idVerifier = new UIXIDVerifier(this);
|
||||
uint typeCount;
|
||||
uint enumCount;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryTypeCount(_schema, out typeCount)) && CheckNativeReturn(NativeApi.SpQueryEnumCount(_schema, out enumCount)))
|
||||
{
|
||||
int capacity = (int)typeCount + (int)enumCount;
|
||||
if (capacity > 0)
|
||||
{
|
||||
_userDefinedTypes = new Map<uint, TypeSchema>(capacity);
|
||||
if (!LoadClasses(typeCount, idVerifier) || !LoadEnums(enumCount, idVerifier) || !ResolveTypes(idVerifier))
|
||||
goto label_4;
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
label_4:
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool LoadClasses(uint numClasses, UIXIDVerifier idVerifier)
|
||||
{
|
||||
bool flag = false;
|
||||
if (numClasses > 0U)
|
||||
{
|
||||
for (uint index = 0; index < numClasses; ++index)
|
||||
{
|
||||
if (!GetTypeSchema(index, idVerifier))
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return !flag;
|
||||
}
|
||||
|
||||
private bool GetTypeSchema(uint index, UIXIDVerifier idVerifier)
|
||||
{
|
||||
bool flag = false;
|
||||
IntPtr type;
|
||||
uint ID;
|
||||
if (CheckNativeReturn(NativeApi.SpGetTypeSchema(_schema, index, out type, out ID)))
|
||||
{
|
||||
if (type != IntPtr.Zero)
|
||||
{
|
||||
StoreType(new DllTypeSchema(this, ID, type), ID, true, idVerifier);
|
||||
flag = idVerifier.RegisterID(ID);
|
||||
}
|
||||
else
|
||||
ErrorManager.ReportError("NULL object returned from {0}", "IUIXSchema::GetType");
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private void StoreType(TypeSchema schema, uint ID, bool isClass, UIXIDVerifier idVerifier) => _userDefinedTypes[ID] = schema;
|
||||
|
||||
private static void DEBUG_DumpType(object param)
|
||||
{
|
||||
}
|
||||
|
||||
private bool LoadEnums(uint numEnums, UIXIDVerifier idVerifier)
|
||||
{
|
||||
bool flag = false;
|
||||
if (numEnums > 0U)
|
||||
{
|
||||
for (uint index = 0; index < numEnums; ++index)
|
||||
{
|
||||
if (!GetEnumSchema(index, idVerifier))
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return !flag;
|
||||
}
|
||||
|
||||
private bool GetEnumSchema(uint index, UIXIDVerifier idVerifier)
|
||||
{
|
||||
bool flag = false;
|
||||
IntPtr enumType;
|
||||
uint ID;
|
||||
if (CheckNativeReturn(NativeApi.SpGetEnumSchema(_schema, index, out enumType, out ID)))
|
||||
{
|
||||
if (enumType != IntPtr.Zero)
|
||||
{
|
||||
StoreType(new DllEnumSchema(this, ID, enumType), ID, false, idVerifier);
|
||||
flag = idVerifier.RegisterID(ID);
|
||||
}
|
||||
else
|
||||
ErrorManager.ReportError("NULL object returned from {0}", "IUIXSchema::GetEnum");
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool ResolveTypes(UIXIDVerifier idVerifier)
|
||||
{
|
||||
bool flag = false;
|
||||
if (_userDefinedTypes != null && _userDefinedTypes.Count > 0)
|
||||
{
|
||||
foreach (TypeSchema typeSchema in _userDefinedTypes.Values)
|
||||
{
|
||||
switch (typeSchema)
|
||||
{
|
||||
case DllTypeSchema dllTypeSchema:
|
||||
if (!dllTypeSchema.Load(idVerifier))
|
||||
{
|
||||
flag = true;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
case DllEnumSchema dllEnumSchema:
|
||||
if (!dllEnumSchema.Load())
|
||||
{
|
||||
flag = true;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
flag = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return !flag;
|
||||
}
|
||||
|
||||
private static void DEBUG_DumpEnum(object param)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
base.OnDispose();
|
||||
if (_userDefinedTypes != null && _userDefinedTypes.Count > 0)
|
||||
{
|
||||
foreach (DisposableObject disposableObject in _userDefinedTypes.Values)
|
||||
disposableObject.Dispose(this);
|
||||
}
|
||||
if (_intrinsicTypes != null && _intrinsicTypes.Count > 0)
|
||||
{
|
||||
foreach (TypeSchema typeSchema in _intrinsicTypes.Values)
|
||||
{
|
||||
if (typeSchema is DllIntrinsicTypeSchema intrinsicTypeSchema)
|
||||
intrinsicTypeSchema.Dispose(this);
|
||||
}
|
||||
}
|
||||
NativeApi.SpReleaseExternalObject(_schema);
|
||||
_schema = IntPtr.Zero;
|
||||
_source.NotifyLoadResultDisposed(this);
|
||||
}
|
||||
|
||||
public override TypeSchema FindType(string name)
|
||||
{
|
||||
if (_userDefinedTypes != null && _userDefinedTypes.Count > 0)
|
||||
{
|
||||
foreach (TypeSchema typeSchema in _userDefinedTypes.Values)
|
||||
{
|
||||
if (typeSchema.Name == name)
|
||||
return typeSchema;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override LoadResultStatus Status => _status;
|
||||
|
||||
public override LoadResult[] Dependencies => EmptyList;
|
||||
|
||||
public override bool Cachable => true;
|
||||
|
||||
public static Type RuntimeTypeForMarshalAs(uint marshalAs)
|
||||
{
|
||||
Type type = null;
|
||||
if (marshalAs == uint.MaxValue)
|
||||
{
|
||||
type = typeof(DllProxyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DllLoadResult.IntrinsicTypeData intrinsicTypeData;
|
||||
if (s_intrinsicData.TryGetValue(marshalAs, out intrinsicTypeData))
|
||||
type = intrinsicTypeData.MarshalAsRuntimeType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
private class IntrinsicTypeData
|
||||
{
|
||||
private TypeSchema _frameworkType;
|
||||
private Type _runtimeType;
|
||||
|
||||
public IntrinsicTypeData(TypeSchema frameworkEquivalent)
|
||||
: this(frameworkEquivalent, null)
|
||||
{
|
||||
}
|
||||
|
||||
public IntrinsicTypeData(TypeSchema frameworkEquivalent, Type runtimeMarshalAsType)
|
||||
{
|
||||
_frameworkType = frameworkEquivalent;
|
||||
_runtimeType = runtimeMarshalAsType;
|
||||
}
|
||||
|
||||
public TypeSchema FrameworkEquivalent => _frameworkType;
|
||||
|
||||
public Type MarshalAsRuntimeType => _runtimeType;
|
||||
|
||||
public bool DemandCreateTypeSchema => MarshalAsRuntimeType != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllLoadResultFactory
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using Microsoft.Iris.Session;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllLoadResultFactory : SharedDisposableObject
|
||||
{
|
||||
private const string c_DllProtocol = "dll://";
|
||||
private string _dllName;
|
||||
private IntPtr _module;
|
||||
private IntPtr _schemaFactory;
|
||||
private static Map<string, DllLoadResult> s_loadResultCache = new Map<string, DllLoadResult>();
|
||||
private static Map<uint, DllLoadResult> s_loadResultIDCache = new Map<uint, DllLoadResult>();
|
||||
private static Map<string, DllLoadResultFactory> s_dllFactoriesCache = new Map<string, DllLoadResultFactory>();
|
||||
|
||||
public static void Startup() => MarkupSystem.RegisterFactoryByProtocol("dll://", new CreateLoadResultHandler(GetLoadResult));
|
||||
|
||||
public static DllLoadResult GetLoadResultByID(uint id)
|
||||
{
|
||||
DllLoadResult dllLoadResult;
|
||||
s_loadResultIDCache.TryGetValue(id, out dllLoadResult);
|
||||
return dllLoadResult;
|
||||
}
|
||||
|
||||
private static LoadResult GetLoadResult(string uri)
|
||||
{
|
||||
DllLoadResult dllLoadResult;
|
||||
if (s_loadResultCache.TryGetValue(uri, out dllLoadResult))
|
||||
return dllLoadResult;
|
||||
int length = uri.IndexOf('!');
|
||||
string str;
|
||||
string qualifier;
|
||||
if (length != -1)
|
||||
{
|
||||
str = uri.Substring("dll://".Length, length);
|
||||
qualifier = uri.Substring(length + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = uri.Substring("dll://".Length);
|
||||
qualifier = null;
|
||||
}
|
||||
DllLoadResultFactory loadResultFactory;
|
||||
if (!s_dllFactoriesCache.TryGetValue(str, out loadResultFactory))
|
||||
{
|
||||
loadResultFactory = new DllLoadResultFactory(str);
|
||||
s_dllFactoriesCache[str] = loadResultFactory;
|
||||
}
|
||||
DllLoadResult loadResult = loadResultFactory.GetLoadResult(uri, qualifier);
|
||||
if (loadResult != null)
|
||||
{
|
||||
s_loadResultCache[uri] = loadResult;
|
||||
s_loadResultIDCache[loadResult.SchemaComponent] = loadResult;
|
||||
}
|
||||
return loadResult;
|
||||
}
|
||||
|
||||
private DllLoadResultFactory(string dllName)
|
||||
{
|
||||
_dllName = dllName;
|
||||
int num = (int)NativeApi.SpLoadDll(_dllName, out _module);
|
||||
if ((int)NativeApi.SpCreateDllLoadResultFactory(_module, out _schemaFactory) >= 0)
|
||||
return;
|
||||
ErrorManager.ReportError("Unable to create IUIXSchemaFactory from '{0}'", dllName);
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
base.OnDispose();
|
||||
s_dllFactoriesCache.Remove(_dllName);
|
||||
if (_schemaFactory != IntPtr.Zero)
|
||||
{
|
||||
NativeApi.SpReleaseExternalObject(_schemaFactory);
|
||||
_schemaFactory = IntPtr.Zero;
|
||||
}
|
||||
if (!(_module != IntPtr.Zero))
|
||||
return;
|
||||
NativeApi.SpSendDllSchemaUnloadNotification(_module);
|
||||
NativeApi.SpFreeDll(_module);
|
||||
_module = IntPtr.Zero;
|
||||
}
|
||||
|
||||
private DllLoadResult GetLoadResult(string fullUri, string qualifier)
|
||||
{
|
||||
DllLoadResult dllLoadResult = null;
|
||||
IntPtr loadResult = IntPtr.Zero;
|
||||
if (_schemaFactory != IntPtr.Zero)
|
||||
{
|
||||
if ((int)NativeApi.SpCreateDllLoadResult(_schemaFactory, qualifier, out loadResult) < 0)
|
||||
ErrorManager.ReportError("Unable to create IUIXSchema from '{0}'", fullUri);
|
||||
else if (loadResult != IntPtr.Zero)
|
||||
{
|
||||
dllLoadResult = new DllLoadResult(this, loadResult, fullUri);
|
||||
RegisterUsage(dllLoadResult);
|
||||
}
|
||||
else
|
||||
ErrorManager.ReportError("NULL object returned from {0}", "IUIXSchemaFactory::GetSchema");
|
||||
}
|
||||
return dllLoadResult;
|
||||
}
|
||||
|
||||
public void NotifyLoadResultDisposed(DllLoadResult loadResult)
|
||||
{
|
||||
s_loadResultCache.Remove(loadResult.Uri);
|
||||
s_loadResultIDCache.Remove(loadResult.SchemaComponent);
|
||||
UnregisterUsage(loadResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllMethodSchema
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllMethodSchema : MethodSchema
|
||||
{
|
||||
private bool _isStatic;
|
||||
private TypeSchema _returnType;
|
||||
private TypeSchema[] _parameterTypes;
|
||||
private string _name;
|
||||
private uint _id;
|
||||
|
||||
public DllMethodSchema(DllTypeSchema owner, uint ID)
|
||||
: base(owner)
|
||||
=> _id = ID;
|
||||
|
||||
public bool Load(IntPtr method) => QueryMethodName(method) && QueryForParameterTypes(method) && QueryReturnType(method) && QueryIsStatic(method);
|
||||
|
||||
public uint ID => _id;
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public void DEBUG_Dump()
|
||||
{
|
||||
string str1 = string.Empty;
|
||||
if (IsStatic)
|
||||
str1 = "static ";
|
||||
string str2 = "void";
|
||||
if (ReturnType != null)
|
||||
str2 = ReturnType.Name;
|
||||
string str3 = string.Empty;
|
||||
if (_parameterTypes != null)
|
||||
{
|
||||
for (int index = 0; index < _parameterTypes.Length; ++index)
|
||||
{
|
||||
string str4 = "<null>";
|
||||
if (_parameterTypes[index] != null)
|
||||
str4 = _parameterTypes[index].Name;
|
||||
str3 = string.Format("{0}{1}{2}", str3, index > 0 ? ", " : string.Empty, str4);
|
||||
}
|
||||
}
|
||||
string.Format("0x{0:x8} {1}{2} {3}({4})", _id, str1, str2, Name, str3);
|
||||
}
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public override TypeSchema[] ParameterTypes => _parameterTypes;
|
||||
|
||||
public override TypeSchema ReturnType => _returnType;
|
||||
|
||||
public override bool IsStatic => _isStatic;
|
||||
|
||||
private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)Owner;
|
||||
|
||||
public override object Invoke(object instance, object[] parameters) => OwnerTypeSchema.InvokeMethod(instance, this, parameters);
|
||||
|
||||
private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner.Owner;
|
||||
|
||||
private unsafe bool QueryMethodName(IntPtr method)
|
||||
{
|
||||
bool flag = false;
|
||||
char* name;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryMethodName(method, out name)))
|
||||
{
|
||||
_name = new string(name);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryForParameterTypes(IntPtr method)
|
||||
{
|
||||
bool flag1 = false;
|
||||
uint count;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryMethodParameterCount(method, out count)))
|
||||
{
|
||||
if (count > 0U)
|
||||
{
|
||||
uint[] IDs = new uint[(int)count];
|
||||
if (CheckNativeReturn(NativeApi.SpGetMethodParameterTypes(method, IDs, count)))
|
||||
{
|
||||
_parameterTypes = new TypeSchema[(int)count];
|
||||
bool flag2 = false;
|
||||
for (uint index = 0; index < count; ++index)
|
||||
{
|
||||
TypeSchema typeSchema = DllLoadResult.MapType(IDs[index]);
|
||||
if (typeSchema != null)
|
||||
_parameterTypes[index] = typeSchema;
|
||||
else
|
||||
flag2 = true;
|
||||
}
|
||||
flag1 = !flag2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_parameterTypes = TypeSchema.EmptyList;
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
return flag1;
|
||||
}
|
||||
|
||||
private bool QueryReturnType(IntPtr method)
|
||||
{
|
||||
bool flag = false;
|
||||
uint type;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryMethodReturnType(method, out type)))
|
||||
{
|
||||
_returnType = DllLoadResult.MapType(type);
|
||||
flag = _returnType != null;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryIsStatic(IntPtr method) => CheckNativeReturn(NativeApi.SpQueryMethodIsStatic(method, out _isStatic));
|
||||
|
||||
private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXMethod");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllPropertySchema
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllPropertySchema : PropertySchema
|
||||
{
|
||||
private BitVector32 _bits;
|
||||
private string _name;
|
||||
private TypeSchema _type;
|
||||
private uint _id;
|
||||
|
||||
public DllPropertySchema(DllTypeSchema owner, uint ID)
|
||||
: base(owner)
|
||||
=> _id = ID;
|
||||
|
||||
public bool Load(IntPtr property) => QueryPropertyName(property) && QueryPropertyType(property) && (QueryCanRead(property) && QueryCanWrite(property)) && QueryIsStatic(property) && QueryNotifiesOnChange(property);
|
||||
|
||||
public uint ID => _id;
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public void DEBUG_Dump()
|
||||
{
|
||||
string str1 = string.Empty;
|
||||
if (IsStatic)
|
||||
str1 = "static ";
|
||||
string str2 = "<null>";
|
||||
if (PropertyType != null)
|
||||
str2 = PropertyType.Name;
|
||||
string str3 = string.Empty;
|
||||
if (CanRead)
|
||||
str3 = "get;";
|
||||
string str4 = string.Empty;
|
||||
if (CanWrite)
|
||||
str4 = string.Format("{0}set;", CanRead ? " " : string.Empty);
|
||||
string str5 = "<notifies>";
|
||||
if (!NotifiesOnChange)
|
||||
str5 = "<doesn't notify>";
|
||||
string.Format("0x{0:x8} {1}{2} {3} {{{4}{5}}} {6}", _id, str1, str2, Name, str3, str4, str5);
|
||||
}
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public override TypeSchema PropertyType => _type;
|
||||
|
||||
public override TypeSchema AlternateType => (TypeSchema)null;
|
||||
|
||||
public override bool CanRead => GetBit(Bits.CanRead);
|
||||
|
||||
public override bool CanWrite => GetBit(Bits.CanWrite);
|
||||
|
||||
public override bool IsStatic => GetBit(Bits.IsStatic);
|
||||
|
||||
public override ExpressionRestriction ExpressionRestriction => ExpressionRestriction.None;
|
||||
|
||||
public override bool RequiredForCreation => false;
|
||||
|
||||
public override RangeValidator RangeValidator => (RangeValidator)null;
|
||||
|
||||
public override bool NotifiesOnChange => GetBit(Bits.NotifiesOnChange);
|
||||
|
||||
private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)Owner;
|
||||
|
||||
public override object GetValue(object instance) => OwnerTypeSchema.GetPropertyValue(instance, this);
|
||||
|
||||
public override void SetValue(ref object instance, object value) => OwnerTypeSchema.SetPropertyValue(instance, this, value);
|
||||
|
||||
private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner.Owner;
|
||||
|
||||
private unsafe bool QueryPropertyName(IntPtr property)
|
||||
{
|
||||
bool flag = false;
|
||||
char* name;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryPropertyName(property, out name)))
|
||||
{
|
||||
_name = NotifyService.CanonicalizeString(new string(name));
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryPropertyType(IntPtr property)
|
||||
{
|
||||
bool flag = false;
|
||||
uint type;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryPropertyType(property, out type)))
|
||||
{
|
||||
_type = DllLoadResult.MapType(type);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryCanRead(IntPtr property)
|
||||
{
|
||||
bool flag = false;
|
||||
bool canRead;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryPropertyCanRead(property, out canRead)))
|
||||
{
|
||||
SetBit(Bits.CanRead, canRead);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryCanWrite(IntPtr property)
|
||||
{
|
||||
bool flag = false;
|
||||
bool canWrite;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryPropertyCanWrite(property, out canWrite)))
|
||||
{
|
||||
SetBit(Bits.CanWrite, canWrite);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool QueryIsStatic(IntPtr property)
|
||||
{
|
||||
bool flag = false;
|
||||
bool isStatic;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryPropertyIsStatic(property, out isStatic)))
|
||||
{
|
||||
SetBit(Bits.IsStatic, isStatic);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXProperty");
|
||||
|
||||
private bool QueryNotifiesOnChange(IntPtr property)
|
||||
{
|
||||
bool flag = false;
|
||||
bool notifiesOnChange;
|
||||
if (CheckNativeReturn(NativeApi.SpQueryPropertyNotifiesOnChange(property, out notifiesOnChange)))
|
||||
{
|
||||
SetBit(Bits.NotifiesOnChange, notifiesOnChange);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool GetBit(DllPropertySchema.Bits lookupBit) => _bits[(int)lookupBit];
|
||||
|
||||
private void SetBit(DllPropertySchema.Bits changeBit, bool value) => _bits[(int)changeBit] = value;
|
||||
|
||||
private enum Bits : uint
|
||||
{
|
||||
CanRead = 1,
|
||||
CanWrite = 2,
|
||||
IsStatic = 4,
|
||||
NotifiesOnChange = 8,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllProxyHandleTable
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllProxyHandleTable : ProxyHandleTable<DllProxyObjectReference>
|
||||
{
|
||||
public DllProxyHandleTable.DllProxyHandleTableEnumerator GetEnumerator() => new DllProxyHandleTable.DllProxyHandleTableEnumerator(GetTableEnumerator());
|
||||
|
||||
public ulong RegisterProxy(object d) => AllocateHandle(new DllProxyObjectReference()
|
||||
{
|
||||
Value = d
|
||||
});
|
||||
|
||||
public void ReleaseProxy(ulong handle)
|
||||
{
|
||||
DllProxyObjectReference oldValue;
|
||||
ReleaseHandle(handle, out oldValue);
|
||||
oldValue.Value = null;
|
||||
}
|
||||
|
||||
protected bool LookupByHandleWorker(ulong handle, out object obj)
|
||||
{
|
||||
DllProxyObjectReference proxyObjectReference;
|
||||
bool flag = InternalLookupByHandle(handle, out proxyObjectReference);
|
||||
obj = !flag ? null : proxyObjectReference.Value;
|
||||
return flag;
|
||||
}
|
||||
|
||||
internal struct DllProxyHandleTableEnumerator : IEnumerator
|
||||
{
|
||||
private ProxyHandleTable<DllProxyObjectReference>.ProxyHandleTableEnumerator _enumerator;
|
||||
|
||||
public DllProxyHandleTableEnumerator(
|
||||
ProxyHandleTable<DllProxyObjectReference>.ProxyHandleTableEnumerator enumerator)
|
||||
{
|
||||
_enumerator = enumerator;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
bool flag;
|
||||
do
|
||||
{
|
||||
flag = _enumerator.MoveNext();
|
||||
}
|
||||
while ((!flag || _enumerator.Current.Value == null) && flag);
|
||||
return flag;
|
||||
}
|
||||
|
||||
public object Current => _enumerator.Current.Value;
|
||||
|
||||
public void Reset() => _enumerator.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllProxyList
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Data;
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using Microsoft.Iris.ViewItems;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllProxyList :
|
||||
DllInterfaceProxy,
|
||||
IVirtualList,
|
||||
INotifyList,
|
||||
IList,
|
||||
ICollection,
|
||||
IEnumerable,
|
||||
IUIXListCallbacks
|
||||
{
|
||||
private UpdateHelper _updater;
|
||||
private Repeater _repeater;
|
||||
private bool _wantSlowDataRequests;
|
||||
private bool _callbacksRegistered;
|
||||
private SlowDataAcquireCompleteHandler _slowDataAcquireCompleteHandler;
|
||||
private UIListContentsChangedHandler _contentsChanged;
|
||||
|
||||
protected override void LoadWorker(IntPtr nativeObject, IntPtr nativeMarshalAs)
|
||||
{
|
||||
base.LoadWorker(nativeObject, nativeMarshalAs);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListWantSlowDataRequests(_interface, out _wantSlowDataRequests));
|
||||
if (!_wantSlowDataRequests)
|
||||
return;
|
||||
_updater = new UpdateHelper(this);
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
UpdateCallbackRegistration(true);
|
||||
base.OnDispose();
|
||||
}
|
||||
|
||||
public unsafe int Add(object value)
|
||||
{
|
||||
int count = 0;
|
||||
UIXVariant uixVariant;
|
||||
UIXVariant.MarshalObject(value, &uixVariant);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListAdd(_interface, &uixVariant, out count));
|
||||
UIXVariant.CleanupMarshalledObject(&uixVariant);
|
||||
return count;
|
||||
}
|
||||
|
||||
public bool Contains(object value) => IndexOf(value) >= 0;
|
||||
|
||||
public unsafe int IndexOf(object value)
|
||||
{
|
||||
int index = -1;
|
||||
UIXVariant uixVariant;
|
||||
UIXVariant.MarshalObject(value, &uixVariant);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListIndexOf(_interface, &uixVariant, out index));
|
||||
UIXVariant.CleanupMarshalledObject(&uixVariant);
|
||||
return index;
|
||||
}
|
||||
|
||||
public void Clear() => NativeApi.SUCCEEDED(NativeApi.SpUIXListClear(_interface));
|
||||
|
||||
public unsafe void Insert(int index, object value)
|
||||
{
|
||||
UIXVariant uixVariant;
|
||||
UIXVariant.MarshalObject(value, &uixVariant);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListInsert(_interface, index, &uixVariant));
|
||||
UIXVariant.CleanupMarshalledObject(&uixVariant);
|
||||
}
|
||||
|
||||
public unsafe void Remove(object value)
|
||||
{
|
||||
UIXVariant uixVariant;
|
||||
UIXVariant.MarshalObject(value, &uixVariant);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListRemove(_interface, &uixVariant));
|
||||
UIXVariant.CleanupMarshalledObject(&uixVariant);
|
||||
}
|
||||
|
||||
public void RemoveAt(int index) => NativeApi.SUCCEEDED(NativeApi.SpUIXListRemoveAt(_interface, index));
|
||||
|
||||
public void CopyTo(Array array, int index) => throw new NotImplementedException();
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
int count = 0;
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListGetCount(_interface, out count));
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
bool IVirtualList.IsItemAvailable(int index)
|
||||
{
|
||||
bool isAvailable;
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListIsItemAvailable(_interface, index, out isAvailable));
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
public void RequestItem(int index, ItemRequestCallback callback)
|
||||
{
|
||||
object obj = this[index];
|
||||
callback(this, index, obj);
|
||||
}
|
||||
|
||||
public unsafe object this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = null;
|
||||
UIXVariant inboundObject;
|
||||
if (NativeApi.SUCCEEDED(NativeApi.SpUIXListGetItem(_interface, index, out inboundObject)))
|
||||
obj = UIXVariant.GetValue(inboundObject, OwningLoadResult);
|
||||
return obj;
|
||||
}
|
||||
set
|
||||
{
|
||||
UIXVariant uixVariant;
|
||||
UIXVariant.MarshalObject(value, &uixVariant);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListSetItem(_interface, index, &uixVariant));
|
||||
UIXVariant.CleanupMarshalledObject(&uixVariant);
|
||||
}
|
||||
}
|
||||
|
||||
public object SyncRoot => (object)null;
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
|
||||
public StackIListEnumerator GetEnumerator() => new StackIListEnumerator(this);
|
||||
|
||||
public event UIListContentsChangedHandler ContentsChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_contentsChanged == null)
|
||||
UpdateCallbackRegistration();
|
||||
_contentsChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_contentsChanged -= value;
|
||||
if (_contentsChanged != null)
|
||||
return;
|
||||
UpdateCallbackRegistration();
|
||||
}
|
||||
}
|
||||
|
||||
public void Move(int oldIndex, int newIndex)
|
||||
{
|
||||
int num = (int)NativeApi.SpUIXListMove(_interface, oldIndex, newIndex);
|
||||
}
|
||||
|
||||
public void ListChanged(int nativeType, int oldIndex, int newIndex, int count)
|
||||
{
|
||||
bool flag1 = true;
|
||||
bool flag2 = true;
|
||||
UIListContentsChangeType type = (UIListContentsChangeType)nativeType;
|
||||
switch (type)
|
||||
{
|
||||
case UIListContentsChangeType.Add:
|
||||
case UIListContentsChangeType.AddRange:
|
||||
case UIListContentsChangeType.Remove:
|
||||
case UIListContentsChangeType.Insert:
|
||||
case UIListContentsChangeType.InsertRange:
|
||||
case UIListContentsChangeType.Clear:
|
||||
case UIListContentsChangeType.Reset:
|
||||
if (!flag1)
|
||||
break;
|
||||
if (_contentsChanged != null)
|
||||
_contentsChanged(this, new UIListContentsChangedArgs(type, oldIndex, newIndex, count));
|
||||
if (flag2)
|
||||
FireNotification(NotificationID.Count);
|
||||
if (_updater == null)
|
||||
break;
|
||||
ForwardListChangeToUpdater(type, oldIndex, newIndex, count);
|
||||
break;
|
||||
case UIListContentsChangeType.Move:
|
||||
case UIListContentsChangeType.Modified:
|
||||
flag2 = false;
|
||||
goto case UIListContentsChangeType.Add;
|
||||
default:
|
||||
flag1 = false;
|
||||
goto case UIListContentsChangeType.Add;
|
||||
}
|
||||
}
|
||||
|
||||
private void ForwardListChangeToUpdater(
|
||||
UIListContentsChangeType type,
|
||||
int oldIndex,
|
||||
int newIndex,
|
||||
int count)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case UIListContentsChangeType.Remove:
|
||||
_updater.RemoveIndex(oldIndex);
|
||||
_updater.AdjustIndices(oldIndex, -1);
|
||||
break;
|
||||
case UIListContentsChangeType.Move:
|
||||
int lowThreshold;
|
||||
int highThreshold;
|
||||
int amt;
|
||||
if (oldIndex < newIndex)
|
||||
{
|
||||
lowThreshold = oldIndex;
|
||||
highThreshold = newIndex;
|
||||
amt = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lowThreshold = newIndex;
|
||||
highThreshold = oldIndex;
|
||||
amt = 1;
|
||||
}
|
||||
_updater.RemoveIndex(oldIndex);
|
||||
_updater.AdjustIndices(lowThreshold, highThreshold, amt);
|
||||
_updater.AddIndex(newIndex);
|
||||
break;
|
||||
case UIListContentsChangeType.Insert:
|
||||
_updater.AdjustIndices(newIndex, 1);
|
||||
break;
|
||||
case UIListContentsChangeType.InsertRange:
|
||||
_updater.AdjustIndices(newIndex, count);
|
||||
break;
|
||||
case UIListContentsChangeType.Clear:
|
||||
case UIListContentsChangeType.Reset:
|
||||
_updater.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SlowDataRequestsEnabled => _wantSlowDataRequests;
|
||||
|
||||
public void NotifyRequestSlowData(int index) => NativeApi.SUCCEEDED(NativeApi.SpUIXListFetchSlowData(_interface, index));
|
||||
|
||||
public void SlowDataAcquireComplete(int index)
|
||||
{
|
||||
bool flag = false;
|
||||
if (_slowDataAcquireCompleteHandler != null)
|
||||
flag = _slowDataAcquireCompleteHandler(this, index);
|
||||
if (flag)
|
||||
return;
|
||||
_updater.NotifySlowDataAcquireComplete(index);
|
||||
}
|
||||
|
||||
public SlowDataAcquireCompleteHandler SlowDataAcquireCompleteHandler
|
||||
{
|
||||
get => _slowDataAcquireCompleteHandler;
|
||||
set
|
||||
{
|
||||
if (!(value != _slowDataAcquireCompleteHandler))
|
||||
return;
|
||||
_slowDataAcquireCompleteHandler = value;
|
||||
UpdateCallbackRegistration();
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyVisualsCreated(int index)
|
||||
{
|
||||
if (_updater != null)
|
||||
_updater.AddIndex(index);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListNotifyVisualsCreated(_interface, index));
|
||||
}
|
||||
|
||||
public void NotifyVisualsReleased(int index)
|
||||
{
|
||||
if (_updater != null)
|
||||
_updater.RemoveIndex(index);
|
||||
NativeApi.SUCCEEDED(NativeApi.SpUIXListNotifyVisualsReleased(_interface, index));
|
||||
}
|
||||
|
||||
public Repeater RepeaterHost
|
||||
{
|
||||
get => _repeater;
|
||||
set
|
||||
{
|
||||
if (value == _repeater)
|
||||
return;
|
||||
_repeater = value;
|
||||
UpdateCallbackRegistration();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCallbackRegistration() => UpdateCallbackRegistration(false);
|
||||
|
||||
private void UpdateCallbackRegistration(bool inDispose)
|
||||
{
|
||||
bool flag = (_slowDataAcquireCompleteHandler != null || _contentsChanged != null || _repeater != null) & !inDispose;
|
||||
if (flag == _callbacksRegistered)
|
||||
return;
|
||||
if (flag)
|
||||
{
|
||||
int num1 = (int)NativeApi.SpUIXListRegisterCallbacks(_interface, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = (int)NativeApi.SpUIXListUnregisterCallbacks(_interface, this);
|
||||
if (_updater != null)
|
||||
_updater.Clear();
|
||||
}
|
||||
_callbacksRegistered = flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllProxyObject
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using Microsoft.Iris.RenderAPI;
|
||||
using Microsoft.Iris.Session;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllProxyObject : NotifyObjectBase, ISchemaInfo, IDisposableObject
|
||||
{
|
||||
private IntPtr _nativeObject;
|
||||
private ulong _handle;
|
||||
private DllTypeSchemaBase _type;
|
||||
private static object s_finalizeLock = new object();
|
||||
private static bool s_pendingAppThreadRelease = false;
|
||||
private static Vector<DllProxyObject.AppThreadReleaseEntry> s_pendingReleases;
|
||||
private static SimpleCallback s_releaseOnAppThread = new SimpleCallback(ReleaseFinalizedObjects);
|
||||
private static DllProxyObjectHandleTable s_handleTable;
|
||||
|
||||
public static void CreateHandleTable() => s_handleTable = new DllProxyObjectHandleTable();
|
||||
|
||||
public static void ReleaseOutstandingProxies()
|
||||
{
|
||||
s_pendingAppThreadRelease = true;
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
foreach (IDisposableObject disposableObject in s_handleTable)
|
||||
disposableObject.Dispose(disposableObject);
|
||||
ReleaseFinalizedObjects();
|
||||
}
|
||||
|
||||
public static DllProxyObject Wrap(IntPtr nativeObject)
|
||||
{
|
||||
DllProxyObject dllProxyObject = null;
|
||||
uint typeID;
|
||||
if (!NativeApi.SUCCEEDED(NativeApi.SpGetTypeID(nativeObject, out typeID)))
|
||||
return null;
|
||||
TypeSchema type = DllLoadResult.MapType(typeID);
|
||||
if (type != null)
|
||||
{
|
||||
dllProxyObject = GetExistingProxy(nativeObject) ?? WrapNewObject(nativeObject, type);
|
||||
NativeApi.SpReleaseExternalObject(nativeObject);
|
||||
}
|
||||
return dllProxyObject;
|
||||
}
|
||||
|
||||
private static DllProxyObject GetExistingProxy(IntPtr nativeObject)
|
||||
{
|
||||
DllProxyObject dllProxyObject = null;
|
||||
ulong state;
|
||||
NativeApi.SpGetStateCache(nativeObject, out state);
|
||||
if (state != 0UL && !s_handleTable.LookupByHandle(state, out dllProxyObject))
|
||||
ErrorManager.ReportError("IUIXObject::GetStateCache retrieved unexpected value");
|
||||
return dllProxyObject;
|
||||
}
|
||||
|
||||
private static DllProxyObject WrapNewObject(IntPtr nativeObject, TypeSchema type)
|
||||
{
|
||||
DllProxyObject dllProxyObject = null;
|
||||
uint marshalAs;
|
||||
IntPtr nativeImpl;
|
||||
if (DetermineProxyInterfaceForObject(nativeObject, type, out marshalAs, out nativeImpl))
|
||||
{
|
||||
switch (marshalAs)
|
||||
{
|
||||
case 4294967281:
|
||||
case 4294967286:
|
||||
case 4294967287:
|
||||
case 4294967288:
|
||||
case 4294967289:
|
||||
case 4294967290:
|
||||
case 4294967291:
|
||||
dllProxyObject = new DllProxyObject();
|
||||
break;
|
||||
case 4294967285:
|
||||
dllProxyObject = new DllProxyList();
|
||||
break;
|
||||
case uint.MaxValue:
|
||||
dllProxyObject = new DllProxyObject();
|
||||
break;
|
||||
default:
|
||||
dllProxyObject = new DllProxyObject();
|
||||
break;
|
||||
}
|
||||
dllProxyObject.Load(nativeObject, nativeImpl, (DllTypeSchemaBase)type);
|
||||
}
|
||||
return dllProxyObject;
|
||||
}
|
||||
|
||||
private static bool DetermineProxyInterfaceForObject(
|
||||
IntPtr nativeObject,
|
||||
TypeSchema type,
|
||||
out uint marshalAs,
|
||||
out IntPtr nativeImpl)
|
||||
{
|
||||
bool flag = false;
|
||||
DllTypeSchemaBase dllTypeSchemaBase = (DllTypeSchemaBase)type;
|
||||
marshalAs = dllTypeSchemaBase.MarshalAs;
|
||||
if (marshalAs == uint.MaxValue)
|
||||
{
|
||||
flag = true;
|
||||
nativeImpl = IntPtr.Zero;
|
||||
}
|
||||
else if (CheckNativeReturn(NativeApi.SpQueryForMarshalAsInterface(nativeObject, marshalAs, out nativeImpl)) && nativeImpl != IntPtr.Zero)
|
||||
flag = true;
|
||||
else
|
||||
ErrorManager.ReportError("Object didn't implement expected interface '{0}'", marshalAs);
|
||||
return flag;
|
||||
}
|
||||
|
||||
protected DllProxyObject() => _handle = 0UL;
|
||||
|
||||
~DllProxyObject() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(_nativeObject, _handle, OwningLoadResult));
|
||||
|
||||
protected static void RegisterAppThreadRelease(DllProxyObject.AppThreadReleaseEntry entry)
|
||||
{
|
||||
lock (s_finalizeLock)
|
||||
{
|
||||
if (s_pendingReleases == null)
|
||||
s_pendingReleases = new Vector<DllProxyObject.AppThreadReleaseEntry>();
|
||||
s_pendingReleases.Add(entry);
|
||||
if (s_pendingAppThreadRelease)
|
||||
return;
|
||||
s_pendingAppThreadRelease = true;
|
||||
DeferredCall.Post(DispatchPriority.Idle, s_releaseOnAppThread);
|
||||
}
|
||||
}
|
||||
|
||||
private void Load(IntPtr nativeObject, IntPtr marshalAs, DllTypeSchemaBase type)
|
||||
{
|
||||
_type = type;
|
||||
_nativeObject = nativeObject;
|
||||
OwningLoadResult.RegisterProxyUsage();
|
||||
_handle = s_handleTable.RegisterProxy(this);
|
||||
NativeApi.SpSetStateCache(_nativeObject, _handle);
|
||||
NativeApi.SpAddRefExternalObject(_nativeObject);
|
||||
LoadWorker(nativeObject, marshalAs);
|
||||
}
|
||||
|
||||
protected virtual void LoadWorker(IntPtr nativeObject, IntPtr nativeMarshalAs)
|
||||
{
|
||||
}
|
||||
|
||||
public static HRESULT OnChangeNotification(IntPtr nativeObject, uint id)
|
||||
{
|
||||
HRESULT hresult = new HRESULT(0);
|
||||
DllProxyObject existingProxy = GetExistingProxy(nativeObject);
|
||||
if (existingProxy != null)
|
||||
{
|
||||
string id1 = null;
|
||||
if (existingProxy._type is DllTypeSchema type)
|
||||
id1 = type.MapChangeID(id);
|
||||
if (id1 != null)
|
||||
{
|
||||
existingProxy.FireNotification(id1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorManager.ReportError("Invalid UIXID '0x{0:X8}' passed to NotifyChange", id);
|
||||
hresult = new HRESULT(-2147024809);
|
||||
}
|
||||
}
|
||||
return hresult;
|
||||
}
|
||||
|
||||
public ulong Handle => _handle;
|
||||
|
||||
public IntPtr NativeObject => _nativeObject;
|
||||
|
||||
public TypeSchema TypeSchema => _type;
|
||||
|
||||
protected DllLoadResult OwningLoadResult => _type.Owner as DllLoadResult;
|
||||
|
||||
private static bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXObject");
|
||||
|
||||
bool IDisposableObject.IsDisposed => _nativeObject == IntPtr.Zero;
|
||||
|
||||
void IDisposableObject.DeclareOwner(object owner)
|
||||
{
|
||||
}
|
||||
|
||||
void IDisposableObject.TransferOwnership(object owner)
|
||||
{
|
||||
}
|
||||
|
||||
void IDisposableObject.Dispose(object owner)
|
||||
{
|
||||
OnDispose();
|
||||
new DllProxyObject.AppThreadReleaseEntry(_nativeObject, _handle, OwningLoadResult).Release();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
private static void ReleaseFinalizedObjects()
|
||||
{
|
||||
Vector<DllProxyObject.AppThreadReleaseEntry> pendingReleases;
|
||||
lock (s_finalizeLock)
|
||||
{
|
||||
pendingReleases = s_pendingReleases;
|
||||
s_pendingReleases = null;
|
||||
s_pendingAppThreadRelease = false;
|
||||
}
|
||||
if (pendingReleases == null || pendingReleases.Count == 0)
|
||||
return;
|
||||
foreach (DllProxyObject.AppThreadReleaseEntry threadReleaseEntry in pendingReleases)
|
||||
threadReleaseEntry.Release();
|
||||
lock (s_finalizeLock)
|
||||
{
|
||||
if (s_pendingAppThreadRelease)
|
||||
return;
|
||||
pendingReleases.Clear();
|
||||
s_pendingReleases = pendingReleases;
|
||||
}
|
||||
}
|
||||
|
||||
private static string DEBUG_FormatIntPtr(IntPtr ptr) => (string)null;
|
||||
|
||||
public string DEBUG_Description() => string.Empty;
|
||||
|
||||
public override string ToString() => _type is DllTypeSchema type ? type.InvokeToString(this) : GetType().Name;
|
||||
|
||||
internal struct AppThreadReleaseEntry
|
||||
{
|
||||
private bool _releaseHandle;
|
||||
public IntPtr _nativeObject;
|
||||
public ulong _handle;
|
||||
public DllLoadResult _loadResult;
|
||||
|
||||
public AppThreadReleaseEntry(IntPtr nativeObject, ulong handle, DllLoadResult loadResult)
|
||||
{
|
||||
_nativeObject = nativeObject;
|
||||
_handle = handle;
|
||||
_loadResult = loadResult;
|
||||
_releaseHandle = true;
|
||||
}
|
||||
|
||||
public AppThreadReleaseEntry(IntPtr nativeObject)
|
||||
{
|
||||
_nativeObject = nativeObject;
|
||||
_releaseHandle = false;
|
||||
_handle = 0UL;
|
||||
_loadResult = null;
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
if (_releaseHandle)
|
||||
{
|
||||
s_handleTable.ReleaseProxy(_handle);
|
||||
ulong state;
|
||||
NativeApi.SpGetStateCache(_nativeObject, out state);
|
||||
if ((long)_handle == (long)state)
|
||||
NativeApi.SpSetStateCache(_nativeObject, 0UL);
|
||||
}
|
||||
NativeApi.SpReleaseExternalObject(_nativeObject);
|
||||
if (!_releaseHandle)
|
||||
return;
|
||||
_loadResult.UnregisterProxyUsage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllProxyObjectHandleTable
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllProxyObjectHandleTable : DllProxyHandleTable
|
||||
{
|
||||
public bool LookupByHandle(ulong handle, out DllProxyObject obj)
|
||||
{
|
||||
object obj1;
|
||||
bool flag = LookupByHandleWorker(handle, out obj1);
|
||||
obj = (DllProxyObject)obj1;
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllProxyObjectReference
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal struct DllProxyObjectReference
|
||||
{
|
||||
private GCHandle _reference;
|
||||
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = null;
|
||||
if (_reference.IsAllocated)
|
||||
obj = _reference.Target;
|
||||
return obj;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (_reference.IsAllocated)
|
||||
_reference.Target = value;
|
||||
else
|
||||
_reference = GCHandle.Alloc(value, GCHandleType.Weak);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_reference.IsAllocated)
|
||||
return;
|
||||
_reference.Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllProxyServices
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Drawing;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.OS;
|
||||
using Microsoft.Iris.Render;
|
||||
using Microsoft.Iris.RenderAPI;
|
||||
using Microsoft.Iris.Session;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllProxyServices : IRawUIXServices
|
||||
{
|
||||
private static StringProxyHandleTable s_stringTable;
|
||||
|
||||
public static void Startup()
|
||||
{
|
||||
DllProxyObject.CreateHandleTable();
|
||||
s_stringTable = new StringProxyHandleTable();
|
||||
int num = (int)NativeApi.SpRegisterNativeServicesCallbacks(new DllProxyServices());
|
||||
}
|
||||
|
||||
public static void Shutdown()
|
||||
{
|
||||
DllProxyObject.ReleaseOutstandingProxies();
|
||||
NativeMarkupDataType.ReleaseOutstandingProxies();
|
||||
NativeApi.SpUnregisterNativeServicesCallbacks();
|
||||
s_stringTable = null;
|
||||
}
|
||||
|
||||
HRESULT IRawUIXServices.NotifyChangeForObject(
|
||||
IntPtr nativeObject,
|
||||
uint changedID)
|
||||
{
|
||||
return DllProxyObject.OnChangeNotification(nativeObject, changedID);
|
||||
}
|
||||
|
||||
private static void Crash(string message) => throw new Exception(message);
|
||||
|
||||
void IRawUIXServices.Crash(string message) => Crash(message);
|
||||
|
||||
public static string GetString(IntPtr nativeStringObject)
|
||||
{
|
||||
string str = null;
|
||||
if (nativeStringObject != IntPtr.Zero)
|
||||
{
|
||||
ulong handle;
|
||||
NativeApi.SpGetStringHandle(nativeStringObject, out handle);
|
||||
if (handle == 0UL)
|
||||
NativeApi.SpConvertStringToManaged(nativeStringObject, out handle);
|
||||
s_stringTable.LookupByHandle(handle, out str);
|
||||
NativeApi.SpReleaseExternalObject(nativeStringObject);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static void CreateNativeString(string value, out IntPtr nativeObject)
|
||||
{
|
||||
nativeObject = IntPtr.Zero;
|
||||
if (value == null || NativeApi.SpCreateNativeString(AllocateStringHandle(value), value.Length, out nativeObject))
|
||||
return;
|
||||
Crash("Unable to allocate string");
|
||||
}
|
||||
|
||||
unsafe ulong IRawUIXServices.AllocateString(char* value, out int length)
|
||||
{
|
||||
string str = new string(value);
|
||||
length = str.Length;
|
||||
return AllocateStringHandle(str);
|
||||
}
|
||||
|
||||
private static ulong AllocateStringHandle(string value)
|
||||
{
|
||||
ulong handle;
|
||||
s_stringTable.GetStringHandle(value, out handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
unsafe void IRawUIXServices.CopyString(
|
||||
ulong handle,
|
||||
char* target,
|
||||
uint targetSize)
|
||||
{
|
||||
string source;
|
||||
s_stringTable.LookupByHandle(handle, out source);
|
||||
NativeApi.SpCopyString(source, target, targetSize);
|
||||
}
|
||||
|
||||
unsafe char* IRawUIXServices.PinString(ulong handle)
|
||||
{
|
||||
char* chPtr;
|
||||
s_stringTable.PinString(handle, out chPtr);
|
||||
return chPtr;
|
||||
}
|
||||
|
||||
void IRawUIXServices.UnpinString(ulong handle) => s_stringTable.UnpinString(handle);
|
||||
|
||||
void IRawUIXServices.ReleaseString(ulong handle) => s_stringTable.ReleaseStringHandle(handle, out string _);
|
||||
|
||||
public static UIImage GetImage(IntPtr nativeImageObject)
|
||||
{
|
||||
UIImage uiImage = null;
|
||||
if (nativeImageObject != IntPtr.Zero)
|
||||
{
|
||||
ulong handle;
|
||||
NativeApi.SpGetImageHandle(nativeImageObject, out handle);
|
||||
if (handle == 0UL)
|
||||
NativeApi.SpConvertImageToManaged(nativeImageObject, out handle);
|
||||
uiImage = (UIImage)GCHandle.FromIntPtr(new IntPtr((long)handle)).Target;
|
||||
NativeApi.SpReleaseExternalObject(nativeImageObject);
|
||||
}
|
||||
return uiImage;
|
||||
}
|
||||
|
||||
public static MarkupDataQuery GetDataQuery(IntPtr nativeQuery)
|
||||
{
|
||||
MarkupDataQuery markupDataQuery = null;
|
||||
if (nativeQuery != IntPtr.Zero)
|
||||
{
|
||||
ulong frameworkQuery;
|
||||
int internalHandle = (int)NativeApi.SpDataBaseObjectGetInternalHandle(nativeQuery, out frameworkQuery);
|
||||
markupDataQuery = NativeMarkupDataQuery.LookupByHandle(frameworkQuery);
|
||||
NativeApi.SpReleaseExternalObject(nativeQuery);
|
||||
}
|
||||
return markupDataQuery;
|
||||
}
|
||||
|
||||
public static MarkupDataType GetDataType(IntPtr nativeObject)
|
||||
{
|
||||
NativeMarkupDataType nativeMarkupDataType = null;
|
||||
if (nativeObject != IntPtr.Zero)
|
||||
{
|
||||
ulong frameworkQuery;
|
||||
int internalHandle = (int)NativeApi.SpDataBaseObjectGetInternalHandle(nativeObject, out frameworkQuery);
|
||||
if (frameworkQuery != 0UL)
|
||||
nativeMarkupDataType = NativeMarkupDataType.LookupByHandle(frameworkQuery);
|
||||
if (nativeMarkupDataType == null)
|
||||
{
|
||||
ulong typeHandle;
|
||||
NativeApi.SpDataBaseObjectGetTypeHandle(nativeObject, out typeHandle);
|
||||
nativeMarkupDataType = NativeMarkupDataType.Create(typeHandle, nativeObject);
|
||||
}
|
||||
NativeApi.SpReleaseExternalObject(nativeObject);
|
||||
}
|
||||
return nativeMarkupDataType;
|
||||
}
|
||||
|
||||
public static void CreateNativeImage(UIImage image, out IntPtr nativeObject)
|
||||
{
|
||||
nativeObject = IntPtr.Zero;
|
||||
if (image == null || !NativeApi.SpCreateNativeImage(GetImageHandle(image, image.Source), image.Source, out nativeObject).IsError())
|
||||
return;
|
||||
Crash("Unable to allocate native image object");
|
||||
}
|
||||
|
||||
private static ulong GetImageHandle(UIImage image, string source) => (ulong)GCHandle.ToIntPtr(GCHandle.Alloc(image)).ToInt64();
|
||||
|
||||
unsafe ulong IRawUIXServices.AllocateImageFromUri(
|
||||
string uri,
|
||||
NativeApi.IMAGE_DECODE_PARAMS* decodeParams)
|
||||
{
|
||||
Size maximumSize;
|
||||
bool flippable;
|
||||
bool antialiasEdges;
|
||||
CrackDecodeParams(decodeParams, out maximumSize, out flippable, out antialiasEdges);
|
||||
return GetImageHandle(new UriImage(uri, Inset.Zero, maximumSize, flippable, antialiasEdges), uri);
|
||||
}
|
||||
|
||||
unsafe ulong IRawUIXServices.AllocateImageFromBits(
|
||||
string ID,
|
||||
NativeApi.UIX_RAW_IMAGE_INFO* imageInfo,
|
||||
NativeApi.IMAGE_DECODE_PARAMS* decodeParams)
|
||||
{
|
||||
SurfaceFormat surfaceFormat;
|
||||
ImageFormatUtils.RawImageFormatToSurfaceFormat(imageInfo->format, out surfaceFormat);
|
||||
Size maximumSize;
|
||||
bool flippable;
|
||||
bool antialiasEdges;
|
||||
CrackDecodeParams(decodeParams, out maximumSize, out flippable, out antialiasEdges);
|
||||
Size imageSize = new Size(imageInfo->width, imageInfo->height);
|
||||
return GetImageHandle(new RawImage(ID, imageSize, imageInfo->stride, surfaceFormat, imageInfo->bits, true, Inset.Zero, maximumSize, flippable, antialiasEdges), ID);
|
||||
}
|
||||
|
||||
unsafe void IRawUIXServices.RemoveCachedImage(
|
||||
string ID,
|
||||
NativeApi.IMAGE_DECODE_PARAMS* decodeParams)
|
||||
{
|
||||
Size maximumSize;
|
||||
bool flippable;
|
||||
bool antialiasEdges;
|
||||
CrackDecodeParams(decodeParams, out maximumSize, out flippable, out antialiasEdges);
|
||||
UriImage.RemoveCache(ID, maximumSize, flippable, antialiasEdges);
|
||||
}
|
||||
|
||||
private static unsafe void CrackDecodeParams(
|
||||
NativeApi.IMAGE_DECODE_PARAMS* decodeParams,
|
||||
out Size maximumSize,
|
||||
out bool flippable,
|
||||
out bool antialiasEdges)
|
||||
{
|
||||
if ((IntPtr)decodeParams != IntPtr.Zero)
|
||||
{
|
||||
maximumSize = new Size(decodeParams->maximumWidth, decodeParams->maximumHeight);
|
||||
flippable = decodeParams->Flippable;
|
||||
antialiasEdges = decodeParams->AntialiasEdges;
|
||||
}
|
||||
else
|
||||
{
|
||||
maximumSize = Size.Zero;
|
||||
flippable = false;
|
||||
antialiasEdges = false;
|
||||
}
|
||||
}
|
||||
|
||||
void IRawUIXServices.ReleaseImage(ulong handle) => GCHandle.FromIntPtr(new IntPtr((long)handle)).Free();
|
||||
|
||||
void IRawUIXServices.RegisterDataProvider(
|
||||
string providerName,
|
||||
IntPtr nativeFactoryCallback)
|
||||
{
|
||||
MarkupDataProvider.RegisterDataProvider(new NativeDataProviderWrapper(providerName, nativeFactoryCallback));
|
||||
}
|
||||
|
||||
unsafe void IRawUIXServices.GetDataMapping(
|
||||
string providerName,
|
||||
ulong typeHandle,
|
||||
IntPtr nativeCallback)
|
||||
{
|
||||
if (!(TypeSchema.LookupById(typeHandle) is MarkupDataTypeSchema typeSchema))
|
||||
return;
|
||||
MarkupDataMapping dataMapping = MarkupDataProvider.FindDataMapping(providerName, typeSchema);
|
||||
NativeApi.NativeDataMappingEntry[] entries = new NativeApi.NativeDataMappingEntry[dataMapping.Mappings.Length];
|
||||
for (int index = 0; index < entries.Length; ++index)
|
||||
{
|
||||
MarkupDataMappingEntry mapping = dataMapping.Mappings[index];
|
||||
entries[index].Source = mapping.Source;
|
||||
entries[index].Target = mapping.Target;
|
||||
entries[index].PropertyName = mapping.Property.Name;
|
||||
entries[index].PropertyTypeName = mapping.Property.PropertyType.Name;
|
||||
entries[index].PropertyTypeHandle = mapping.Property.PropertyType.UniqueId;
|
||||
if (mapping.Property.AlternateType != null)
|
||||
{
|
||||
entries[index].UnderlyingCollectionTypeName = mapping.Property.AlternateType.Name;
|
||||
entries[index].UnderlyingCollectionTypeHandle = mapping.Property.AlternateType.UniqueId;
|
||||
}
|
||||
// ISSUE: untyped stack allocation
|
||||
UIXVariant* destination = stackalloc UIXVariant[sizeof(UIXVariant)];
|
||||
UIXVariant.MarshalObject(mapping.DefaultValue, destination);
|
||||
entries[index].DefaultValue = *destination;
|
||||
}
|
||||
int num = (int)NativeApi.SpDataProviderReportDataMapping(nativeCallback, providerName, typeHandle, (uint)entries.Length, entries);
|
||||
}
|
||||
|
||||
void IRawUIXServices.NotifyChangeForDataObject(
|
||||
ulong frameworkObjectHandle,
|
||||
string propertyName,
|
||||
UIXVariant.VariantType variantType)
|
||||
{
|
||||
MarkupDataTypeBaseObject dataTypeBaseObject = null;
|
||||
switch (variantType)
|
||||
{
|
||||
case UIXVariant.VariantType.UIXDataQuery:
|
||||
dataTypeBaseObject = NativeMarkupDataQuery.LookupByHandle(frameworkObjectHandle);
|
||||
break;
|
||||
case UIXVariant.VariantType.UIXDataType:
|
||||
dataTypeBaseObject = NativeMarkupDataType.LookupByHandle(frameworkObjectHandle);
|
||||
break;
|
||||
}
|
||||
if (dataTypeBaseObject == null)
|
||||
return;
|
||||
propertyName = NotifyService.CanonicalizeString(propertyName);
|
||||
dataTypeBaseObject.FireNotificationThreadSafe(propertyName);
|
||||
}
|
||||
|
||||
IntPtr IRawUIXServices.GetAppWindowHandle()
|
||||
{
|
||||
IntPtr num = IntPtr.Zero;
|
||||
if (UISession.Default != null && UISession.Default.Form != null)
|
||||
num = UISession.Default.Form.__WindowHandle;
|
||||
return num;
|
||||
}
|
||||
|
||||
void IRawUIXServices.ReportError(bool isWarning, string message)
|
||||
{
|
||||
if (isWarning)
|
||||
ErrorManager.ReportWarning(message);
|
||||
else
|
||||
ErrorManager.ReportError(message);
|
||||
}
|
||||
|
||||
void IRawUIXServices.LowPriorityDeferredInvoke(IntPtr callback, IntPtr data) => DeferredCall.Post(DispatchPriority.Idle, new SimpleCallback(new DllProxyServices.DeferredInvokeState()
|
||||
{
|
||||
_callback = callback,
|
||||
_data = data
|
||||
}.Thunk));
|
||||
|
||||
internal class DeferredInvokeState
|
||||
{
|
||||
public IntPtr _callback;
|
||||
public IntPtr _data;
|
||||
|
||||
public void Thunk() => NativeApi.SpCallDeferredInvokeProc(_callback, _data);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,215 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.DllTypeSchemaBase
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class DllTypeSchemaBase : TypeSchema
|
||||
{
|
||||
private BitVector32 _bits;
|
||||
protected uint _typeID;
|
||||
protected Map<MethodSignatureKey, DllConstructorSchema> _constructors;
|
||||
protected Map<uint, DllPropertySchema> _properties;
|
||||
protected Map<MethodSignatureKey, DllMethodSchema> _methods;
|
||||
protected Map<uint, DllEventSchema> _events;
|
||||
protected string _name;
|
||||
protected TypeSchema _baseType;
|
||||
protected uint _marshalAs;
|
||||
|
||||
protected DllTypeSchemaBase(DllLoadResult owner, uint ID)
|
||||
: base(owner)
|
||||
=> _typeID = ID;
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
base.OnDispose();
|
||||
if (_constructors != null)
|
||||
{
|
||||
foreach (KeyValueEntry<MethodSignatureKey, DllConstructorSchema> constructor in _constructors)
|
||||
{
|
||||
if (constructor.Value != null)
|
||||
constructor.Value.Dispose(this);
|
||||
}
|
||||
_constructors = null;
|
||||
}
|
||||
if (_properties != null)
|
||||
{
|
||||
foreach (DllPropertySchema dllPropertySchema in _properties.Values)
|
||||
dllPropertySchema?.Dispose(this);
|
||||
_properties = null;
|
||||
}
|
||||
if (_methods != null)
|
||||
{
|
||||
foreach (KeyValueEntry<MethodSignatureKey, DllMethodSchema> method in _methods)
|
||||
{
|
||||
if (method.Value != null)
|
||||
method.Value.Dispose(this);
|
||||
}
|
||||
_methods = null;
|
||||
}
|
||||
if (_events == null)
|
||||
return;
|
||||
foreach (DllEventSchema dllEventSchema in _events.Values)
|
||||
dllEventSchema?.Dispose(this);
|
||||
}
|
||||
|
||||
public override object ConstructDefault() => (object)null;
|
||||
|
||||
public override int FindTypeHint => (int)_typeID;
|
||||
|
||||
public override bool HasDefaultConstructor => GetBit(Bits.HasDefaultConstructor);
|
||||
|
||||
public override bool IsRuntimeImmutable => GetBit(Bits.IsRuntimeImmutable);
|
||||
|
||||
public override ConstructorSchema FindConstructor(TypeSchema[] parameters)
|
||||
{
|
||||
DllConstructorSchema constructorSchema = null;
|
||||
if (_constructors != null)
|
||||
_constructors.TryGetValue(new MethodSignatureKey(parameters), out constructorSchema);
|
||||
return constructorSchema;
|
||||
}
|
||||
|
||||
public override PropertySchema FindProperty(string name)
|
||||
{
|
||||
if (_properties != null)
|
||||
{
|
||||
foreach (DllPropertySchema dllPropertySchema in _properties.Values)
|
||||
{
|
||||
if (dllPropertySchema != null && dllPropertySchema.Name == name)
|
||||
return dllPropertySchema;
|
||||
}
|
||||
}
|
||||
if (Equivalents != null)
|
||||
{
|
||||
foreach (TypeSchema equivalent in Equivalents)
|
||||
{
|
||||
PropertySchema property = equivalent.FindProperty(name);
|
||||
if (property != null)
|
||||
return property;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override MethodSchema FindMethod(string name, TypeSchema[] parameters)
|
||||
{
|
||||
if (_methods != null)
|
||||
{
|
||||
DllMethodSchema dllMethodSchema = null;
|
||||
if (_methods.TryGetValue(new MethodSignatureKey(name, parameters), out dllMethodSchema))
|
||||
return dllMethodSchema;
|
||||
}
|
||||
if (Equivalents != null)
|
||||
{
|
||||
foreach (TypeSchema equivalent in Equivalents)
|
||||
{
|
||||
MethodSchema method = equivalent.FindMethod(name, parameters);
|
||||
if (method != null)
|
||||
return method;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override EventSchema FindEvent(string name)
|
||||
{
|
||||
DllEventSchema dllEventSchema1 = null;
|
||||
if (_events != null)
|
||||
{
|
||||
foreach (DllEventSchema dllEventSchema2 in _events.Values)
|
||||
{
|
||||
if (dllEventSchema2 != null && dllEventSchema2.Name == name)
|
||||
{
|
||||
dllEventSchema1 = dllEventSchema2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dllEventSchema1;
|
||||
}
|
||||
|
||||
public override PropertySchema[] Properties
|
||||
{
|
||||
get
|
||||
{
|
||||
PropertySchema[] propertySchemaArray = PropertySchema.EmptyList;
|
||||
if (_properties != null && _properties.Count > 0)
|
||||
{
|
||||
propertySchemaArray = new PropertySchema[_properties.Count];
|
||||
int num = 0;
|
||||
foreach (PropertySchema propertySchema in _properties.Values)
|
||||
propertySchemaArray[num++] = propertySchema;
|
||||
}
|
||||
return propertySchemaArray;
|
||||
}
|
||||
}
|
||||
|
||||
public uint MarshalAs => _marshalAs;
|
||||
|
||||
public override string Name => _name;
|
||||
|
||||
public override string AlternateName => (string)null;
|
||||
|
||||
public override TypeSchema Base => _baseType;
|
||||
|
||||
public override Type RuntimeType => DllLoadResult.RuntimeTypeForMarshalAs(_marshalAs);
|
||||
|
||||
public override Result TypeConverter(
|
||||
object from,
|
||||
TypeSchema fromType,
|
||||
out object instance)
|
||||
{
|
||||
instance = null;
|
||||
return Result.Fail("Not implemented");
|
||||
}
|
||||
|
||||
public override bool SupportsTypeConversion(TypeSchema fromType) => false;
|
||||
|
||||
public override void EncodeBinary(ByteCodeWriter writer, object instance)
|
||||
{
|
||||
}
|
||||
|
||||
public override object DecodeBinary(ByteCodeReader reader) => (object)null;
|
||||
|
||||
public override bool SupportsBinaryEncoding => false;
|
||||
|
||||
public override object PerformOperation(object left, object right, OperationType op) => (object)null;
|
||||
|
||||
public override bool SupportsOperation(OperationType op) => false;
|
||||
|
||||
public override bool IsNullAssignable => true;
|
||||
|
||||
public override object FindCanonicalInstance(string name) => (object)null;
|
||||
|
||||
public override void InitializeInstance(ref object instance)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HasInitializer => false;
|
||||
|
||||
public override bool Contractual => false;
|
||||
|
||||
public override bool IsNativeAssignableFrom(object check) => false;
|
||||
|
||||
public override bool IsNativeAssignableFrom(TypeSchema check) => false;
|
||||
|
||||
public override bool Disposable => true;
|
||||
|
||||
protected bool GetBit(DllTypeSchemaBase.Bits lookupBit) => _bits[(int)lookupBit];
|
||||
|
||||
protected void SetBit(DllTypeSchemaBase.Bits changeBit, bool value) => _bits[(int)changeBit] = value;
|
||||
|
||||
protected enum Bits : uint
|
||||
{
|
||||
HasDefaultConstructor = 1,
|
||||
IsRuntimeImmutable = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.MarkupDataQueryHandleTable
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Markup;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class MarkupDataQueryHandleTable : DllProxyHandleTable
|
||||
{
|
||||
public bool LookupByHandle(ulong handle, out MarkupDataQuery obj)
|
||||
{
|
||||
object obj1;
|
||||
bool flag = LookupByHandleWorker(handle, out obj1);
|
||||
obj = (MarkupDataQuery)obj1;
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.CodeModel.Cpp.MarkupDataTypeHandleTable
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Markup;
|
||||
|
||||
namespace Microsoft.Iris.CodeModel.Cpp
|
||||
{
|
||||
internal class MarkupDataTypeHandleTable : DllProxyHandleTable
|
||||
{
|
||||
public bool LookupByHandle(ulong handle, out MarkupDataType obj)
|
||||
{
|
||||
object obj1;
|
||||
bool flag = LookupByHandleWorker(handle, out obj1);
|
||||
obj = (MarkupDataType)obj1;
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user