Removed unnecessary casts

This commit is contained in:
Joshua Askharoun
2021-03-31 17:15:06 -05:00
parent f7d5fa4120
commit 9b09412b45
587 changed files with 7864 additions and 7862 deletions
@@ -18,7 +18,7 @@ namespace Microsoft.Iris.Markup
AssemblyTypeSchema owner,
ConstructorInfo constructorInfo,
TypeSchema[] parameterTypes)
: base((TypeSchema)owner)
: base(owner)
{
this._constructorInfo = constructorInfo;
this._parameterTypes = parameterTypes;
@@ -31,9 +31,9 @@ namespace Microsoft.Iris.Markup
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);
this._constructor = ReflectionHelper.CreateMethodInvoke(_constructorInfo);
object instance = this._constructor(null, paramters);
return AssemblyLoadResult.WrapObject(owner, instance);
}
}
}
@@ -13,7 +13,7 @@ namespace Microsoft.Iris.Markup
private EventInfo _eventInfo;
public AssemblyEventSchema(AssemblyTypeSchema owner, EventInfo eventInfo)
: base((TypeSchema)owner)
: base(owner)
=> this._eventInfo = eventInfo;
public override string Name => this._eventInfo.Name;
+79 -79
View File
@@ -35,17 +35,17 @@ namespace Microsoft.Iris.Markup
private static LoadResult Create(string uri)
{
LoadResult loadResult = (LoadResult)null;
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;
ErrorManager.ReportError("Invalid assembly reference '{0}'. URI must contain a forward slash after the assembly name", uri);
return null;
}
string leftName;
string rightName;
AssemblyLoadResult.SplitAtLastWhack(valueName, out leftName, out rightName);
AssemblyName name = (AssemblyName)null;
AssemblyName name = null;
try
{
name = new AssemblyName(leftName);
@@ -66,9 +66,9 @@ namespace Microsoft.Iris.Markup
Exception assemblyLoadException;
Assembly assembly = AssemblyLoadResult.FindAssembly(name, out assemblyLoadException);
if (assembly != null)
loadResult = (LoadResult)AssemblyLoadResult.MapAssembly(assembly, rightName);
loadResult = AssemblyLoadResult.MapAssembly(assembly, rightName);
else if (assemblyLoadException != null)
ErrorManager.ReportError("Failure loading assembly: '{0}'", (object)assemblyLoadException.Message);
ErrorManager.ReportError("Failure loading assembly: '{0}'", assemblyLoadException.Message);
else
ErrorManager.ReportError("Failure loading assembly");
}
@@ -82,87 +82,87 @@ namespace Microsoft.Iris.Markup
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);
AssemblyLoadResult.ObjectTypeSchema = primitiveTypeSchema = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(ObjectSchema.Type);
TypeSchema typeA1 = primitiveTypeSchema;
typeCache1[type1] = primitiveTypeSchema;
TypeSchema.RegisterTwoWayEquivalence(typeA1, ObjectSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(void)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(VoidSchema.Type)), VoidSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(bool)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(BooleanSchema.Type)), BooleanSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(byte)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(ByteSchema.Type)), ByteSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(char)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(CharSchema.Type)), CharSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(double)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(DoubleSchema.Type)), DoubleSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(string)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(StringSchema.Type)), StringSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(float)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(SingleSchema.Type)), SingleSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(int)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(Int32Schema.Type)), Int32Schema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(long)] = new FrameworkCompatibleAssemblyPrimitiveTypeSchema(Int64Schema.Type)), 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);
AssemblyLoadResult.ListTypeSchema = assemblyTypeSchema1 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IList), typeof(IList), typeof(ArrayList));
TypeSchema typeA2 = assemblyTypeSchema1;
typeCache2[type2] = assemblyTypeSchema1;
TypeSchema.RegisterTwoWayEquivalence(typeA2, 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);
AssemblyLoadResult.EnumeratorTypeSchema = assemblyTypeSchema2 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IEnumerator), typeof(IEnumerator));
TypeSchema typeA3 = assemblyTypeSchema2;
typeCache3[type3] = assemblyTypeSchema2;
TypeSchema.RegisterTwoWayEquivalence(typeA3, 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);
AssemblyLoadResult.DictionaryTypeSchema = assemblyTypeSchema3 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IDictionary), AssemblyObjectProxyHelper.ProxyDictionaryType, typeof(Dictionary<object, object>));
TypeSchema producer1 = assemblyTypeSchema3;
typeCache4[type4] = assemblyTypeSchema3;
TypeSchema.RegisterOneWayEquivalence(producer1, 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);
AssemblyLoadResult.CommandTypeSchema = assemblyTypeSchema4 = new FrameworkCompatibleAssemblyTypeSchema(typeof(ICommand), AssemblyObjectProxyHelper.ProxyCommandType);
TypeSchema producer2 = assemblyTypeSchema4;
typeCache5[type5] = assemblyTypeSchema4;
TypeSchema.RegisterOneWayEquivalence(producer2, 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);
AssemblyLoadResult.ValueRangeTypeSchema = assemblyTypeSchema5 = new FrameworkCompatibleAssemblyTypeSchema(typeof(IValueRange), AssemblyObjectProxyHelper.ProxyValueRangeType);
TypeSchema producer3 = assemblyTypeSchema5;
typeCache6[type6] = assemblyTypeSchema5;
TypeSchema.RegisterOneWayEquivalence(producer3, ValueRangeSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(Group)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(Group), typeof(IUIGroup))), GroupSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(Image)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(Image), typeof(UIImage))), ImageSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(Type)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(Type), typeof(TypeSchema), null, AssemblyLoadResult.ObjectTypeSchema)), TypeSchemaDefinition.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(VideoStream)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(VideoStream))), 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);
AssemblyLoadResult.s_typeCache[typeof(Microsoft.Iris.Choice)] = (FrameworkCompatibleAssemblyTypeSchema)(producer4 = new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.Choice)));
TypeSchema.RegisterOneWayEquivalence(producer4, ChoiceSchema.Type);
TypeSchema.RegisterOneWayEquivalence(producer4, ValueRangeSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(Microsoft.Iris.BooleanChoice)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.BooleanChoice))), 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);
AssemblyLoadResult.s_typeCache[typeof(Microsoft.Iris.RangedValue)] = (FrameworkCompatibleAssemblyTypeSchema)(producer5 = new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.RangedValue)));
TypeSchema.RegisterOneWayEquivalence(producer5, RangedValueSchema.Type);
TypeSchema.RegisterOneWayEquivalence(producer5, ValueRangeSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(Microsoft.Iris.IntRangedValue)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.IntRangedValue))), IntRangedValueSchema.Type);
TypeSchema.RegisterOneWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(Microsoft.Iris.ByteRangedValue)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(Microsoft.Iris.ByteRangedValue))), ByteRangedValueSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(DataProviderQuery)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(DataProviderQuery), typeof(MarkupDataQuery))), MarkupDataQueryInstanceSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(DataProviderObject)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(DataProviderObject), typeof(MarkupDataType))), MarkupDataTypeInstanceSchema.Type);
TypeSchema.RegisterTwoWayEquivalence((TypeSchema)(AssemblyLoadResult.s_typeCache[typeof(DataProviderQueryStatus)] = new FrameworkCompatibleAssemblyTypeSchema(typeof(DataProviderQueryStatus))), UIXLoadResultExports.DataQueryStatusType);
}
public static void Shutdown()
{
foreach (SharedDisposableObject disposableObject in AssemblyLoadResult.s_assemblyCache.Values)
disposableObject.UnregisterUsage((object)AssemblyLoadResult.s_assemblyCache);
disposableObject.UnregisterUsage(s_assemblyCache);
AssemblyLoadResult.s_assemblyCache.Clear();
AssemblyLoadResult.s_assemblyCache = (Map<AssemblyLoadResult.MapAssemblyKey, AssemblyLoadResult>)null;
AssemblyLoadResult.s_assemblyCache = null;
foreach (AssemblyTypeSchema assemblyTypeSchema in AssemblyLoadResult.s_typeCache.Values)
{
AssemblyLoadResult owner = (AssemblyLoadResult)assemblyTypeSchema.Owner;
assemblyTypeSchema.Dispose((object)owner);
assemblyTypeSchema.Dispose(owner);
}
AssemblyLoadResult.s_typeCache.Clear();
AssemblyLoadResult.s_typeCache = (Map)null;
AssemblyLoadResult.s_typeCache = null;
}
public string Namespace => this._namespace;
@@ -173,11 +173,11 @@ namespace Microsoft.Iris.Markup
{
Type type = this._assembly.GetType(this._namespacePrefix + name, false);
if (type == null)
return (TypeSchema)null;
return 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;
return AssemblyLoadResult.MapType(type);
ErrorManager.ReportError("Type '{0}' is not public in '{1}'", name, _assembly);
return null;
}
public static AssemblyLoadResult MapAssembly(Assembly assembly, string ns)
@@ -191,7 +191,7 @@ namespace Microsoft.Iris.Markup
uri = uri + "/" + ns;
assemblyLoadResult = new AssemblyLoadResult(assembly, ns, uri);
AssemblyLoadResult.s_assemblyCache[key] = assemblyLoadResult;
assemblyLoadResult.RegisterUsage((object)AssemblyLoadResult.s_assemblyCache);
assemblyLoadResult.RegisterUsage(s_assemblyCache);
}
return assemblyLoadResult;
}
@@ -200,14 +200,14 @@ namespace Microsoft.Iris.Markup
{
object obj;
AssemblyTypeSchema assemblyTypeSchema;
if (AssemblyLoadResult.s_typeCache.TryGetValue((object)type, out obj))
if (AssemblyLoadResult.s_typeCache.TryGetValue(type, out obj))
{
assemblyTypeSchema = (AssemblyTypeSchema)obj;
}
else
{
assemblyTypeSchema = AssemblyObjectProxyHelper.CreateProxySchema(type);
AssemblyLoadResult.s_typeCache[(object)type] = (object)assemblyTypeSchema;
AssemblyLoadResult.s_typeCache[type] = assemblyTypeSchema;
}
return assemblyTypeSchema;
}
@@ -227,7 +227,7 @@ namespace Microsoft.Iris.Markup
}
}
}
return (Type)null;
return null;
}
internal static Type[] MapTypeList(TypeSchema[] typeSchemaList)
@@ -237,7 +237,7 @@ namespace Microsoft.Iris.Markup
{
typeArray[index] = AssemblyLoadResult.MapType(typeSchemaList[index]);
if (typeArray[index] == null)
return (Type[])null;
return null;
}
return typeArray;
}
@@ -247,23 +247,23 @@ namespace Microsoft.Iris.Markup
TypeSchema[] typeSchemaArray = new TypeSchema[typeList.Length];
for (int index = 0; index < typeList.Length; ++index)
{
typeSchemaArray[index] = (TypeSchema)AssemblyLoadResult.MapType(typeList[index]);
typeSchemaArray[index] = AssemblyLoadResult.MapType(typeList[index]);
if (typeSchemaArray[index] == null)
return (TypeSchema[])null;
return 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 WrapObject(object instance) => AssemblyObjectProxyHelper.WrapObject(null, instance);
internal static object UnwrapObject(object instance) => AssemblyObjectProxyHelper.UnwrapObject(instance);
internal static object[] UnwrapObjectList(object[] instanceList)
{
if (instanceList == null)
return (object[])null;
return null;
object[] objArray = new object[instanceList.Length];
for (int index = 0; index < objArray.Length; ++index)
objArray[index] = AssemblyLoadResult.UnwrapObject(instanceList[index]);
@@ -284,7 +284,7 @@ namespace Microsoft.Iris.Markup
else
{
leftName = valueName;
rightName = (string)null;
rightName = null;
}
}
@@ -292,28 +292,28 @@ namespace Microsoft.Iris.Markup
AssemblyName name,
out Exception assemblyLoadException)
{
Assembly assembly = (Assembly)null;
assemblyLoadException = (Exception)null;
Assembly assembly = null;
assemblyLoadException = null;
try
{
assembly = Assembly.Load(name);
}
catch (FileLoadException ex)
{
assemblyLoadException = (Exception)ex;
assemblyLoadException = ex;
}
catch (BadImageFormatException ex)
{
assemblyLoadException = (Exception)ex;
assemblyLoadException = ex;
}
catch (FileNotFoundException ex)
{
assemblyLoadException = (Exception)ex;
assemblyLoadException = ex;
}
return assembly;
}
public override string GetCompilerReferenceName() => base.GetCompilerReferenceName() ?? string.Format("{0}{1}/{2}", (object)"assembly://", (object)this._assembly.GetName().Name, (object)this._namespace);
public override string GetCompilerReferenceName() => base.GetCompilerReferenceName() ?? string.Format("{0}{1}/{2}", "assembly://", _assembly.GetName().Name, _namespace);
internal Assembly Assembly => this._assembly;
@@ -15,9 +15,9 @@ namespace Microsoft.Iris.Markup
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._externalQuery = provider.ConstructQuery(type);
this._externalQuery.DeclareOwner(this);
this._externalQuery.SetInternalObject(this);
this.ApplyDefaultValues();
}
@@ -34,7 +34,7 @@ namespace Microsoft.Iris.Markup
base.OnDispose();
if (this._externalQuery == null)
return;
this._externalQuery.Dispose((object)this);
this._externalQuery.Dispose(this);
}
public override void Refresh() => this._externalQuery.Refresh();
@@ -67,7 +67,7 @@ namespace Microsoft.Iris.Markup
return true;
}
protected override IDataProviderBaseObject ExternalAssemblyObject => (IDataProviderBaseObject)this._externalQuery;
protected override IDataProviderBaseObject ExternalAssemblyObject => _externalQuery;
public override IntPtr ExternalNativeObject => IntPtr.Zero;
}
@@ -30,7 +30,7 @@ namespace Microsoft.Iris.Markup
return true;
}
protected override IDataProviderBaseObject ExternalAssemblyObject => (IDataProviderBaseObject)this._externalObject;
protected override IDataProviderBaseObject ExternalAssemblyObject => _externalObject;
public override IntPtr ExternalNativeObject => IntPtr.Zero;
}
@@ -19,11 +19,11 @@ namespace Microsoft.Iris.Markup
AssemblyTypeSchema owner,
MethodInfo methodInfo,
TypeSchema[] parameterTypes)
: base((TypeSchema)owner)
: base(owner)
{
this._methodInfo = methodInfo;
this._parameterTypes = parameterTypes;
this._returnTypeSchema = (TypeSchema)AssemblyLoadResult.MapType(this._methodInfo.ReturnType);
this._returnTypeSchema = AssemblyLoadResult.MapType(this._methodInfo.ReturnType);
}
public override string Name => this._methodInfo.Name;
@@ -39,7 +39,7 @@ namespace Microsoft.Iris.Markup
object target = AssemblyLoadResult.UnwrapObject(instance);
object[] paramters = AssemblyLoadResult.UnwrapObjectList(parameters);
if (this._method == null)
this._method = ReflectionHelper.CreateMethodInvoke((MethodBase)this._methodInfo);
this._method = ReflectionHelper.CreateMethodInvoke(_methodInfo);
return AssemblyLoadResult.WrapObject(this._returnTypeSchema, this._method(target, paramters));
}
}
@@ -26,13 +26,13 @@ namespace Microsoft.Iris.Markup
AssemblyObjectProxyHelper.s_typeofString = typeof(string);
AssemblyObjectProxyHelper.s_proxyTypeInfoTable = new AssemblyObjectProxyHelper.ProxyTypeInfo[7]
{
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (ICommand), typeof (AssemblyObjectProxyHelper.ProxyCommand), (TypeSchema) CommandSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IValueRange), typeof (AssemblyObjectProxyHelper.ProxyValueRange), (TypeSchema) ValueRangeSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IList), typeof (AssemblyObjectProxyHelper.ProxyList), (TypeSchema) ListSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IDictionary), typeof (AssemblyObjectProxyHelper.ProxyDictionary), (TypeSchema) DictionarySchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IEnumerator), typeof (AssemblyObjectProxyHelper.ProxyListEnumerator), (TypeSchema) EnumeratorSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IDisposable), typeof (AssemblyObjectProxyHelper.ProxyObject), (TypeSchema) null),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (INotifyPropertyChanged), typeof (AssemblyObjectProxyHelper.ProxyObject), (TypeSchema) null)
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (ICommand), typeof (AssemblyObjectProxyHelper.ProxyCommand), CommandSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IValueRange), typeof (AssemblyObjectProxyHelper.ProxyValueRange), ValueRangeSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IList), typeof (AssemblyObjectProxyHelper.ProxyList), ListSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IDictionary), typeof (AssemblyObjectProxyHelper.ProxyDictionary), DictionarySchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IEnumerator), typeof (AssemblyObjectProxyHelper.ProxyListEnumerator), EnumeratorSchema.Type),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (IDisposable), typeof (AssemblyObjectProxyHelper.ProxyObject), null),
new AssemblyObjectProxyHelper.ProxyTypeInfo(typeof (INotifyPropertyChanged), typeof (AssemblyObjectProxyHelper.ProxyObject), null)
};
}
@@ -42,13 +42,13 @@ namespace Microsoft.Iris.Markup
{
if (proxyTypeInfo.type.IsAssignableFrom(assemblyType))
{
AssemblyTypeSchema assemblyTypeSchema = (AssemblyTypeSchema)new FrameworkCompatibleAssemblyTypeSchema(assemblyType, proxyTypeInfo.proxyType);
AssemblyTypeSchema assemblyTypeSchema = new FrameworkCompatibleAssemblyTypeSchema(assemblyType, proxyTypeInfo.proxyType);
if (proxyTypeInfo.equivalents != null)
assemblyTypeSchema.ShareEquivalents(proxyTypeInfo.equivalents);
return assemblyTypeSchema;
}
}
return (AssemblyTypeSchema)new StandardAssemblyTypeSchema(assemblyType);
return new StandardAssemblyTypeSchema(assemblyType);
}
internal static Type ProxyListType => typeof(AssemblyObjectProxyHelper.ProxyList);
@@ -62,32 +62,32 @@ namespace Microsoft.Iris.Markup
internal static object WrapObject(TypeSchema typeSchema, object instance)
{
if (instance == null)
return (object)null;
return null;
if (instance.GetType().IsPrimitive)
return instance;
switch (instance)
{
case Type type:
return (object)AssemblyLoadResult.MapType(type);
return AssemblyLoadResult.MapType(type);
case AssemblyObjectProxyHelper.IFrameworkProxyObject frameworkProxyObject:
return frameworkProxyObject.FrameworkObject;
default:
AssemblyObjectProxyHelper.ProxyObject proxyObject = (AssemblyObjectProxyHelper.ProxyObject)null;
AssemblyObjectProxyHelper.ProxyObject proxyObject = null;
bool isDisposable = instance is IDisposable;
bool notifiesOnChange = instance is INotifyPropertyChanged;
switch (instance)
{
case ICommand _:
proxyObject = (AssemblyObjectProxyHelper.ProxyObject)new AssemblyObjectProxyHelper.ProxyCommand(instance);
proxyObject = new AssemblyObjectProxyHelper.ProxyCommand(instance);
break;
case IValueRange _:
proxyObject = (AssemblyObjectProxyHelper.ProxyObject)new AssemblyObjectProxyHelper.ProxyValueRange(instance);
proxyObject = new AssemblyObjectProxyHelper.ProxyValueRange(instance);
break;
case IDictionary _:
proxyObject = (AssemblyObjectProxyHelper.ProxyObject)new AssemblyObjectProxyHelper.ProxyDictionary(instance);
proxyObject = new AssemblyObjectProxyHelper.ProxyDictionary(instance);
break;
case IList _:
proxyObject = !(instance is Group) ? (!(instance is IVirtualList) ? (!(instance is INotifyList) ? (AssemblyObjectProxyHelper.ProxyObject)new AssemblyObjectProxyHelper.ProxyList(instance) : (AssemblyObjectProxyHelper.ProxyObject)new AssemblyObjectProxyHelper.ProxyNotifyList(instance)) : (AssemblyObjectProxyHelper.ProxyObject)new AssemblyObjectProxyHelper.ProxyVirtualNotifyList(instance, instance is INotifyList)) : (AssemblyObjectProxyHelper.ProxyObject)new AssemblyObjectProxyHelper.ProxyGroup(instance, instance is INotifyList);
proxyObject = !(instance is Group) ? (!(instance is IVirtualList) ? (!(instance is INotifyList) ? new AssemblyObjectProxyHelper.ProxyList(instance) : new AssemblyObjectProxyHelper.ProxyNotifyList(instance)) : new AssemblyObjectProxyHelper.ProxyVirtualNotifyList(instance, instance is INotifyList)) : new AssemblyObjectProxyHelper.ProxyGroup(instance, instance is INotifyList);
break;
default:
if (isDisposable || notifiesOnChange)
@@ -100,14 +100,14 @@ namespace Microsoft.Iris.Markup
if (proxyObject == null)
return instance;
proxyObject.SetIntrinsicState(isDisposable, notifiesOnChange);
return (object)proxyObject;
return proxyObject;
}
}
internal static object UnwrapObject(object instance)
{
if (instance == null)
return (object)null;
return null;
Type type = instance.GetType();
if (type.IsPrimitive || type == AssemblyObjectProxyHelper.s_typeofString)
return instance;
@@ -116,10 +116,10 @@ namespace Microsoft.Iris.Markup
case AssemblyObjectProxyHelper.IAssemblyProxyObject assemblyProxyObject:
return assemblyProxyObject.AssemblyObject;
case IList uixList:
return (object)new AssemblyObjectProxyHelper.ReverseProxyList(uixList);
return new AssemblyObjectProxyHelper.ReverseProxyList(uixList);
case IDictionary _:
case IDisposable _:
return (object)new AssemblyObjectProxyHelper.WrappedFrameworkObject(instance);
return new AssemblyObjectProxyHelper.WrappedFrameworkObject(instance);
default:
return instance;
}
@@ -135,7 +135,7 @@ namespace Microsoft.Iris.Markup
{
this.type = type;
this.proxyType = proxyType;
this.equivalents = (Vector<TypeSchema>)null;
this.equivalents = null;
if (equivalence == null)
return;
this.equivalents = new Vector<TypeSchema>(1);
@@ -197,7 +197,7 @@ namespace Microsoft.Iris.Markup
base.OnOwnerDeclared(owner);
if (!(this._assemblyObject is ModelItem assemblyObject))
return;
assemblyObject.Owner = (IModelItemOwner)this;
assemblyObject.Owner = this;
}
public void AddListener(Listener listener)
@@ -235,7 +235,7 @@ namespace Microsoft.Iris.Markup
public object AssemblyObject => this._assemblyObject;
public TypeSchema TypeSchema => (TypeSchema)AssemblyLoadResult.MapType(this._assemblyObject.GetType());
public TypeSchema TypeSchema => AssemblyLoadResult.MapType(this._assemblyObject.GetType());
public override bool Equals(object rhs)
{
@@ -364,7 +364,7 @@ namespace Microsoft.Iris.Markup
public object SyncRoot => this.ExternalList.SyncRoot;
public IEnumerator GetEnumerator() => (IEnumerator)new AssemblyObjectProxyHelper.ProxyListEnumerator((object)this.ExternalList.GetEnumerator());
public IEnumerator GetEnumerator() => new AssemblyObjectProxyHelper.ProxyListEnumerator(this.ExternalList.GetEnumerator());
public bool CanSearch => this._canSearch;
@@ -390,7 +390,7 @@ namespace Microsoft.Iris.Markup
public object Current => AssemblyLoadResult.WrapObject(this._assemblyEnumerator.Current);
public object AssemblyObject => (object)this._assemblyEnumerator;
public object AssemblyObject => _assemblyEnumerator;
}
private class ProxyNotifyList :
@@ -428,21 +428,21 @@ namespace Microsoft.Iris.Markup
this._listContentsChangedHandler = new UIListContentsChangedHandler(this.OnListContentsChanged);
this.ExternalNotifyList.ContentsChanged += this._listContentsChangedHandler;
}
this._handlersAttachedToMe = Delegate.Combine(this._handlersAttachedToMe, (Delegate)value);
this._handlersAttachedToMe = Delegate.Combine(this._handlersAttachedToMe, value);
}
remove
{
if (!this._isNotifyList)
return;
this._handlersAttachedToMe = Delegate.Remove(this._handlersAttachedToMe, (Delegate)value);
this._handlersAttachedToMe = Delegate.Remove(this._handlersAttachedToMe, value);
if ((object)this._handlersAttachedToMe != null)
return;
this.ExternalNotifyList.ContentsChanged -= this._listContentsChangedHandler;
this._listContentsChangedHandler = (UIListContentsChangedHandler)null;
this._listContentsChangedHandler = null;
}
}
private void OnListContentsChanged(IList senderList, UIListContentsChangedArgs args) => ((UIListContentsChangedHandler)this._handlersAttachedToMe)((IList)this, args);
private void OnListContentsChanged(IList senderList, UIListContentsChangedArgs args) => ((UIListContentsChangedHandler)this._handlersAttachedToMe)(this, args);
}
private class ProxyVirtualNotifyList :
@@ -467,7 +467,7 @@ namespace Microsoft.Iris.Markup
{
if (this._itemCallbacks == null)
this._itemCallbacks = new Dictionary<object, object>();
this._itemCallbacks[(object)index] = (object)callback;
this._itemCallbacks[index] = callback;
if (this._onItemGeneratedCallback == null)
this._onItemGeneratedCallback = new ItemRequestCallback(this.OnItemGenerated);
this.ExternalVirtualList.RequestItem(index, this._onItemGeneratedCallback);
@@ -497,9 +497,9 @@ namespace Microsoft.Iris.Markup
private void OnItemGenerated(object sender, int index, object item)
{
ItemRequestCallback itemCallback = (ItemRequestCallback)this._itemCallbacks[(object)index];
this._itemCallbacks.Remove((object)index);
itemCallback((object)this, index, AssemblyLoadResult.WrapObject(item));
ItemRequestCallback itemCallback = (ItemRequestCallback)this._itemCallbacks[index];
this._itemCallbacks.Remove(index);
itemCallback(this, index, AssemblyLoadResult.WrapObject(item));
}
}
@@ -584,7 +584,7 @@ namespace Microsoft.Iris.Markup
public ReverseProxyList(IList uixList) => this._uixList = uixList;
public object FrameworkObject => (object)this._uixList;
public object FrameworkObject => _uixList;
public int Add(object value) => this._uixList.Add(AssemblyLoadResult.WrapObject(value));
@@ -626,7 +626,7 @@ namespace Microsoft.Iris.Markup
public object SyncRoot => this._uixList.SyncRoot;
public IEnumerator GetEnumerator() => (IEnumerator)new AssemblyObjectProxyHelper.ReverseProxyListEnumerator(this._uixList.GetEnumerator());
public IEnumerator GetEnumerator() => new AssemblyObjectProxyHelper.ReverseProxyListEnumerator(this._uixList.GetEnumerator());
}
private class ReverseProxyListEnumerator :
@@ -643,7 +643,7 @@ namespace Microsoft.Iris.Markup
public object Current => AssemblyLoadResult.UnwrapObject(this._uixEnumerator.Current);
public object FrameworkObject => (object)this._uixEnumerator;
public object FrameworkObject => _uixEnumerator;
}
}
}
@@ -18,10 +18,10 @@ namespace Microsoft.Iris.Markup
private object[] _setMethodParams;
public AssemblyPropertySchema(AssemblyTypeSchema owner, PropertyInfo propertyInfo)
: base((TypeSchema)owner)
: base(owner)
{
this._propertyInfo = propertyInfo;
this._propertyTypeSchema = (TypeSchema)AssemblyLoadResult.MapType(this._propertyInfo.PropertyType);
this._propertyTypeSchema = AssemblyLoadResult.MapType(this._propertyInfo.PropertyType);
this._isStatic = (this._propertyInfo.GetGetMethod() ?? this._propertyInfo.GetSetMethod()).IsStatic;
}
@@ -56,8 +56,8 @@ namespace Microsoft.Iris.Markup
{
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));
this._getMethod = ReflectionHelper.CreateMethodInvoke(this._propertyInfo.GetGetMethod());
return AssemblyLoadResult.WrapObject(this._propertyTypeSchema, this._getMethod(target, null));
}
public override void SetValue(ref object instance, object value)
@@ -66,12 +66,12 @@ namespace Microsoft.Iris.Markup
object obj1 = AssemblyLoadResult.UnwrapObject(value);
if (this._setMethod == null)
{
this._setMethod = ReflectionHelper.CreateMethodInvoke((MethodBase)this._propertyInfo.GetSetMethod());
this._setMethod = ReflectionHelper.CreateMethodInvoke(this._propertyInfo.GetSetMethod());
this._setMethodParams = new object[1];
}
this._setMethodParams[0] = obj1;
object obj2 = this._setMethod(target, this._setMethodParams);
this._setMethodParams[0] = (object)null;
this._setMethodParams[0] = null;
}
}
}
+22 -22
View File
@@ -27,7 +27,7 @@ namespace Microsoft.Iris.Markup
private Map<Type, MethodInfo[]> s_methodInfosCache = new Map<Type, MethodInfo[]>();
protected AssemblyTypeSchema(Type type, TypeSchema baseType)
: base((LoadResult)AssemblyLoadResult.MapAssembly(type.Assembly, type.Namespace))
: base(AssemblyLoadResult.MapAssembly(type.Assembly, type.Namespace))
{
this._type = type;
this._baseType = baseType;
@@ -40,13 +40,13 @@ namespace Microsoft.Iris.Markup
{
base.OnDispose();
foreach (KeyValueEntry<MethodSignatureKey, ConstructorSchema> keyValueEntry in this._constructorCache)
keyValueEntry.Value.Dispose((object)this);
keyValueEntry.Value.Dispose(this);
foreach (KeyValueEntry<string, PropertySchema> keyValueEntry in this._propertyCache)
keyValueEntry.Value.Dispose((object)this);
keyValueEntry.Value.Dispose(this);
foreach (KeyValueEntry<MethodSignatureKey, MethodSchema> keyValueEntry in this._methodCache)
keyValueEntry.Value.Dispose((object)this);
keyValueEntry.Value.Dispose(this);
foreach (KeyValueEntry<string, EventSchema> keyValueEntry in this._eventCache)
keyValueEntry.Value.Dispose((object)this);
keyValueEntry.Value.Dispose(this);
}
public override string Name
@@ -69,7 +69,7 @@ namespace Microsoft.Iris.Markup
if (this._baseType == null && this != AssemblyLoadResult.ObjectTypeSchema)
{
if (this._type.BaseType != null)
this._baseType = (TypeSchema)AssemblyLoadResult.MapType(this._type.BaseType);
this._baseType = AssemblyLoadResult.MapType(this._type.BaseType);
else if (this._type.IsInterface)
this._baseType = AssemblyLoadResult.ObjectTypeSchema;
}
@@ -95,7 +95,7 @@ namespace Microsoft.Iris.Markup
public override bool Disposable => this._isDisposable;
public override object ConstructDefault() => AssemblyLoadResult.WrapObject((TypeSchema)this, Activator.CreateInstance(this._type));
public override object ConstructDefault() => AssemblyLoadResult.WrapObject(this, Activator.CreateInstance(this._type));
public override bool HasDefaultConstructor => this._type.IsValueType || this._type.GetConstructor(Type.EmptyTypes) != null;
@@ -120,10 +120,10 @@ namespace Microsoft.Iris.Markup
{
foreach (ConstructorInfo constructorInfo in constructors)
{
TypeSchema[] schemaParameters = (TypeSchema[])null;
if (this.CheckForMethodSignatureMatch((MethodBase)constructorInfo, (string)null, parameters, out schemaParameters))
TypeSchema[] schemaParameters = null;
if (this.CheckForMethodSignatureMatch(constructorInfo, null, parameters, out schemaParameters))
{
constructorSchema = (ConstructorSchema)new AssemblyConstructorSchema(this, constructorInfo, schemaParameters);
constructorSchema = new AssemblyConstructorSchema(this, constructorInfo, schemaParameters);
this._constructorCache[new MethodSignatureKey(schemaParameters)] = constructorSchema;
break;
}
@@ -141,7 +141,7 @@ namespace Microsoft.Iris.Markup
PropertyInfo propertyHelper = AssemblyTypeSchema.GetPropertyHelper(this._type, name);
if (propertyHelper != null)
{
propertySchema = (PropertySchema)new AssemblyPropertySchema(this, propertyHelper);
propertySchema = new AssemblyPropertySchema(this, propertyHelper);
this._propertyCache[name] = propertySchema;
}
}
@@ -150,7 +150,7 @@ namespace Microsoft.Iris.Markup
private static PropertyInfo GetPropertyHelper(Type type, string name)
{
PropertyInfo propertyInfo = (PropertyInfo)null;
PropertyInfo propertyInfo = null;
try
{
propertyInfo = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
@@ -184,7 +184,7 @@ namespace Microsoft.Iris.Markup
MethodSchema methodSchema;
if (!this._methodCache.TryGetValue(new MethodSignatureKey(name, parameters), out methodSchema))
{
MethodInfo[] methodInfoArray = (MethodInfo[])null;
MethodInfo[] methodInfoArray = null;
if (!this.s_methodInfosCache.TryGetValue(this._type, out methodInfoArray))
{
methodInfoArray = this._type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
@@ -195,9 +195,9 @@ namespace Microsoft.Iris.Markup
foreach (MethodInfo methodInfo in methodInfoArray)
{
TypeSchema[] schemaParameters;
if (this.CheckForMethodSignatureMatch((MethodBase)methodInfo, name, parameters, out schemaParameters))
if (this.CheckForMethodSignatureMatch(methodInfo, name, parameters, out schemaParameters))
{
methodSchema = (MethodSchema)new AssemblyMethodSchema(this, methodInfo, schemaParameters);
methodSchema = new AssemblyMethodSchema(this, methodInfo, schemaParameters);
this._methodCache[new MethodSignatureKey(name, schemaParameters)] = methodSchema;
break;
}
@@ -213,7 +213,7 @@ namespace Microsoft.Iris.Markup
TypeSchema[] parameters,
out TypeSchema[] schemaParameters)
{
schemaParameters = (TypeSchema[])null;
schemaParameters = null;
if (name != null && candidateMember.Name != name)
return false;
ParameterInfo[] parameters1 = candidateMember.GetParameters();
@@ -222,7 +222,7 @@ namespace Microsoft.Iris.Markup
TypeSchema[] typeSchemaArray = new TypeSchema[parameters1.Length];
for (int index = 0; index < parameters.Length; ++index)
{
typeSchemaArray[index] = (TypeSchema)AssemblyLoadResult.MapType(parameters1[index].ParameterType);
typeSchemaArray[index] = AssemblyLoadResult.MapType(parameters1[index].ParameterType);
if (!typeSchemaArray[index].IsAssignableFrom(parameters[index]))
return false;
}
@@ -238,7 +238,7 @@ namespace Microsoft.Iris.Markup
EventInfo eventInfo = this._type.GetEvent(name);
if (eventInfo != null)
{
eventSchema = (EventSchema)new AssemblyEventSchema(this, eventInfo);
eventSchema = new AssemblyEventSchema(this, eventInfo);
this._eventCache[name] = eventSchema;
}
}
@@ -257,7 +257,7 @@ namespace Microsoft.Iris.Markup
{
}
}
return (object)null;
return null;
}
public override PropertySchema[] Properties => PropertySchema.EmptyList;
@@ -272,7 +272,7 @@ namespace Microsoft.Iris.Markup
instance = Enum.ToObject(this._type, (int)from);
return Result.Success;
}
instance = (object)null;
instance = null;
return Result.Fail("Unimplemented");
}
@@ -302,10 +302,10 @@ namespace Microsoft.Iris.Markup
byte[] b = new byte[16];
for (int index = 0; index < 16; ++index)
b[index] = reader.ReadByte();
obj = (object)new Guid(b);
obj = new Guid(b);
}
else
obj = (object)null;
obj = null;
return obj;
}
+2 -2
View File
@@ -8,8 +8,8 @@ namespace Microsoft.Iris.Markup
{
internal static class BooleanBoxes
{
internal static object TrueBox = (object)true;
internal static object FalseBox = (object)false;
internal static object TrueBox = true;
internal static object FalseBox = false;
internal static object Box(bool value) => value ? BooleanBoxes.TrueBox : BooleanBoxes.FalseBox;
}
+7 -7
View File
@@ -80,9 +80,9 @@ namespace Microsoft.Iris.Markup
public unsafe string ReadString()
{
uint num1 = (uint)this.ReadUInt16();
if (num1 == (uint)ushort.MaxValue)
return (string)null;
uint num1 = this.ReadUInt16();
if (num1 == ushort.MaxValue)
return null;
bool flag;
uint num2;
if (((int)num1 & 32768) != 0)
@@ -98,16 +98,16 @@ namespace Microsoft.Iris.Markup
}
if (this.CurrentOffset + num2 > this.Size)
this.ThrowReadError();
char[] chArray = (long)num1 >= (long)ByteCodeReader.s_scratchCharArray.Length ? new char[num1] : ByteCodeReader.s_scratchCharArray;
char[] chArray = num1 >= 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)
for (int index = 0; index < num1; ++index)
chArray[index] = (char)*numPtr1++;
}
else
{
for (int index = 0; (long)index < (long)num1; ++index)
for (int index = 0; index < num1; ++index)
{
byte* numPtr2 = numPtr1;
byte* numPtr3 = numPtr2 + 1;
@@ -115,7 +115,7 @@ namespace Microsoft.Iris.Markup
byte* numPtr4 = numPtr3;
numPtr1 = numPtr4 + 1;
byte num4 = *numPtr4;
chArray[index] = (char)((uint)num3 | (uint)num4 << 8);
chArray[index] = (char)(num3 | (uint)num4 << 8);
}
}
_reader.BaseStream.Seek(num2, SeekOrigin.Current);
+9 -8
View File
@@ -36,7 +36,8 @@ namespace Microsoft.Iris.Markup
public void WriteBool(bool value)
{
this._scratch[0] = value ? (byte)1 : (byte)0;
this._scratch[0] = 0;
if (value) this._scratch[0] = 1;
this.Write(this._scratch, 1U);
}
@@ -123,7 +124,7 @@ namespace Microsoft.Iris.Markup
}
else
{
if (value.Length >= (int)short.MaxValue)
if (value.Length >= short.MaxValue)
throw new ArgumentException("String too long");
bool flag = false;
foreach (char ch in value)
@@ -173,12 +174,12 @@ namespace Microsoft.Iris.Markup
if (this._cbFreeInBlock == 0U)
{
this._currentBlock = new byte[4096];
this._blockList.Add((object)this._currentBlock);
this._blockList.Add(_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);
Marshal.Copy(new IntPtr(pbData), this._currentBlock, (int)num2, (int)num1);
pbData += (int)num1;
cbData -= num1;
this._cbFreeInBlock -= num1;
@@ -204,15 +205,15 @@ namespace Microsoft.Iris.Markup
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);
Marshal.Copy((byte[])this._blockList[index], 0, new IntPtr(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);
Marshal.Copy(this._currentBlock, 0, new IntPtr(numPtr), (int)num);
totalSize = this._totalSize;
this._blockList.Clear();
this._currentBlock = (byte[])null;
this._currentBlock = null;
this._cbFreeInBlock = 0U;
this._totalSize = 0U;
return pointer;
@@ -221,7 +222,7 @@ namespace Microsoft.Iris.Markup
public unsafe ByteCodeReader CreateReader()
{
uint totalSize;
return new ByteCodeReader(new IntPtr((void*)this.ComposeFinalBuffer(out totalSize)), totalSize, true);
return new ByteCodeReader(new IntPtr(this.ComposeFinalBuffer(out totalSize)), totalSize, true);
}
}
}
@@ -14,11 +14,11 @@ namespace Microsoft.Iris.Markup
TypeSchema returnType,
TypeSchema[] parameterTypes,
string[] parameterNames)
: base((MarkupTypeSchema)owner, name, returnType, parameterTypes, parameterNames)
: base(owner, name, returnType, parameterTypes, parameterNames)
{
}
protected override IMarkupTypeBase GetMarkupTypeBase(object instance) => instance == null ? (IMarkupTypeBase)((ClassTypeSchema)this.Owner).SharedInstance : (IMarkupTypeBase)instance;
protected override IMarkupTypeBase GetMarkupTypeBase(object instance) => instance == null ? ((ClassTypeSchema)Owner).SharedInstance : (IMarkupTypeBase)instance;
public override bool IsStatic => ((ClassTypeSchema)this.Owner).IsShared;
}
+8 -8
View File
@@ -25,17 +25,17 @@ namespace Microsoft.Iris.Markup
base.OnDispose();
if (this._sharedInstance == null)
return;
this._sharedInstance.Dispose((object)this);
this._sharedInstance = (Class)null;
this._sharedInstance.Dispose(this);
this._sharedInstance = null;
}
public override MarkupType MarkupType => MarkupType.Class;
protected override TypeSchema DefaultBase => (TypeSchema)ObjectSchema.Type;
protected override TypeSchema DefaultBase => ObjectSchema.Type;
public override Type RuntimeType => typeof(Class);
public override object ConstructDefault() => this._isShared ? (object)this.SharedInstance : (object)this.ConstructNewInstance();
public override object ConstructDefault() => this._isShared ? SharedInstance : this.ConstructNewInstance();
public override void InitializeInstance(ref object instance) => this.InitializeInstance((IMarkupTypeBase)instance);
@@ -52,17 +52,17 @@ namespace Microsoft.Iris.Markup
get
{
if (!this._isShared)
return (Class)null;
return null;
if (this._sharedInstance == null)
{
this._sharedInstance = this.ConstructNewInstance();
this._sharedInstance.DeclareOwner((object)this);
this.InitializeInstance((IMarkupTypeBase)this._sharedInstance);
this._sharedInstance.DeclareOwner(this);
this.InitializeInstance(_sharedInstance);
}
return this._sharedInstance;
}
}
protected virtual Class ConstructNewInstance() => new Class((MarkupTypeSchema)this);
protected virtual Class ConstructNewInstance() => new Class(this);
}
}
@@ -47,7 +47,7 @@ namespace Microsoft.Iris.Markup
{
if (this._loader == null)
return;
ErrorManager.EnterContext((object)this.ErrorContextUri);
ErrorManager.EnterContext(ErrorContextUri);
this._loader.Depersist(currentPass);
ErrorManager.ExitContext();
if (currentPass != LoadPass.Done)
@@ -60,9 +60,9 @@ namespace Microsoft.Iris.Markup
if (this._resource != null)
{
this._resource.Free();
this._resource = (Resource)null;
this._resource = null;
}
this._loader = (CompiledMarkupLoader)null;
this._loader = null;
if (this.Status != LoadResultStatus.Loading)
return;
this.SetStatus(LoadResultStatus.Success);
@@ -69,7 +69,7 @@ namespace Microsoft.Iris.Markup
{
foreach (MarkupTypeSchema markupTypeSchema in this._loadResultTarget.ExportTable)
markupTypeSchema.Seal();
this._reader = (ByteCodeReader)null;
this._reader = null;
}
foreach (LoadResult dependency in this._loadResultTarget.Dependencies)
{
@@ -148,7 +148,7 @@ namespace Microsoft.Iris.Markup
if (this._binaryDataTable.SharedDependenciesTableWithBinaryDataTable == null)
this._binaryDataTable.SharedDependenciesTableWithBinaryDataTable = new LoadResult[1]
{
(LoadResult) this._binaryDataTableLoadResult
_binaryDataTableLoadResult
};
this._loadResultTarget.SetDependenciesTable(this._binaryDataTable.SharedDependenciesTableWithBinaryDataTable);
this._usingSharedDataTable = true;
@@ -165,8 +165,8 @@ namespace Microsoft.Iris.Markup
if (this._usingSharedDataTable)
return;
ushort num = this._reader.ReadUInt16();
LoadResult[] dependenciesTable = new LoadResult[(int)num];
for (ushort index = 0; (int)index < (int)num; ++index)
LoadResult[] dependenciesTable = new LoadResult[num];
for (ushort index = 0; index < num; ++index)
{
this._reader.ReadBool();
string uri = this.ReadDataTableString();
@@ -176,7 +176,7 @@ namespace Microsoft.Iris.Markup
this.ReportError("Import of '{0}' failed", uri);
return;
}
dependenciesTable[(int)index] = loadResult;
dependenciesTable[index] = loadResult;
}
this._loadResultTarget.SetDependenciesTable(dependenciesTable);
}
@@ -184,19 +184,19 @@ namespace Microsoft.Iris.Markup
private void DepersistTypeExportDeclarations()
{
ushort num1 = this._reader.ReadUInt16();
TypeSchema[] exportTable = new TypeSchema[(int)num1];
for (int index = 0; index < (int)num1; ++index)
TypeSchema[] exportTable = new TypeSchema[num1];
for (int index = 0; index < num1; ++index)
{
string name = this.ReadDataTableString();
MarkupTypeSchema markupTypeSchema = MarkupTypeSchema.Build(this.MarkupTypeToDefinition((MarkupType)this._reader.ReadInt32()), (MarkupLoadResult)this._loadResultTarget, name);
exportTable[index] = (TypeSchema)markupTypeSchema;
MarkupTypeSchema markupTypeSchema = MarkupTypeSchema.Build(this.MarkupTypeToDefinition((MarkupType)this._reader.ReadInt32()), _loadResultTarget, name);
exportTable[index] = markupTypeSchema;
}
this._loadResultTarget.SetExportTable(exportTable);
ushort num2 = this._reader.ReadUInt16();
if (num2 <= (ushort)0)
if (num2 <= 0)
return;
AliasMapping[] aliasTable = new AliasMapping[(int)num2];
for (int index1 = 0; index1 < (int)num2; ++index1)
AliasMapping[] aliasTable = new AliasMapping[num2];
for (int index1 = 0; index1 < num2; ++index1)
{
string alias = this.ReadDataTableString();
ushort index2 = this._reader.ReadUInt16();
@@ -214,10 +214,10 @@ namespace Microsoft.Iris.Markup
MarkupImportTables importTables = new MarkupImportTables();
this._loadResultTarget.BinaryDataTable.SetImportTables(importTables);
ushort num = this._reader.ReadUInt16();
if (num <= (ushort)0)
if (num <= 0)
return;
TypeSchema[] typeSchemaArray = new TypeSchema[(int)num];
for (ushort index = 0; (int)index < (int)num; ++index)
TypeSchema[] typeSchemaArray = new TypeSchema[num];
for (ushort index = 0; index < num; ++index)
{
LoadResult dependent = this.MapIndexToDependent(this._reader.ReadUInt16());
string name = this.ReadDataTableString();
@@ -225,7 +225,7 @@ namespace Microsoft.Iris.Markup
if (type == null)
this.ReportError("Import of {0} named '{1}' from '{2}' failed", "type", name, dependent.Uri);
else
typeSchemaArray[(int)index] = type;
typeSchemaArray[index] = type;
}
importTables.TypeImports = typeSchemaArray;
}
@@ -237,12 +237,12 @@ namespace Microsoft.Iris.Markup
{
MarkupType markupType = markupTypeSchema.MarkupType;
TypeSchema definition = this.MarkupTypeToDefinition(markupType);
uint typeDepth = (uint)this._reader.ReadUInt16();
uint typeDepth = this._reader.ReadUInt16();
markupTypeSchema.SetTypeDepth(typeDepth);
if (typeDepth > 1U)
{
ushort num = this._reader.ReadUInt16();
TypeSchema typeSchema = typeImports[(int)num];
TypeSchema typeSchema = typeImports[num];
markupTypeSchema.SetBaseType((MarkupTypeSchema)typeSchema);
}
uint offset1 = this._reader.ReadUInt32();
@@ -260,7 +260,7 @@ namespace Microsoft.Iris.Markup
if (num1 > 0U)
{
SymbolReference[] symbolTable = new SymbolReference[num1];
for (int index = 0; (long)index < (long)num1; ++index)
for (int index = 0; index < num1; ++index)
{
SymbolReference symbolReference = new SymbolReference(this.ReadDataTableString(), (SymbolOrigin)this._reader.ReadByte());
symbolTable[index] = symbolReference;
@@ -273,10 +273,10 @@ namespace Microsoft.Iris.Markup
if (markupType == MarkupType.UI)
{
ushort num2 = this._reader.ReadUInt16();
if (num2 > (ushort)0)
if (num2 > 0)
{
NamedContentRecord[] namedContentTable = new NamedContentRecord[(int)num2];
for (int index = 0; index < (int)num2; ++index)
NamedContentRecord[] namedContentTable = new NamedContentRecord[num2];
for (int index = 0; index < num2; ++index)
{
string name = this.ReadDataTableString();
uint offset4 = this._reader.ReadUInt32();
@@ -308,27 +308,27 @@ namespace Microsoft.Iris.Markup
}
}
ushort num3 = this._reader.ReadUInt16();
if (num3 > (ushort)0)
if (num3 > 0)
{
PropertySchema[] properties = new PropertySchema[(int)num3];
for (int index1 = 0; index1 < (int)num3; ++index1)
PropertySchema[] properties = new PropertySchema[num3];
for (int index1 = 0; index1 < num3; ++index1)
{
string name = this.ReadDataTableString();
bool requiredForCreation = this._reader.ReadBool();
bool flag = this._reader.ReadBool();
PropertyOverrideCriteriaTypeConstraint criteriaTypeConstraint = (PropertyOverrideCriteriaTypeConstraint)null;
PropertyOverrideCriteriaTypeConstraint criteriaTypeConstraint = null;
if (flag)
{
ushort num2 = this._reader.ReadUInt16();
ushort num4 = this._reader.ReadUInt16();
TypeSchema constraint = typeImports[(int)num2];
criteriaTypeConstraint = new PropertyOverrideCriteriaTypeConstraint(typeImports[(int)num4], constraint);
TypeSchema constraint = typeImports[num2];
criteriaTypeConstraint = new PropertyOverrideCriteriaTypeConstraint(typeImports[num4], constraint);
}
ushort num5 = this._reader.ReadUInt16();
TypeSchema propertyType = typeImports[(int)num5];
TypeSchema propertyType = typeImports[num5];
MarkupPropertySchema markupPropertySchema = MarkupPropertySchema.Build(definition, markupTypeSchema, name, propertyType);
markupPropertySchema.SetRequiredForCreation(requiredForCreation);
markupPropertySchema.SetOverrideCriteria((PropertyOverrideCriteria)criteriaTypeConstraint);
markupPropertySchema.SetOverrideCriteria(criteriaTypeConstraint);
if (markupType == MarkupType.DataType)
{
MarkupDataTypePropertySchema typePropertySchema = (MarkupDataTypePropertySchema)markupPropertySchema;
@@ -346,7 +346,7 @@ namespace Microsoft.Iris.Markup
if (index2 != ushort.MaxValue)
queryPropertySchema.SetUnderlyingCollectionType(this.MapIndexToType(index2));
}
properties[index1] = (PropertySchema)markupPropertySchema;
properties[index1] = markupPropertySchema;
}
markupTypeSchema.SetPropertyList(properties);
}
@@ -367,21 +367,21 @@ namespace Microsoft.Iris.Markup
return;
MarkupImportTables importTables = this._loadResultTarget.ImportTables;
ushort num1 = this._reader.ReadUInt16();
if (num1 > (ushort)0)
if (num1 > 0)
{
ConstructorSchema[] constructorSchemaArray = new ConstructorSchema[(int)num1];
for (int index1 = 0; index1 < (int)num1; ++index1)
ConstructorSchema[] constructorSchemaArray = new ConstructorSchema[num1];
for (int index1 = 0; index1 < num1; ++index1)
{
TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16());
ushort num2 = this._reader.ReadUInt16();
TypeSchema[] parameters = TypeSchema.EmptyList;
if (num2 > (ushort)0)
if (num2 > 0)
{
parameters = this.GetTempParameterArray((int)num2);
for (ushort index2 = 0; (int)index2 < (int)num2; ++index2)
parameters = this.GetTempParameterArray(num2);
for (ushort index2 = 0; index2 < num2; ++index2)
{
ushort index3 = this._reader.ReadUInt16();
parameters[(int)index2] = this.MapIndexToType(index3);
parameters[index2] = this.MapIndexToType(index3);
}
}
ConstructorSchema constructor = type.FindConstructor(parameters);
@@ -393,10 +393,10 @@ namespace Microsoft.Iris.Markup
importTables.ConstructorImports = constructorSchemaArray;
}
ushort num3 = this._reader.ReadUInt16();
if (num3 > (ushort)0)
if (num3 > 0)
{
PropertySchema[] propertySchemaArray = new PropertySchema[(int)num3];
for (int index = 0; index < (int)num3; ++index)
PropertySchema[] propertySchemaArray = new PropertySchema[num3];
for (int index = 0; index < num3; ++index)
{
TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16());
string name = this.ReadDataTableString();
@@ -409,25 +409,25 @@ namespace Microsoft.Iris.Markup
importTables.PropertyImports = propertySchemaArray;
}
ushort num4 = this._reader.ReadUInt16();
if (num4 > (ushort)0)
if (num4 > 0)
{
MethodSchema[] methodSchemaArray = new MethodSchema[(int)num4];
for (int index1 = 0; index1 < (int)num4; ++index1)
MethodSchema[] methodSchemaArray = new MethodSchema[num4];
for (int index1 = 0; index1 < num4; ++index1)
{
MethodSchema methodSchema = (MethodSchema)null;
MethodSchema methodSchema = null;
TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16());
if (!this._reader.ReadBool())
{
string name = this.ReadDataTableString();
ushort num2 = this._reader.ReadUInt16();
TypeSchema[] parameters = TypeSchema.EmptyList;
if (num2 > (ushort)0)
if (num2 > 0)
{
parameters = this.GetTempParameterArray((int)num2);
for (ushort index2 = 0; (int)index2 < (int)num2; ++index2)
parameters = this.GetTempParameterArray(num2);
for (ushort index2 = 0; index2 < num2; ++index2)
{
ushort index3 = this._reader.ReadUInt16();
parameters[(int)index2] = this.MapIndexToType(index3);
parameters[index2] = this.MapIndexToType(index3);
}
}
methodSchema = type.FindMethod(name, parameters);
@@ -443,7 +443,7 @@ namespace Microsoft.Iris.Markup
{
if (virtualMethod.VirtualId == num2)
{
methodSchema = (MethodSchema)virtualMethod;
methodSchema = virtualMethod;
break;
}
}
@@ -456,10 +456,10 @@ namespace Microsoft.Iris.Markup
importTables.MethodImports = methodSchemaArray;
}
ushort num5 = this._reader.ReadUInt16();
if (num5 <= (ushort)0)
if (num5 <= 0)
return;
EventSchema[] eventSchemaArray = new EventSchema[(int)num5];
for (int index = 0; index < (int)num5; ++index)
EventSchema[] eventSchemaArray = new EventSchema[num5];
for (int index = 0; index < num5; ++index)
{
TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16());
string name = this.ReadDataTableString();
@@ -475,24 +475,24 @@ namespace Microsoft.Iris.Markup
private void DepersistDataMappingsTable()
{
ushort num1 = this._reader.ReadUInt16();
if (num1 <= (ushort)0)
if (num1 <= 0)
return;
MarkupDataMapping[] dataMappingsTable = new MarkupDataMapping[(int)num1];
for (int index1 = 0; index1 < (int)num1; ++index1)
MarkupDataMapping[] dataMappingsTable = new MarkupDataMapping[num1];
for (int index1 = 0; index1 < num1; ++index1)
{
MarkupDataMapping markupDataMapping = new MarkupDataMapping((string)null);
MarkupDataMapping markupDataMapping = new MarkupDataMapping(null);
ushort index2 = this._reader.ReadUInt16();
markupDataMapping.TargetType = (MarkupDataTypeSchema)this.MapIndexToType(index2);
markupDataMapping.Provider = this.ReadDataTableString();
ushort num2 = this._reader.ReadUInt16();
markupDataMapping.Mappings = new MarkupDataMappingEntry[(int)num2];
for (int index3 = 0; index3 < (int)num2; ++index3)
markupDataMapping.Mappings = new MarkupDataMappingEntry[num2];
for (int index3 = 0; index3 < num2; ++index3)
{
MarkupDataMappingEntry dataMappingEntry = new MarkupDataMappingEntry();
dataMappingEntry.Source = this.ReadDataTableString();
dataMappingEntry.Target = this.ReadDataTableString();
ushort num3 = this._reader.ReadUInt16();
dataMappingEntry.Property = (MarkupDataTypePropertySchema)this._loadResultTarget.ImportTables.PropertyImports[(int)num3];
dataMappingEntry.Property = (MarkupDataTypePropertySchema)this._loadResultTarget.ImportTables.PropertyImports[num3];
dataMappingEntry.DefaultValue = !this._reader.ReadBool() ? MarkupDataProvider.GetDefaultValueForType(dataMappingEntry.Property.PropertyType) : dataMappingEntry.Property.PropertyType.DecodeBinary(this._reader);
markupDataMapping.Mappings[index3] = dataMappingEntry;
}
@@ -522,13 +522,13 @@ namespace Microsoft.Iris.Markup
if (num2 > 0U)
{
symbolTable = new SymbolRecord[num2];
for (int index = 0; (long)index < (long)num2; ++index)
for (int index = 0; index < num2; ++index)
{
SymbolRecord symbolRecord = new SymbolRecord();
symbolRecord.Name = CompiledMarkupLoader.ReadDataTableString(reader, binaryDataTable);
symbolRecord.SymbolOrigin = (SymbolOrigin)reader.ReadByte();
ushort num3 = reader.ReadUInt16();
symbolRecord.Type = owner.ImportTables.TypeImports[(int)num3];
symbolRecord.Type = owner.ImportTables.TypeImports[num3];
symbolTable[index] = symbolRecord;
}
}
@@ -551,23 +551,23 @@ namespace Microsoft.Iris.Markup
private void DepersistConstantsTable()
{
ushort num = this._reader.ReadUInt16();
if (num <= (ushort)0)
if (num <= 0)
return;
object[] runtimeList = new object[(int)num];
object[] runtimeList = new object[num];
MarkupConstantsTable constantsTable = new MarkupConstantsTable(runtimeList);
if (!this._reader.IsInFixedMemory)
{
this._reader.CurrentOffset += (uint)(((int)num + 1) * 4);
for (int index = 0; index < (int)num; ++index)
this._reader.CurrentOffset += (uint)((num + 1) * 4);
for (int index = 0; index < num; ++index)
{
object obj = CompiledMarkupLoader.DepersistConstant(this._reader, (MarkupLoadResult)this._loadResultTarget);
object obj = CompiledMarkupLoader.DepersistConstant(this._reader, _loadResultTarget);
runtimeList[index] = obj;
}
}
else
{
ByteCodeReader constantsTableReader = new ByteCodeReader(this._reader.CurrentAddress, ByteCodeReader.ReadUInt32(this._reader.GetAddress(this._reader.CurrentOffset + (uint)num * 4U)), false);
constantsTable.SetConstantsTableReader(constantsTableReader, (MarkupLoadResult)this._loadResultTarget);
ByteCodeReader constantsTableReader = new ByteCodeReader(this._reader.CurrentAddress, ByteCodeReader.ReadUInt32(this._reader.GetAddress(this._reader.CurrentOffset + num * 4U)), false);
constantsTable.SetConstantsTableReader(constantsTableReader, _loadResultTarget);
}
this._loadResultTarget.BinaryDataTable.SetConstantsTable(constantsTable);
}
@@ -575,9 +575,9 @@ namespace Microsoft.Iris.Markup
public static object DepersistConstant(ByteCodeReader reader, MarkupLoadResult loadResult)
{
ushort num = reader.ReadUInt16();
TypeSchema typeImport = loadResult.ImportTables.TypeImports[(int)num];
TypeSchema typeImport = loadResult.ImportTables.TypeImports[num];
MarkupConstantPersistMode constantPersistMode = (MarkupConstantPersistMode)reader.ReadByte();
object instance = (object)null;
object instance = null;
switch (constantPersistMode)
{
case MarkupConstantPersistMode.Binary:
@@ -585,7 +585,7 @@ namespace Microsoft.Iris.Markup
break;
case MarkupConstantPersistMode.FromString:
string str = CompiledMarkupLoader.ReadDataTableString(reader, loadResult.BinaryDataTable);
typeImport.TypeConverter((object)str, (TypeSchema)StringSchema.Type, out instance);
typeImport.TypeConverter(str, StringSchema.Type, out instance);
break;
case MarkupConstantPersistMode.Canonical:
string name = CompiledMarkupLoader.ReadDataTableString(reader, loadResult.BinaryDataTable);
@@ -599,15 +599,15 @@ namespace Microsoft.Iris.Markup
ByteCodeReader reader)
{
ushort num = reader.ReadUInt16();
ulong[] runtimeList = new ulong[(int)num];
for (int index = 0; index < (int)num; ++index)
ulong[] runtimeList = new ulong[num];
for (int index = 0; index < num; ++index)
runtimeList[index] = reader.ReadUInt64();
return new MarkupLineNumberTable(runtimeList);
}
public static MarkupLineNumberTable DecodeLineNumberTable(IntPtr address)
{
uint size = (uint)((int)ByteCodeReader.ReadUInt16(address) * 12 + 2);
uint size = (uint)(ByteCodeReader.ReadUInt16(address) * 12 + 2);
return CompiledMarkupLoader.DecodeLineNumberTable(new ByteCodeReader(address, size, false));
}
@@ -648,7 +648,7 @@ namespace Microsoft.Iris.Markup
uint currentOffset = this._reader.CurrentOffset;
this._reader.CurrentOffset = binaryDataTableOffset;
int stringCount = this._reader.ReadInt32();
this._binaryDataTable = new MarkupBinaryDataTable((string)null, stringCount);
this._binaryDataTable = new MarkupBinaryDataTable(null, stringCount);
if (!this._reader.IsInFixedMemory)
{
this._reader.CurrentOffset += (uint)((stringCount + 1) * 4);
@@ -671,19 +671,19 @@ namespace Microsoft.Iris.Markup
switch (index)
{
case 65533:
loadResult = (LoadResult)this._loadResultTarget;
loadResult = _loadResultTarget;
break;
case 65534:
loadResult = (LoadResult)MarkupSystem.UIXGlobal;
loadResult = MarkupSystem.UIXGlobal;
break;
default:
loadResult = this._binaryDataTableLoadResult == null ? this._loadResultTarget.Dependencies[(int)index] : this._binaryDataTableLoadResult.Dependencies[(int)index];
loadResult = this._binaryDataTableLoadResult == null ? this._loadResultTarget.Dependencies[index] : this._binaryDataTableLoadResult.Dependencies[index];
break;
}
return loadResult;
}
private TypeSchema MapIndexToType(ushort index) => this._loadResultTarget.ImportTables.TypeImports[(int)index];
private TypeSchema MapIndexToType(ushort index) => this._loadResultTarget.ImportTables.TypeImports[index];
private string ReadDataTableString() => this._binaryDataTable.GetStringByIndex(this._reader.ReadInt32());
@@ -699,9 +699,9 @@ namespace Microsoft.Iris.Markup
{
uint num = this._reader.ReadUInt32();
if (num <= 0U)
return (uint[])null;
return null;
uint[] numArray = new uint[num];
for (int index = 0; (long)index < (long)num; ++index)
for (int index = 0; index < num; ++index)
numArray[index] = this._reader.ReadUInt32();
return numArray;
}
@@ -710,9 +710,9 @@ namespace Microsoft.Iris.Markup
{
uint num = this._reader.ReadUInt32();
if (num <= 0U)
return (string[])null;
return null;
string[] strArray = new string[num];
for (int index = 0; (long)index < (long)num; ++index)
for (int index = 0; index < num; ++index)
strArray[index] = this.ReadDataTableString();
return strArray;
}
@@ -721,12 +721,12 @@ namespace Microsoft.Iris.Markup
TypeSchema markupTypeDefinition,
MarkupTypeSchema typeExport)
{
MethodSchema[] methodSchemaArray = (MethodSchema[])null;
MethodSchema[] methodSchemaArray = null;
ushort num1 = this._reader.ReadUInt16();
if (num1 > (ushort)0)
if (num1 > 0)
{
methodSchemaArray = new MethodSchema[(int)num1];
for (int index1 = 0; index1 < (int)num1; ++index1)
methodSchemaArray = new MethodSchema[num1];
for (int index1 = 0; index1 < num1; ++index1)
{
string name = this.ReadDataTableString();
TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16());
@@ -735,7 +735,7 @@ namespace Microsoft.Iris.Markup
if (num2 > 0U)
{
parameterTypes = new TypeSchema[num2];
for (int index2 = 0; (long)index2 < (long)num2; ++index2)
for (int index2 = 0; index2 < num2; ++index2)
{
ushort index3 = this._reader.ReadUInt16();
parameterTypes[index2] = this.MapIndexToType(index3);
@@ -748,7 +748,7 @@ namespace Microsoft.Iris.Markup
MarkupMethodSchema markupMethodSchema = MarkupMethodSchema.Build(markupTypeDefinition, typeExport, name, type, parameterTypes, parameterNames, isVirtualThunk);
markupMethodSchema.SetCodeOffset(codeOffset);
markupMethodSchema.SetVirtualId(virtualId);
methodSchemaArray[index1] = (MethodSchema)markupMethodSchema;
methodSchemaArray[index1] = markupMethodSchema;
}
}
return methodSchemaArray;
@@ -759,15 +759,15 @@ namespace Microsoft.Iris.Markup
switch (markupType)
{
case MarkupType.UI:
return (TypeSchema)UISchema.Type;
return UISchema.Type;
case MarkupType.Effect:
return (TypeSchema)EffectSchema.Type;
return EffectSchema.Type;
case MarkupType.DataType:
return (TypeSchema)DataTypeSchema.Type;
return DataTypeSchema.Type;
case MarkupType.DataQuery:
return (TypeSchema)DataQuerySchema.Type;
return DataQuerySchema.Type;
default:
return (TypeSchema)ClassSchema.Type;
return ClassSchema.Type;
}
}
@@ -783,11 +783,11 @@ namespace Microsoft.Iris.Markup
return this._typeSchemaArrays[index];
}
public void ReportError(string error, string param0, string param1, string param2) => this.ReportError(string.Format(error, (object)param0, (object)param1, (object)param2));
public void ReportError(string error, string param0, string param1, string param2) => this.ReportError(string.Format(error, param0, param1, param2));
public void ReportError(string error, string param0, string param1) => this.ReportError(string.Format(error, (object)param0, (object)param1));
public void ReportError(string error, string param0, string param1) => this.ReportError(string.Format(error, param0, param1));
public void ReportError(string error, string param0) => this.ReportError(string.Format(error, (object)param0));
public void ReportError(string error, string param0) => this.ReportError(string.Format(error, param0));
public void ReportError(string error)
{
@@ -16,7 +16,7 @@ namespace Microsoft.Iris.Markup
public ConstructorSchema(TypeSchema owner)
{
this._owner = owner;
this.DeclareOwner((object)owner);
this.DeclareOwner(owner);
}
public TypeSchema Owner => this._owner;
@@ -17,13 +17,13 @@ namespace Microsoft.Iris.Markup
{
this._watch = watch;
this._onNotify = callback;
notifier.AddListener((Listener)this);
notifier.AddListener(this);
}
public override void Dispose()
{
base.Dispose();
this._onNotify = (DelegateListener.OnNotifyCallback)null;
this._onNotify = null;
}
public override void OnNotify()
@@ -40,20 +40,20 @@ namespace Microsoft.Iris.Markup
base.OnDispose();
if (this._effectTemplate == null)
return;
this._effectTemplate.UnregisterUsage((object)this);
this._effectTemplate = (IEffectTemplate)null;
this._effectTemplate.UnregisterUsage(this);
this._effectTemplate = null;
}
protected override TypeSchema DefaultBase => (TypeSchema)EffectInstanceSchema.Type;
protected override TypeSchema DefaultBase => EffectInstanceSchema.Type;
public override Type RuntimeType => typeof(EffectClass);
public string DefaultElementSymbol => this._defaultElementSymbolIndex >= 0 ? this.SymbolReferenceTable[this._defaultElementSymbolIndex].Symbol : (string)null;
public string DefaultElementSymbol => this._defaultElementSymbolIndex >= 0 ? this.SymbolReferenceTable[this._defaultElementSymbolIndex].Symbol : null;
protected override Class ConstructNewInstance()
{
this.EnsureEffectTemplate();
return (Class)new EffectClass((MarkupTypeSchema)this, this._effectTemplate);
return new EffectClass(this, this._effectTemplate);
}
protected override bool RunInitialEvaluates(IMarkupTypeBase scriptHost)
@@ -61,7 +61,7 @@ namespace Microsoft.Iris.Markup
bool flag = true;
if (this._instancePropertyAssignments != null && this._templateIndexBuilt >= 0)
{
ErrorManager.EnterContext((object)this);
ErrorManager.EnterContext(this);
flag = this.RunInitializeScript(scriptHost, this._instancePropertyAssignments[this._templateIndexBuilt]);
ErrorManager.ExitContext();
}
@@ -72,18 +72,18 @@ namespace Microsoft.Iris.Markup
{
if (this._effectTemplate != null)
return;
this._effectTemplate = UISession.Default.RenderSession.CreateEffectTemplate((object)this, this.Name);
ErrorManager.EnterContext((object)this);
Class @class = new Class((MarkupTypeSchema)this);
@class.DeclareOwner((object)this);
this._effectTemplate = UISession.Default.RenderSession.CreateEffectTemplate(this, this.Name);
ErrorManager.EnterContext(this);
Class @class = new Class(this);
@class.DeclareOwner(this);
this._templateIndexBuilt = -1;
for (int index = 0; index < this._techniqueOffsets.Length; ++index)
{
object obj = this.RunAtOffset((IMarkupTypeBase)@class, this._techniqueOffsets[index]);
object obj = this.RunAtOffset(@class, this._techniqueOffsets[index]);
if (obj == Interpreter.ScriptError)
{
if (!ErrorManager.IgnoringErrors)
ErrorManager.ReportWarning("Script runtime failure: Scripting errors have prevented '{0}' from properly initializing and will affect its operation", (object)this.Name);
ErrorManager.ReportWarning("Script runtime failure: Scripting errors have prevented '{0}' from properly initializing and will affect its operation", Name);
}
else
{
@@ -100,7 +100,7 @@ namespace Microsoft.Iris.Markup
}
}
}
@class.Dispose((object)this);
@class.Dispose(this);
ErrorManager.ExitContext();
}
+9 -9
View File
@@ -45,8 +45,8 @@ namespace Microsoft.Iris.Markup
this._nameToValueMap = new Map<string, int>(this._names.Length);
for (int index = 0; index < this._names.Length; ++index)
this._nameToValueMap[this._names[index]] = this._values[index];
this._names = (string[])null;
this._values = (int[])null;
this._names = null;
this._values = null;
}
[Conditional("DEBUG")]
@@ -81,7 +81,7 @@ namespace Microsoft.Iris.Markup
public override string AlternateName => (string)null;
public override TypeSchema Base => (TypeSchema)ObjectSchema.Type;
public override TypeSchema Base => ObjectSchema.Type;
public override bool Contractual => false;
@@ -114,7 +114,7 @@ namespace Microsoft.Iris.Markup
public override object FindCanonicalInstance(string name)
{
int num;
return this.NameToValue(name, out num) ? this.EnumValueToObject(num) : (object)null;
return this.NameToValue(name, out num) ? this.EnumValueToObject(num) : null;
}
public bool NameToValue(string name, out int value) => this.NameToValueMap.TryGetValue(name, out value);
@@ -127,7 +127,7 @@ namespace Microsoft.Iris.Markup
private Result ConvertFromString(string value, out object instance)
{
instance = (object)null;
instance = null;
int num1 = 0;
if (this._isFlags && value.IndexOf(',') >= 0)
{
@@ -135,12 +135,12 @@ namespace Microsoft.Iris.Markup
{
int num2;
if (!this.NameToValue(name, out num2))
return Result.Fail("Unable to convert \"{0}\" to type '{1}'", (object)name, (object)this._name);
return Result.Fail("Unable to convert \"{0}\" to type '{1}'", name, _name);
num1 |= num2;
}
}
else if (!this.NameToValue(value, out num1))
return Result.Fail("Unable to convert \"{0}\" to type '{1}'", (object)value, (object)this._name);
return Result.Fail("Unable to convert \"{0}\" to type '{1}'", value, _name);
instance = this.EnumValueToObject(num1);
return Result.Success;
}
@@ -160,7 +160,7 @@ namespace Microsoft.Iris.Markup
}
else
{
instance = (object)null;
instance = null;
result = Result.Fail("Unsupported");
}
return result;
@@ -184,7 +184,7 @@ namespace Microsoft.Iris.Markup
case OperationType.RelationalNotEquals:
return BooleanBoxes.Box(!flag);
default:
return (object)null;
return null;
}
}

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