Add decompiled projects for UIX and UIXControls

This commit is contained in:
Joshua Askharoun
2021-03-31 16:42:58 -05:00
parent a92bb6afc5
commit 6b4b30744b
985 changed files with 117589 additions and 8 deletions
+22
View File
@@ -0,0 +1,22 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AliasMapping
// 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.Markup
{
internal class AliasMapping
{
public string Alias;
public LoadResult LoadResult;
public string TargetType;
public AliasMapping(string alias, LoadResult loadResult, string targetType)
{
this.Alias = alias;
this.LoadResult = loadResult;
this.TargetType = targetType;
}
}
}
@@ -0,0 +1,39 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyConstructorSchema
// 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.Reflection;
namespace Microsoft.Iris.Markup
{
internal class AssemblyConstructorSchema : ConstructorSchema
{
private ConstructorInfo _constructorInfo;
private TypeSchema[] _parameterTypes;
private FastReflectionInvokeHandler _constructor;
public AssemblyConstructorSchema(
AssemblyTypeSchema owner,
ConstructorInfo constructorInfo,
TypeSchema[] parameterTypes)
: base((TypeSchema)owner)
{
this._constructorInfo = constructorInfo;
this._parameterTypes = parameterTypes;
}
public override TypeSchema[] ParameterTypes => this._parameterTypes;
public override object Construct(object[] parameters)
{
object[] paramters = AssemblyLoadResult.UnwrapObjectList(parameters);
AssemblyTypeSchema owner = (AssemblyTypeSchema)this.Owner;
if (this._constructor == null)
this._constructor = ReflectionHelper.CreateMethodInvoke((MethodBase)this._constructorInfo);
object instance = this._constructor((object)null, paramters);
return AssemblyLoadResult.WrapObject((TypeSchema)owner, instance);
}
}
}
@@ -0,0 +1,21 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyEventSchema
// 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.Reflection;
namespace Microsoft.Iris.Markup
{
internal class AssemblyEventSchema : EventSchema
{
private EventInfo _eventInfo;
public AssemblyEventSchema(AssemblyTypeSchema owner, EventInfo eventInfo)
: base((TypeSchema)owner)
=> this._eventInfo = eventInfo;
public override string Name => this._eventInfo.Name;
}
}
@@ -0,0 +1,356 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyLoadResult
// 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.Library;
using Microsoft.Iris.Markup.UIX;
using Microsoft.Iris.ModelItems;
using Microsoft.Iris.Session;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Markup
{
internal class AssemblyLoadResult : LoadResult
{
private const string c_AssemblyProtocol = "assembly://";
private Assembly _assembly;
private string _namespace;
private string _namespacePrefix;
public static TypeSchema ObjectTypeSchema;
public static TypeSchema ListTypeSchema;
public static TypeSchema EnumeratorTypeSchema;
public static TypeSchema DictionaryTypeSchema;
public static TypeSchema CommandTypeSchema;
public static TypeSchema ValueRangeTypeSchema;
private static Map s_typeCache = new Map(32);
private static Map<AssemblyLoadResult.MapAssemblyKey, AssemblyLoadResult> s_assemblyCache = new Map<AssemblyLoadResult.MapAssemblyKey, AssemblyLoadResult>();
private static LoadResult Create(string uri)
{
LoadResult loadResult = (LoadResult)null;
string valueName = uri.Substring("assembly://".Length);
if (valueName.IndexOf('/') == -1)
{
ErrorManager.ReportError("Invalid assembly reference '{0}'. URI must contain a forward slash after the assembly name", (object)uri);
return (LoadResult)null;
}
string leftName;
string rightName;
AssemblyLoadResult.SplitAtLastWhack(valueName, out leftName, out rightName);
AssemblyName name = (AssemblyName)null;
try
{
name = new AssemblyName(leftName);
}
catch (COMException ex)
{
}
catch (FileLoadException ex)
{
}
if (name == null)
{
name = new AssemblyName();
name.CodeBase = leftName;
}
if (name != null)
{
Exception assemblyLoadException;
Assembly assembly = AssemblyLoadResult.FindAssembly(name, out assemblyLoadException);
if (assembly != null)
loadResult = (LoadResult)AssemblyLoadResult.MapAssembly(assembly, rightName);
else if (assemblyLoadException != null)
ErrorManager.ReportError("Failure loading assembly: '{0}'", (object)assemblyLoadException.Message);
else
ErrorManager.ReportError("Failure loading assembly");
}
return loadResult;
}
public static void Startup()
{
AssemblyObjectProxyHelper.InitializeStatics();
MarkupSystem.RegisterFactoryByProtocol("assembly://", new CreateLoadResultHandler(AssemblyLoadResult.Create));
Map typeCache1 = AssemblyLoadResult.s_typeCache;
Type type1 = typeof(object);
FrameworkCompatibleAssemblyPrimitiveTypeSchema primitiveTypeSchema;
AssemblyLoadResult.ObjectTypeSchema = (TypeSchema)(primitiveTypeSchema = new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)ObjectSchema.Type));
TypeSchema typeA1 = (TypeSchema)primitiveTypeSchema;
typeCache1[(object)type1] = (object)primitiveTypeSchema;
TypeSchema.RegisterTwoWayEquivalence(typeA1, (TypeSchema)ObjectSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(void)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)VoidSchema.Type)), (TypeSchema)VoidSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(bool)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)BooleanSchema.Type)), (TypeSchema)BooleanSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(byte)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)ByteSchema.Type)), (TypeSchema)ByteSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(char)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)CharSchema.Type)), (TypeSchema)CharSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(double)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)DoubleSchema.Type)), (TypeSchema)DoubleSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(string)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)StringSchema.Type)), (TypeSchema)StringSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(float)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)SingleSchema.Type)), (TypeSchema)SingleSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(int)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)Int32Schema.Type)), (TypeSchema)Int32Schema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(long)] = (object)new FrameworkCompatibleAssemblyPrimitiveTypeSchema((TypeSchema)Int64Schema.Type)), (TypeSchema)Int64Schema.Type);
Map typeCache2 = AssemblyLoadResult.s_typeCache;
Type type2 = typeof(IList);
FrameworkCompatibleAssemblyTypeSchema assemblyTypeSchema1;
AssemblyLoadResult.ListTypeSchema = (TypeSchema)(assemblyTypeSchema1 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IList), typeof(IList), typeof(ArrayList)));
TypeSchema typeA2 = (TypeSchema)assemblyTypeSchema1;
typeCache2[(object)type2] = (object)assemblyTypeSchema1;
TypeSchema.RegisterTwoWayEquivalence(typeA2, (TypeSchema)ListSchema.Type);
Map typeCache3 = AssemblyLoadResult.s_typeCache;
Type type3 = typeof(IEnumerator);
FrameworkCompatibleAssemblyTypeSchema assemblyTypeSchema2;
AssemblyLoadResult.EnumeratorTypeSchema = (TypeSchema)(assemblyTypeSchema2 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IEnumerator), typeof(IEnumerator)));
TypeSchema typeA3 = (TypeSchema)assemblyTypeSchema2;
typeCache3[(object)type3] = (object)assemblyTypeSchema2;
TypeSchema.RegisterTwoWayEquivalence(typeA3, (TypeSchema)EnumeratorSchema.Type);
Map typeCache4 = AssemblyLoadResult.s_typeCache;
Type type4 = typeof(IDictionary);
FrameworkCompatibleAssemblyTypeSchema assemblyTypeSchema3;
AssemblyLoadResult.DictionaryTypeSchema = (TypeSchema)(assemblyTypeSchema3 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IDictionary), AssemblyObjectProxyHelper.ProxyDictionaryType, typeof(Dictionary<object, object>)));
TypeSchema producer1 = (TypeSchema)assemblyTypeSchema3;
typeCache4[(object)type4] = (object)assemblyTypeSchema3;
TypeSchema.RegisterOneWayEquivalence(producer1, (TypeSchema)DictionarySchema.Type);
Map typeCache5 = AssemblyLoadResult.s_typeCache;
Type type5 = typeof(ICommand);
FrameworkCompatibleAssemblyTypeSchema assemblyTypeSchema4;
AssemblyLoadResult.CommandTypeSchema = (TypeSchema)(assemblyTypeSchema4 = new FrameworkCompatibleAssemblyTypeSchema(typeof(ICommand), AssemblyObjectProxyHelper.ProxyCommandType));
TypeSchema producer2 = (TypeSchema)assemblyTypeSchema4;
typeCache5[(object)type5] = (object)assemblyTypeSchema4;
TypeSchema.RegisterOneWayEquivalence(producer2, (TypeSchema)CommandSchema.Type);
Map typeCache6 = AssemblyLoadResult.s_typeCache;
Type type6 = typeof(IValueRange);
FrameworkCompatibleAssemblyTypeSchema assemblyTypeSchema5;
AssemblyLoadResult.ValueRangeTypeSchema = (TypeSchema)(assemblyTypeSchema5 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IValueRange), AssemblyObjectProxyHelper.ProxyValueRangeType));
TypeSchema producer3 = (TypeSchema)assemblyTypeSchema5;
typeCache6[(object)type6] = (object)assemblyTypeSchema5;
TypeSchema.RegisterOneWayEquivalence(producer3, (TypeSchema)ValueRangeSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(Group)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(Group), typeof(IUIGroup))), (TypeSchema)GroupSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(Image)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(Image), typeof(UIImage))), (TypeSchema)ImageSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(Type)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(Type), typeof(TypeSchema), (Type)null, AssemblyLoadResult.ObjectTypeSchema)), (TypeSchema)TypeSchemaDefinition.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(VideoStream)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(VideoStream))), (TypeSchema)VideoStreamSchema.Type);
TypeSchema producer4;
AssemblyLoadResult.s_typeCache[(object)typeof(Microsoft.Iris.Choice)] = (object)(FrameworkCompatibleAssemblyTypeSchema)(producer4 = (TypeSchema)new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.Choice)));
TypeSchema.RegisterOneWayEquivalence(producer4, (TypeSchema)ChoiceSchema.Type);
TypeSchema.RegisterOneWayEquivalence(producer4, (TypeSchema)ValueRangeSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(Microsoft.Iris.BooleanChoice)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.BooleanChoice))), (TypeSchema)BooleanChoiceSchema.Type);
TypeSchema producer5;
AssemblyLoadResult.s_typeCache[(object)typeof(Microsoft.Iris.RangedValue)] = (object)(FrameworkCompatibleAssemblyTypeSchema)(producer5 = (TypeSchema)new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.RangedValue)));
TypeSchema.RegisterOneWayEquivalence(producer5, (TypeSchema)RangedValueSchema.Type);
TypeSchema.RegisterOneWayEquivalence(producer5, (TypeSchema)ValueRangeSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(Microsoft.Iris.IntRangedValue)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.IntRangedValue))), (TypeSchema)IntRangedValueSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(Microsoft.Iris.ByteRangedValue)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.ByteRangedValue))), (TypeSchema)ByteRangedValueSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(DataProviderQuery)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(DataProviderQuery), typeof(MarkupDataQuery))), (TypeSchema)MarkupDataQueryInstanceSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(DataProviderObject)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(DataProviderObject), typeof(MarkupDataType))), (TypeSchema)MarkupDataTypeInstanceSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[(object)typeof(DataProviderQueryStatus)] = (object)new FrameworkCompatibleAssemblyTypeSchema(typeof(DataProviderQueryStatus))), UIXLoadResultExports.DataQueryStatusType);
}
public static void Shutdown()
{
foreach (SharedDisposableObject disposableObject in AssemblyLoadResult.s_assemblyCache.Values)
disposableObject.UnregisterUsage((object)AssemblyLoadResult.s_assemblyCache);
AssemblyLoadResult.s_assemblyCache.Clear();
AssemblyLoadResult.s_assemblyCache = (Map<AssemblyLoadResult.MapAssemblyKey, AssemblyLoadResult>)null;
foreach (AssemblyTypeSchema assemblyTypeSchema in AssemblyLoadResult.s_typeCache.Values)
{
AssemblyLoadResult owner = (AssemblyLoadResult)assemblyTypeSchema.Owner;
assemblyTypeSchema.Dispose((object)owner);
}
AssemblyLoadResult.s_typeCache.Clear();
AssemblyLoadResult.s_typeCache = (Map)null;
}
public string Namespace => this._namespace;
public override LoadResultStatus Status => LoadResultStatus.Success;
public override TypeSchema FindType(string name)
{
Type type = this._assembly.GetType(this._namespacePrefix + name, false);
if (type == null)
return (TypeSchema)null;
if (type.IsVisible)
return (TypeSchema)AssemblyLoadResult.MapType(type);
ErrorManager.ReportError("Type '{0}' is not public in '{1}'", (object)name, (object)this._assembly);
return (TypeSchema)null;
}
public static AssemblyLoadResult MapAssembly(Assembly assembly, string ns)
{
AssemblyLoadResult.MapAssemblyKey key = new AssemblyLoadResult.MapAssemblyKey(assembly, ns);
AssemblyLoadResult assemblyLoadResult;
if (!AssemblyLoadResult.s_assemblyCache.TryGetValue(key, out assemblyLoadResult))
{
string uri = "assembly://" + assembly.FullName;
if (ns != null)
uri = uri + "/" + ns;
assemblyLoadResult = new AssemblyLoadResult(assembly, ns, uri);
AssemblyLoadResult.s_assemblyCache[key] = assemblyLoadResult;
assemblyLoadResult.RegisterUsage((object)AssemblyLoadResult.s_assemblyCache);
}
return assemblyLoadResult;
}
public static AssemblyTypeSchema MapType(Type type)
{
object obj;
AssemblyTypeSchema assemblyTypeSchema;
if (AssemblyLoadResult.s_typeCache.TryGetValue((object)type, out obj))
{
assemblyTypeSchema = (AssemblyTypeSchema)obj;
}
else
{
assemblyTypeSchema = AssemblyObjectProxyHelper.CreateProxySchema(type);
AssemblyLoadResult.s_typeCache[(object)type] = (object)assemblyTypeSchema;
}
return assemblyTypeSchema;
}
public static Type MapType(TypeSchema typeSchema)
{
if (typeSchema is AssemblyTypeSchema assemblyTypeSchema)
return assemblyTypeSchema.InternalType;
for (TypeSchema typeSchema1 = typeSchema; typeSchema1 != null; typeSchema1 = typeSchema1.Base)
{
if (typeSchema1.Equivalents != null)
{
foreach (TypeSchema equivalent in typeSchema1.Equivalents)
{
if (equivalent is AssemblyTypeSchema assemblyTypeSchemaB)
return assemblyTypeSchemaB.InternalType;
}
}
}
return (Type)null;
}
internal static Type[] MapTypeList(TypeSchema[] typeSchemaList)
{
Type[] typeArray = new Type[typeSchemaList.Length];
for (int index = 0; index < typeSchemaList.Length; ++index)
{
typeArray[index] = AssemblyLoadResult.MapType(typeSchemaList[index]);
if (typeArray[index] == null)
return (Type[])null;
}
return typeArray;
}
internal static TypeSchema[] MapTypeList(Type[] typeList)
{
TypeSchema[] typeSchemaArray = new TypeSchema[typeList.Length];
for (int index = 0; index < typeList.Length; ++index)
{
typeSchemaArray[index] = (TypeSchema)AssemblyLoadResult.MapType(typeList[index]);
if (typeSchemaArray[index] == null)
return (TypeSchema[])null;
}
return typeSchemaArray;
}
internal static object WrapObject(TypeSchema typeSchema, object instance) => AssemblyObjectProxyHelper.WrapObject(typeSchema, instance);
internal static object WrapObject(object instance) => AssemblyObjectProxyHelper.WrapObject((TypeSchema)null, instance);
internal static object UnwrapObject(object instance) => AssemblyObjectProxyHelper.UnwrapObject(instance);
internal static object[] UnwrapObjectList(object[] instanceList)
{
if (instanceList == null)
return (object[])null;
object[] objArray = new object[instanceList.Length];
for (int index = 0; index < objArray.Length; ++index)
objArray[index] = AssemblyLoadResult.UnwrapObject(instanceList[index]);
return objArray;
}
private static void SplitAtLastWhack(
string valueName,
out string leftName,
out string rightName)
{
int length = valueName.LastIndexOf('/');
if (length != -1)
{
leftName = valueName.Substring(0, length);
rightName = valueName.Substring(length + 1);
}
else
{
leftName = valueName;
rightName = (string)null;
}
}
public static Assembly FindAssembly(
AssemblyName name,
out Exception assemblyLoadException)
{
Assembly assembly = (Assembly)null;
assemblyLoadException = (Exception)null;
try
{
assembly = Assembly.Load(name);
}
catch (FileLoadException ex)
{
assemblyLoadException = (Exception)ex;
}
catch (BadImageFormatException ex)
{
assemblyLoadException = (Exception)ex;
}
catch (FileNotFoundException ex)
{
assemblyLoadException = (Exception)ex;
}
return assembly;
}
public override string GetCompilerReferenceName() => base.GetCompilerReferenceName() ?? string.Format("{0}{1}/{2}", (object)"assembly://", (object)this._assembly.GetName().Name, (object)this._namespace);
internal Assembly Assembly => this._assembly;
private AssemblyLoadResult(Assembly assembly, string ns, string uri)
: base(uri)
{
this._assembly = assembly;
this._namespace = ns;
if (ns == null)
return;
this._namespacePrefix = ns + ".";
}
internal struct MapAssemblyKey
{
private Assembly _assembly;
private string _namespace;
public MapAssemblyKey(Assembly assembly, string ns)
{
this._assembly = assembly;
this._namespace = ns;
}
public override bool Equals(object obj)
{
AssemblyLoadResult.MapAssemblyKey mapAssemblyKey = (AssemblyLoadResult.MapAssemblyKey)obj;
return this._assembly == mapAssemblyKey._assembly && this._namespace == mapAssemblyKey._namespace;
}
public override int GetHashCode()
{
int hashCode = this._assembly.GetHashCode();
if (this._namespace != null)
hashCode ^= this._namespace.GetHashCode();
return hashCode;
}
}
}
}
@@ -0,0 +1,74 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyMarkupDataQuery
// 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.Markup
{
internal class AssemblyMarkupDataQuery : MarkupDataQuery
{
private IDataProviderQuery _externalQuery;
public AssemblyMarkupDataQuery(MarkupDataQuerySchema type, AssemblyDataProviderWrapper provider)
: base(type)
{
this._externalQuery = provider.ConstructQuery((object)type);
this._externalQuery.DeclareOwner((object)this);
this._externalQuery.SetInternalObject((MarkupDataQuery)this);
this.ApplyDefaultValues();
}
public override void NotifyInitialized()
{
base.NotifyInitialized();
if (this._externalQuery == null)
return;
this._externalQuery.OnInitialize();
}
protected override void OnDispose()
{
base.OnDispose();
if (this._externalQuery == null)
return;
this._externalQuery.Dispose((object)this);
}
public override void Refresh() => this._externalQuery.Refresh();
public override object Result
{
get => AssemblyLoadResult.WrapObject(this._externalQuery.Result);
set => this._externalQuery.Result = AssemblyLoadResult.UnwrapObject(value);
}
public override DataProviderQueryStatus Status => this._externalQuery.Status;
public override bool Enabled
{
get => this._externalQuery.Enabled;
set => this._externalQuery.Enabled = value;
}
protected override bool ExternalObjectGetProperty(string propertyName, out object value)
{
object property = this._externalQuery.GetProperty(propertyName);
value = AssemblyLoadResult.WrapObject(property);
return true;
}
protected override bool ExternalObjectSetProperty(string propertyName, object value)
{
object obj = AssemblyLoadResult.UnwrapObject(value);
this._externalQuery.SetProperty(propertyName, obj);
return true;
}
protected override IDataProviderBaseObject ExternalAssemblyObject => (IDataProviderBaseObject)this._externalQuery;
public override IntPtr ExternalNativeObject => IntPtr.Zero;
}
}
@@ -0,0 +1,37 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyMarkupDataType
// 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.Markup
{
internal class AssemblyMarkupDataType : MarkupDataType
{
private IDataProviderObject _externalObject;
public AssemblyMarkupDataType(MarkupDataTypeSchema type, IDataProviderObject externalObject)
: base(type)
=> this._externalObject = externalObject;
protected override bool ExternalObjectGetProperty(string propertyName, out object value)
{
object property = this._externalObject.GetProperty(propertyName);
value = AssemblyLoadResult.WrapObject(property);
return true;
}
protected override bool ExternalObjectSetProperty(string propertyName, object value)
{
object obj = AssemblyLoadResult.UnwrapObject(value);
this._externalObject.SetProperty(propertyName, obj);
return true;
}
protected override IDataProviderBaseObject ExternalAssemblyObject => (IDataProviderBaseObject)this._externalObject;
public override IntPtr ExternalNativeObject => IntPtr.Zero;
}
}
@@ -0,0 +1,46 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyMethodSchema
// 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.Reflection;
namespace Microsoft.Iris.Markup
{
internal class AssemblyMethodSchema : MethodSchema
{
private MethodInfo _methodInfo;
private TypeSchema[] _parameterTypes;
private TypeSchema _returnTypeSchema;
private FastReflectionInvokeHandler _method;
public AssemblyMethodSchema(
AssemblyTypeSchema owner,
MethodInfo methodInfo,
TypeSchema[] parameterTypes)
: base((TypeSchema)owner)
{
this._methodInfo = methodInfo;
this._parameterTypes = parameterTypes;
this._returnTypeSchema = (TypeSchema)AssemblyLoadResult.MapType(this._methodInfo.ReturnType);
}
public override string Name => this._methodInfo.Name;
public override TypeSchema[] ParameterTypes => this._parameterTypes;
public override TypeSchema ReturnType => this._returnTypeSchema;
public override bool IsStatic => this._methodInfo.IsStatic;
public override object Invoke(object instance, object[] parameters)
{
object target = AssemblyLoadResult.UnwrapObject(instance);
object[] paramters = AssemblyLoadResult.UnwrapObjectList(parameters);
if (this._method == null)
this._method = ReflectionHelper.CreateMethodInvoke((MethodBase)this._methodInfo);
return AssemblyLoadResult.WrapObject(this._returnTypeSchema, this._method(target, paramters));
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,77 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyPropertySchema
// 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.Reflection;
namespace Microsoft.Iris.Markup
{
internal class AssemblyPropertySchema : PropertySchema
{
private PropertyInfo _propertyInfo;
private TypeSchema _propertyTypeSchema;
private bool _isStatic;
private FastReflectionInvokeHandler _getMethod;
private FastReflectionInvokeHandler _setMethod;
private object[] _setMethodParams;
public AssemblyPropertySchema(AssemblyTypeSchema owner, PropertyInfo propertyInfo)
: base((TypeSchema)owner)
{
this._propertyInfo = propertyInfo;
this._propertyTypeSchema = (TypeSchema)AssemblyLoadResult.MapType(this._propertyInfo.PropertyType);
this._isStatic = (this._propertyInfo.GetGetMethod() ?? this._propertyInfo.GetSetMethod()).IsStatic;
}
public override string Name => this._propertyInfo.Name;
public override TypeSchema PropertyType => this._propertyTypeSchema;
public override TypeSchema AlternateType => (TypeSchema)null;
public override bool CanRead => this._propertyInfo.CanRead;
public override bool CanWrite => this._propertyInfo.CanWrite;
public override bool IsStatic => this._isStatic;
public override ExpressionRestriction ExpressionRestriction => ExpressionRestriction.None;
public override bool RequiredForCreation => false;
public override RangeValidator RangeValidator => (RangeValidator)null;
public override bool NotifiesOnChange
{
get
{
AssemblyTypeSchema owner = (AssemblyTypeSchema)this.Owner;
return !this._isStatic && owner.NotifiesOnChange;
}
}
public override object GetValue(object instance)
{
object target = AssemblyLoadResult.UnwrapObject(instance);
if (this._getMethod == null)
this._getMethod = ReflectionHelper.CreateMethodInvoke((MethodBase)this._propertyInfo.GetGetMethod());
return AssemblyLoadResult.WrapObject(this._propertyTypeSchema, this._getMethod(target, (object[])null));
}
public override void SetValue(ref object instance, object value)
{
object target = AssemblyLoadResult.UnwrapObject(instance);
object obj1 = AssemblyLoadResult.UnwrapObject(value);
if (this._setMethod == null)
{
this._setMethod = ReflectionHelper.CreateMethodInvoke((MethodBase)this._propertyInfo.GetSetMethod());
this._setMethodParams = new object[1];
}
this._setMethodParams[0] = obj1;
object obj2 = this._setMethod(target, this._setMethodParams);
this._setMethodParams[0] = (object)null;
}
}
}
@@ -0,0 +1,340 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.AssemblyTypeSchema
// 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.UIX;
using System;
using System.ComponentModel;
using System.Reflection;
namespace Microsoft.Iris.Markup
{
internal class AssemblyTypeSchema : TypeSchema
{
private Type _type;
private TypeSchema _baseType;
private bool _isDisposable;
private bool _notifiesOnChange;
private bool _isFrameworkEnum;
private Map<MethodSignatureKey, ConstructorSchema> _constructorCache = new Map<MethodSignatureKey, ConstructorSchema>();
private Map<string, PropertySchema> _propertyCache = new Map<string, PropertySchema>();
private Map<MethodSignatureKey, MethodSchema> _methodCache = new Map<MethodSignatureKey, MethodSchema>();
private Map<string, EventSchema> _eventCache = new Map<string, EventSchema>();
private Map<Type, ConstructorInfo[]> s_constructorInfosCache = new Map<Type, ConstructorInfo[]>();
private Map<Type, MethodInfo[]> s_methodInfosCache = new Map<Type, MethodInfo[]>();
protected AssemblyTypeSchema(Type type, TypeSchema baseType)
: base((LoadResult)AssemblyLoadResult.MapAssembly(type.Assembly, type.Namespace))
{
this._type = type;
this._baseType = baseType;
this._isFrameworkEnum = type.IsEnum && Enum.GetUnderlyingType(type) == typeof(int);
this._notifiesOnChange = typeof(INotifyPropertyChanged).IsAssignableFrom(this._type);
this._isDisposable = typeof(IDisposable).IsAssignableFrom(this._type);
}
protected override void OnDispose()
{
base.OnDispose();
foreach (KeyValueEntry<MethodSignatureKey, ConstructorSchema> keyValueEntry in this._constructorCache)
keyValueEntry.Value.Dispose((object)this);
foreach (KeyValueEntry<string, PropertySchema> keyValueEntry in this._propertyCache)
keyValueEntry.Value.Dispose((object)this);
foreach (KeyValueEntry<MethodSignatureKey, MethodSchema> keyValueEntry in this._methodCache)
keyValueEntry.Value.Dispose((object)this);
foreach (KeyValueEntry<string, EventSchema> keyValueEntry in this._eventCache)
keyValueEntry.Value.Dispose((object)this);
}
public override string Name
{
get
{
string str = this._type.Name;
if (this._type.IsGenericType)
str = this._type.ToString().Substring(((AssemblyLoadResult)this.Owner).Namespace.Length + 1);
return str;
}
}
public override string AlternateName => (string)null;
public override TypeSchema Base
{
get
{
if (this._baseType == null && this != AssemblyLoadResult.ObjectTypeSchema)
{
if (this._type.BaseType != null)
this._baseType = (TypeSchema)AssemblyLoadResult.MapType(this._type.BaseType);
else if (this._type.IsInterface)
this._baseType = AssemblyLoadResult.ObjectTypeSchema;
}
return this._baseType;
}
}
public override bool Contractual => this._type.IsInterface;
public override Type RuntimeType => this._type;
public Type InternalType => this._type;
public override bool IsNativeAssignableFrom(object check) => this.InternalType.IsAssignableFrom(AssemblyLoadResult.UnwrapObject(check).GetType());
public override bool IsNativeAssignableFrom(TypeSchema checkSchema)
{
Type c = checkSchema.RuntimeType;
if (checkSchema is AssemblyTypeSchema assemblyTypeSchema)
c = assemblyTypeSchema.InternalType;
return this.InternalType.IsAssignableFrom(c);
}
public override bool Disposable => this._isDisposable;
public override object ConstructDefault() => AssemblyLoadResult.WrapObject((TypeSchema)this, Activator.CreateInstance(this._type));
public override bool HasDefaultConstructor => this._type.IsValueType || this._type.GetConstructor(Type.EmptyTypes) != null;
public override bool HasInitializer => false;
public override void InitializeInstance(ref object instance)
{
}
public override ConstructorSchema FindConstructor(TypeSchema[] parameters)
{
ConstructorSchema constructorSchema;
if (!this._constructorCache.TryGetValue(new MethodSignatureKey(parameters), out constructorSchema))
{
ConstructorInfo[] constructors;
if (!this.s_constructorInfosCache.TryGetValue(this._type, out constructors))
{
constructors = this._type.GetConstructors(BindingFlags.Instance | BindingFlags.Public);
this.s_constructorInfosCache[this._type] = constructors;
}
if (constructors != null)
{
foreach (ConstructorInfo constructorInfo in constructors)
{
TypeSchema[] schemaParameters = (TypeSchema[])null;
if (this.CheckForMethodSignatureMatch((MethodBase)constructorInfo, (string)null, parameters, out schemaParameters))
{
constructorSchema = (ConstructorSchema)new AssemblyConstructorSchema(this, constructorInfo, schemaParameters);
this._constructorCache[new MethodSignatureKey(schemaParameters)] = constructorSchema;
break;
}
}
}
}
return constructorSchema;
}
public override PropertySchema FindProperty(string name)
{
PropertySchema propertySchema;
if (!this._propertyCache.TryGetValue(name, out propertySchema))
{
PropertyInfo propertyHelper = AssemblyTypeSchema.GetPropertyHelper(this._type, name);
if (propertyHelper != null)
{
propertySchema = (PropertySchema)new AssemblyPropertySchema(this, propertyHelper);
this._propertyCache[name] = propertySchema;
}
}
return propertySchema;
}
private static PropertyInfo GetPropertyHelper(Type type, string name)
{
PropertyInfo propertyInfo = (PropertyInfo)null;
try
{
propertyInfo = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
}
catch (AmbiguousMatchException ex)
{
PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
for (int index = 0; index < properties.Length; ++index)
{
if (properties[index].Name == name)
{
propertyInfo = properties[index];
break;
}
}
}
if (propertyInfo == null && type.IsInterface)
{
foreach (Type type1 in type.GetInterfaces())
{
propertyInfo = AssemblyTypeSchema.GetPropertyHelper(type1, name);
if (propertyInfo != null)
break;
}
}
return propertyInfo;
}
public override MethodSchema FindMethod(string name, TypeSchema[] parameters)
{
MethodSchema methodSchema;
if (!this._methodCache.TryGetValue(new MethodSignatureKey(name, parameters), out methodSchema))
{
MethodInfo[] methodInfoArray = (MethodInfo[])null;
if (!this.s_methodInfosCache.TryGetValue(this._type, out methodInfoArray))
{
methodInfoArray = this._type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
this.s_methodInfosCache[this._type] = methodInfoArray;
}
if (methodInfoArray != null)
{
foreach (MethodInfo methodInfo in methodInfoArray)
{
TypeSchema[] schemaParameters;
if (this.CheckForMethodSignatureMatch((MethodBase)methodInfo, name, parameters, out schemaParameters))
{
methodSchema = (MethodSchema)new AssemblyMethodSchema(this, methodInfo, schemaParameters);
this._methodCache[new MethodSignatureKey(name, schemaParameters)] = methodSchema;
break;
}
}
}
}
return methodSchema;
}
private bool CheckForMethodSignatureMatch(
MethodBase candidateMember,
string name,
TypeSchema[] parameters,
out TypeSchema[] schemaParameters)
{
schemaParameters = (TypeSchema[])null;
if (name != null && candidateMember.Name != name)
return false;
ParameterInfo[] parameters1 = candidateMember.GetParameters();
if (parameters1.Length != parameters.Length)
return false;
TypeSchema[] typeSchemaArray = new TypeSchema[parameters1.Length];
for (int index = 0; index < parameters.Length; ++index)
{
typeSchemaArray[index] = (TypeSchema)AssemblyLoadResult.MapType(parameters1[index].ParameterType);
if (!typeSchemaArray[index].IsAssignableFrom(parameters[index]))
return false;
}
schemaParameters = typeSchemaArray;
return true;
}
public override EventSchema FindEvent(string name)
{
EventSchema eventSchema;
if (!this._eventCache.TryGetValue(name, out eventSchema))
{
EventInfo eventInfo = this._type.GetEvent(name);
if (eventInfo != null)
{
eventSchema = (EventSchema)new AssemblyEventSchema(this, eventInfo);
this._eventCache[name] = eventSchema;
}
}
return eventSchema;
}
public override object FindCanonicalInstance(string name)
{
if (this._type.IsEnum)
{
try
{
return Enum.Parse(this._type, name);
}
catch (ArgumentException ex)
{
}
}
return (object)null;
}
public override PropertySchema[] Properties => PropertySchema.EmptyList;
public override Result TypeConverter(
object from,
TypeSchema fromType,
out object instance)
{
if (this._isFrameworkEnum && Int32Schema.Type.IsAssignableFrom(fromType))
{
instance = Enum.ToObject(this._type, (int)from);
return Result.Success;
}
instance = (object)null;
return Result.Fail("Unimplemented");
}
public override bool SupportsTypeConversion(TypeSchema fromType) => this._isFrameworkEnum && Int32Schema.Type.IsAssignableFrom(fromType);
public override void EncodeBinary(ByteCodeWriter writer, object instance)
{
if (this._type.IsEnum)
{
writer.WriteInt32((int)instance);
}
else
{
if (this._type != typeof(Guid))
return;
writer.Write(((Guid)instance).ToByteArray(), 16U);
}
}
public override object DecodeBinary(ByteCodeReader reader)
{
object obj;
if (this._type.IsEnum)
obj = Enum.ToObject(this._type, reader.ReadInt32());
else if (this._type == typeof(Guid))
{
byte[] b = new byte[16];
for (int index = 0; index < 16; ++index)
b[index] = reader.ReadByte();
obj = (object)new Guid(b);
}
else
obj = (object)null;
return obj;
}
public override bool SupportsBinaryEncoding
{
get
{
if (this._type == typeof(Guid))
return true;
return this._type.IsEnum && Enum.GetUnderlyingType(this._type) == typeof(int);
}
}
public override object PerformOperation(object left, object right, OperationType op)
{
bool flag = left != null ? left.Equals(right) : right == null || right.Equals(left);
return BooleanBoxes.Box(op == OperationType.RelationalEquals ? flag : !flag);
}
public override bool SupportsOperation(OperationType op) => op == OperationType.RelationalEquals || op == OperationType.RelationalNotEquals;
public override bool IsNullAssignable => !this._type.IsValueType;
public override int FindTypeHint => -1;
public bool NotifiesOnChange => this._notifiesOnChange;
public override bool IsRuntimeImmutable => this._type.IsEnum;
public override bool IsEnum => this._isFrameworkEnum;
}
}
+16
View File
@@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.BooleanBoxes
// 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.Markup
{
internal static class BooleanBoxes
{
internal static object TrueBox = (object)true;
internal static object FalseBox = (object)false;
internal static object Box(bool value) => value ? BooleanBoxes.TrueBox : BooleanBoxes.FalseBox;
}
}
+142
View File
@@ -0,0 +1,142 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.ByteCodeReader
// 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.OS;
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Markup
{
internal class ByteCodeReader : DisposableObject
{
private static char[] s_scratchCharArray = new char[100];
private BinaryReader _reader;
private IntPtr _buffer;
private byte[] _bytes;
private bool _inFixedMemory;
public unsafe ByteCodeReader(IntPtr buffer, long size, bool ownsAllocation)
{
byte[] bytes = new byte[size];
Marshal.Copy(buffer, bytes, 0, (int)size);
_bytes = bytes;
this._reader = new BinaryReader(new MemoryStream(_bytes));
_buffer = buffer;
}
public byte[] Bytes => _bytes;
public uint Size => (uint)_reader.BaseStream.Length;
public uint CurrentOffset
{
get => (uint)_reader.BaseStream.Position;
set => _reader.BaseStream.Seek(value <= Size ? value : throw new Exception("Invalid offset"), SeekOrigin.Begin);
}
public unsafe IntPtr CurrentAddress => new IntPtr(_buffer.ToInt64() + _reader.BaseStream.Position);
public bool IsInFixedMemory => this._inFixedMemory;
public void MarkAsInFixedMemory() => this._inFixedMemory = true;
public bool ReadBool() => _reader.ReadBoolean();
public unsafe byte ReadByte() => _reader.ReadByte();
public char ReadChar() => _reader.ReadChar();
public unsafe ushort ReadUInt16() => _reader.ReadUInt16();
public int ReadInt32() => _reader.ReadInt32();
public unsafe uint ReadUInt32() => _reader.ReadUInt32();
public static unsafe ushort ReadUInt16(IntPtr pData)
{
var reader = new ByteCodeReader(pData, sizeof(ushort), false);
return reader.ReadUInt16();
}
public static unsafe uint ReadUInt32(IntPtr pData)
{
var reader = new ByteCodeReader(pData, sizeof(uint), false);
return reader.ReadUInt32();
}
public long ReadInt64() => _reader.ReadInt64();
public unsafe ulong ReadUInt64() => _reader.ReadUInt64();
public unsafe float ReadSingle() => _reader.ReadSingle();
public unsafe double ReadDouble() => _reader.ReadDouble();
public unsafe string ReadString()
{
uint num1 = (uint)this.ReadUInt16();
if (num1 == (uint)ushort.MaxValue)
return (string)null;
bool flag;
uint num2;
if (((int)num1 & 32768) != 0)
{
flag = true;
num1 &= (uint)short.MaxValue;
num2 = num1;
}
else
{
flag = false;
num2 = num1 * 2U;
}
if (this.CurrentOffset + num2 > this.Size)
this.ThrowReadError();
char[] chArray = (long)num1 >= (long)ByteCodeReader.s_scratchCharArray.Length ? new char[num1] : ByteCodeReader.s_scratchCharArray;
byte* numPtr1 = (byte*)(_buffer.ToInt32() + (int)CurrentOffset);
if (flag)
{
for (int index = 0; (long)index < (long)num1; ++index)
chArray[index] = (char)*numPtr1++;
}
else
{
for (int index = 0; (long)index < (long)num1; ++index)
{
byte* numPtr2 = numPtr1;
byte* numPtr3 = numPtr2 + 1;
byte num3 = *numPtr2;
byte* numPtr4 = numPtr3;
numPtr1 = numPtr4 + 1;
byte num4 = *numPtr4;
chArray[index] = (char)((uint)num3 | (uint)num4 << 8);
}
}
_reader.BaseStream.Seek(num2, SeekOrigin.Current);
return new string(chArray, 0, (int)num1);
}
public unsafe IntPtr ToIntPtr(out long size)
{
size = Size;
return _buffer;
}
public unsafe IntPtr GetAddress(uint offset) => new IntPtr(_buffer.ToInt64() + offset);
private void ThrowReadError() => throw new Exception("Attempted to read past the end of the buffer.");
protected override unsafe void OnDispose()
{
base.OnDispose();
_reader.Close();
_buffer = IntPtr.Zero;
}
}
}
+227
View File
@@ -0,0 +1,227 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.ByteCodeWriter
// 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.OS;
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Markup
{
internal class ByteCodeWriter
{
private const int BLOCK_SIZE = 4096;
private byte[] _scratch = new byte[8];
private uint _cbFreeInBlock;
private uint _totalSize;
private byte[] _currentBlock;
private ArrayList _blockList = new ArrayList();
public uint DataSize => this._totalSize;
public void WriteByte(byte value)
{
this._scratch[0] = value;
this.Write(this._scratch, 1U);
}
public void WriteByte(OpCode value)
{
this._scratch[0] = (byte)value;
this.Write(this._scratch, 1U);
}
public void WriteBool(bool value)
{
this._scratch[0] = value ? (byte)1 : (byte)0;
this.Write(this._scratch, 1U);
}
public void WriteChar(char value)
{
this._scratch[0] = (byte)value;
this._scratch[1] = (byte)((uint)value >> 8);
this.Write(this._scratch, 2U);
}
public void WriteUInt16(ushort value)
{
this._scratch[0] = (byte)value;
this._scratch[1] = (byte)((uint)value >> 8);
this.Write(this._scratch, 2U);
}
public void WriteUInt16(int rawValue)
{
ushort num = (ushort)rawValue;
this._scratch[0] = (byte)num;
this._scratch[1] = (byte)((uint)num >> 8);
this.Write(this._scratch, 2U);
}
public void WriteUInt16(uint rawValue)
{
ushort num = (ushort)rawValue;
this._scratch[0] = (byte)num;
this._scratch[1] = (byte)((uint)num >> 8);
this.Write(this._scratch, 2U);
}
public void WriteInt32(int value)
{
this._scratch[0] = (byte)value;
this._scratch[1] = (byte)(value >> 8);
this._scratch[2] = (byte)(value >> 16);
this._scratch[3] = (byte)(value >> 24);
this.Write(this._scratch, 4U);
}
public void WriteUInt32(uint value)
{
this._scratch[0] = (byte)value;
this._scratch[1] = (byte)(value >> 8);
this._scratch[2] = (byte)(value >> 16);
this._scratch[3] = (byte)(value >> 24);
this.Write(this._scratch, 4U);
}
public void WriteInt64(long value) => this.WriteUInt64((ulong)value);
public void WriteUInt64(ulong value)
{
this._scratch[0] = (byte)value;
this._scratch[1] = (byte)(value >> 8);
this._scratch[2] = (byte)(value >> 16);
this._scratch[3] = (byte)(value >> 24);
this._scratch[4] = (byte)(value >> 32);
this._scratch[5] = (byte)(value >> 40);
this._scratch[6] = (byte)(value >> 48);
this._scratch[7] = (byte)(value >> 56);
this.Write(this._scratch, 8U);
}
public unsafe void WriteSingle(float value)
{
uint num = *(uint*)&value;
this._scratch[0] = (byte)num;
this._scratch[1] = (byte)(num >> 8);
this._scratch[2] = (byte)(num >> 16);
this._scratch[3] = (byte)(num >> 24);
this.Write(this._scratch, 4U);
}
public unsafe void WriteDouble(double value) => this.WriteInt64(*(long*)&value);
public void WriteString(string value)
{
if (value == null)
{
this.WriteUInt16(ushort.MaxValue);
}
else
{
if (value.Length >= (int)short.MaxValue)
throw new ArgumentException("String too long");
bool flag = false;
foreach (char ch in value)
{
if (ch > 'ÿ')
{
flag = true;
break;
}
}
uint length = (uint)value.Length;
if (!flag)
length |= 32768U;
this.WriteUInt16((ushort)length);
foreach (char ch in value)
{
if (flag)
this.WriteChar(ch);
else
this.WriteByte((byte)ch);
}
}
}
public void Write(ByteCodeReader value) => this.Write(value, 0U);
public unsafe void Write(ByteCodeReader value, uint offset)
{
IntPtr intPtr = value.ToIntPtr(out long size);
if (offset > size)
throw new ArgumentOutOfRangeException(nameof(offset));
this.Write(new IntPtr(intPtr.ToInt64() + offset), (uint)(size - offset));
}
public unsafe void Write(byte[] buffer, uint count)
{
fixed (byte* pbData = buffer)
this.Write(pbData, count);
}
public unsafe void Write(IntPtr buffer, uint count) => this.Write((byte*)buffer.ToPointer(), count);
private unsafe void Write(byte* pbData, uint cbData)
{
while (cbData > 0U)
{
if (this._cbFreeInBlock == 0U)
{
this._currentBlock = new byte[4096];
this._blockList.Add((object)this._currentBlock);
this._cbFreeInBlock = 4096U;
}
uint num1 = cbData <= this._cbFreeInBlock ? cbData : this._cbFreeInBlock;
uint num2 = 4096U - this._cbFreeInBlock;
Marshal.Copy(new IntPtr((void*)pbData), this._currentBlock, (int)num2, (int)num1);
pbData += (int)num1;
cbData -= num1;
this._cbFreeInBlock -= num1;
this._totalSize += num1;
}
}
public void Overwrite(uint offset, uint value)
{
if (offset + 4U > this._totalSize)
throw new ArgumentException("Invalid offset");
this.OverwriteByte(offset, (byte)value);
this.OverwriteByte(offset + 1U, (byte)(value >> 8));
this.OverwriteByte(offset + 2U, (byte)(value >> 16));
this.OverwriteByte(offset + 3U, (byte)(value >> 24));
}
private void OverwriteByte(uint offset, byte value) => ((byte[])this._blockList[(int)(offset / 4096U)])[(offset % 4096U)] = value;
private unsafe byte* ComposeFinalBuffer(out uint totalSize)
{
byte* pointer = (byte*)NativeApi.MemAlloc(this._totalSize, false).ToPointer();
byte* numPtr = pointer;
for (int index = 0; index < this._blockList.Count - 1; ++index)
{
Marshal.Copy((byte[])this._blockList[index], 0, new IntPtr((void*)numPtr), 4096);
numPtr += 4096;
}
uint num = 4096U - this._cbFreeInBlock;
if (this._currentBlock != null && num != 0U)
Marshal.Copy(this._currentBlock, 0, new IntPtr((void*)numPtr), (int)num);
totalSize = this._totalSize;
this._blockList.Clear();
this._currentBlock = (byte[])null;
this._cbFreeInBlock = 0U;
this._totalSize = 0U;
return pointer;
}
public unsafe ByteCodeReader CreateReader()
{
uint totalSize;
return new ByteCodeReader(new IntPtr((void*)this.ComposeFinalBuffer(out totalSize)), totalSize, true);
}
}
}
@@ -0,0 +1,25 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.ClassMethodSchema
// 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.Markup
{
internal class ClassMethodSchema : MarkupMethodSchema
{
public ClassMethodSchema(
ClassTypeSchema owner,
string name,
TypeSchema returnType,
TypeSchema[] parameterTypes,
string[] parameterNames)
: base((MarkupTypeSchema)owner, name, returnType, parameterTypes, parameterNames)
{
}
protected override IMarkupTypeBase GetMarkupTypeBase(object instance) => instance == null ? (IMarkupTypeBase)((ClassTypeSchema)this.Owner).SharedInstance : (IMarkupTypeBase)instance;
public override bool IsStatic => ((ClassTypeSchema)this.Owner).IsShared;
}
}
@@ -0,0 +1,32 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.ClassPropertySchema
// 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.UI;
namespace Microsoft.Iris.Markup
{
internal class ClassPropertySchema : MarkupPropertySchema
{
public ClassPropertySchema(MarkupTypeSchema owner, string name, TypeSchema propertyType)
: base(owner, name, propertyType)
{
}
public override bool IsStatic => ((ClassTypeSchema)this.Owner).IsShared;
public override object GetValue(object instance)
{
ClassTypeSchema owner = (ClassTypeSchema)this.Owner;
return (instance == null ? owner.SharedInstance : (Class)instance).GetProperty(this.Name);
}
public override void SetValue(ref object instance, object value)
{
ClassTypeSchema owner = (ClassTypeSchema)this.Owner;
(instance == null ? owner.SharedInstance : (Class)instance).SetProperty(this.Name, value);
}
}
}
@@ -0,0 +1,68 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.ClassTypeSchema
// 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.UIX;
using Microsoft.Iris.UI;
using System;
namespace Microsoft.Iris.Markup
{
internal class ClassTypeSchema : MarkupTypeSchema
{
private bool _isShared;
private Class _sharedInstance;
public ClassTypeSchema(MarkupLoadResult owner, string name)
: base(owner, name)
{
}
protected override void OnDispose()
{
base.OnDispose();
if (this._sharedInstance == null)
return;
this._sharedInstance.Dispose((object)this);
this._sharedInstance = (Class)null;
}
public override MarkupType MarkupType => MarkupType.Class;
protected override TypeSchema DefaultBase => (TypeSchema)ObjectSchema.Type;
public override Type RuntimeType => typeof(Class);
public override object ConstructDefault() => this._isShared ? (object)this.SharedInstance : (object)this.ConstructNewInstance();
public override void InitializeInstance(ref object instance) => this.InitializeInstance((IMarkupTypeBase)instance);
public override bool HasInitializer => !this._isShared;
public override bool Disposable => !this._isShared && base.Disposable;
public bool IsShared => this._isShared;
public void MarkShareable() => this._isShared = true;
public Class SharedInstance
{
get
{
if (!this._isShared)
return (Class)null;
if (this._sharedInstance == null)
{
this._sharedInstance = this.ConstructNewInstance();
this._sharedInstance.DeclareOwner((object)this);
this.InitializeInstance((IMarkupTypeBase)this._sharedInstance);
}
return this._sharedInstance;
}
}
protected virtual Class ConstructNewInstance() => new Class((MarkupTypeSchema)this);
}
}
@@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.CodeListeners
// 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.Markup
{
internal class CodeListeners : Listeners
{
public CodeListeners(Vector<Listener> listeners)
: base(listeners)
{
}
}
}
@@ -0,0 +1,22 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.CompilationMessage
// 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.Markup
{
internal static class CompilationMessage
{
public const string CanOnlyCompileMarkupResources = "'{0}' is not markup, it cannot be compiled";
public const string RemoteResourceTargetsUnsupported = "'{0}' cannot be compiled since it is not local (it is remote and requires download)";
public const string UnableToOpenFileForWrite = "'{0}' cannot be opened for writing";
public const string ImportDependencyFailure = "Import of '{0}' failed";
public const string ImportMemberFailure = "Import of {0} named '{1}' from '{2}' failed";
public const string ImportVirtualMethodFailure = "Import of virtual method with index {0} from '{1}' failed";
public const string UnableToOpenOutputFile = "Unable to open output file '{0}'. Error code {1}";
public const string UnableToSaveToOutputFile = "An error occurred while saving data to output file '{0}'. Error code {1}";
public const string MultipleImportNames = "Multiple names '{0}' and '{1}' used to refer to the same entity. The first name will be used for all references to this item within compiled UIB files";
public const string InvalidInputFileName = "'{0}' is not a valid filename";
}
}
@@ -0,0 +1,71 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.CompiledMarkupLoadResult
// 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.Session;
using System;
namespace Microsoft.Iris.Markup
{
internal class CompiledMarkupLoadResult : MarkupLoadResult
{
private Resource _resource;
private CompiledMarkupLoader _loader;
private IntPtr _addressOfLineNumberData;
public CompiledMarkupLoadResult(Resource resource, string uri)
: base(uri)
{
this._resource = resource;
if (uri != resource.Uri)
this._uriUnderlying = resource.Uri;
this._loader = CompiledMarkupLoader.Load(this, resource);
}
public override bool IsSource => false;
public override MarkupConstantsTable ConstantsTable => this._binaryDataTable.ConstantsTable;
public override MarkupImportTables ImportTables => this._binaryDataTable.ImportTables;
public void SetAddressOfLineNumberData(IntPtr address) => this._addressOfLineNumberData = address;
public override MarkupLineNumberTable LineNumberTable
{
get
{
if (this._lineNumberTable == null)
this._lineNumberTable = CompiledMarkupLoader.DecodeLineNumberTable(this._addressOfLineNumberData);
return this._lineNumberTable;
}
}
public override void Load(LoadPass currentPass)
{
if (this._loader == null)
return;
ErrorManager.EnterContext((object)this.ErrorContextUri);
this._loader.Depersist(currentPass);
ErrorManager.ExitContext();
if (currentPass != LoadPass.Done)
return;
this.LoadComplete();
}
private void LoadComplete()
{
if (this._resource != null)
{
this._resource.Free();
this._resource = (Resource)null;
}
this._loader = (CompiledMarkupLoader)null;
if (this.Status != LoadResultStatus.Loading)
return;
this.SetStatus(LoadResultStatus.Success);
}
}
}
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More