public void WriteMethodReference(IMethodReference methodReference) { WriteIndent(); Append("<font color=\"darkgreen\">"); Append("<a href=\"resource://["); Append(methodReference.Resolve().DeclaringType.Assembly.Name); Append(']'); Append(methodReference.Resolve().DeclaringType.Namespace); Append('.'); Append(methodReference.Resolve().DeclaringType.Name); Append("::"); Append(methodReference.Name); Append("\">"); if ((methodReference.Name == ".ctor") || (methodReference.Name == ".cctor")) { Write(methodReference.Resolve().DeclaringType.Name); } else { Write(methodReference.Name); } Append("</a>"); Append("</font>"); }
public void Test() { // Get method body information. MethodInfo mi = typeof(Sample).GetMethod("MethodBodyExample", BindingFlags.Instance | BindingFlags.NonPublic); IMethodReference methodReference = AssemblyManager.FindMethod(mi); IList <IStatement> statements = methodReference.Resolve().Body.Statements; }
public IEnumerable <MethodInfo> GetUsedMethods(object method) { var analyzedMethod = method as IMethodDeclaration; if (analyzedMethod.Body == null) { yield break; } var body = analyzedMethod.Body as IMethodBody; var instructions = body.Instructions.OfType <IInstruction>(); foreach (IInstruction instr in instructions) { IMethodReference mr = instr.Value as IMethodReference; if (mr != null) { IMethodDeclaration def = mr.Resolve(); if (def != null) { yield return(HAL.Converter.Method(def)); } } } yield break; }
public static MethodVisibility GetVisibility(IPropertyReference value) { MethodVisibility result = MethodVisibility.Public; IPropertyDeclaration propertyDeclaration = value.Resolve(); if (propertyDeclaration != null) { IMethodReference setMethod = propertyDeclaration.SetMethod; IMethodDeclaration methodDeclaration = setMethod?.Resolve(); IMethodReference getMethod = propertyDeclaration.GetMethod; IMethodDeclaration methodDeclaration2 = getMethod?.Resolve(); if (methodDeclaration != null && methodDeclaration2 != null) { if (methodDeclaration2.Visibility == methodDeclaration.Visibility) { result = methodDeclaration2.Visibility; } } else if (methodDeclaration != null) { result = methodDeclaration.Visibility; } else if (methodDeclaration2 != null) { result = methodDeclaration2.Visibility; } } return(result); }
public static bool IsVisible(IMethodReference value, IVisibilityConfiguration visibility) { if (IsVisible(value.DeclaringType, visibility)) { switch (value.Resolve().Visibility) { case MethodVisibility.PrivateScope: case MethodVisibility.Private: return(visibility.Private); case MethodVisibility.FamilyAndAssembly: return(visibility.FamilyAndAssembly); case MethodVisibility.Assembly: return(visibility.Assembly); case MethodVisibility.Family: return(visibility.Family); case MethodVisibility.FamilyOrAssembly: return(visibility.FamilyOrAssembly); case MethodVisibility.Public: return(visibility.Public); } throw new NotSupportedException(); } return(false); }
internal void processMethod(IMethodReference mth) { if (mth != null) { IMethodDeclaration decl = mth.Resolve(); if (decl != null) { processMethod(decl); } } }
public static bool IsBaseMethod(IMethodReference value, IMethodReference baseMethod) { bool result; if (value.Name != baseMethod.Name) { result = false; } else { if (value.GenericMethod != null) { value = value.GenericMethod; } if (baseMethod.GenericMethod != null) { baseMethod = baseMethod.GenericMethod; } if (!value.ReturnType.Type.Equals(baseMethod.ReturnType.Type)) { result = false; } else if (value.HasThis != baseMethod.HasThis && value.ExplicitThis != baseMethod.ExplicitThis && value.CallingConvention != baseMethod.CallingConvention) { result = false; } else if (value.Parameters.Count != baseMethod.Parameters.Count) { result = false; } else { for (int i = 0; i < value.Parameters.Count; i++) { if (!value.Parameters[i].ParameterType.Equals(baseMethod.Parameters[i].ParameterType)) { return(false); } } if (value.GenericArguments.Count != baseMethod.GenericArguments.Count) { result = false; } else { IMethodDeclaration methodDeclaration = value.Resolve(); IMethodDeclaration methodDeclaration2 = baseMethod.Resolve(); result = (methodDeclaration != null && methodDeclaration2 != null && methodDeclaration.Virtual && methodDeclaration2.Virtual && IsBaseType(methodDeclaration.DeclaringType, methodDeclaration2.DeclaringType)); } } } return(result); }
private int GetMethodIndex(IMethodReference imr) { int index; if (!IndexOfMethod.TryGetValue(imr, out index)) { index = IndexOfMethod.Count; IndexOfMethod.Add(imr, index); methods.Add(new MethodInfo(imr.Resolve())); MethodGraph.AddNode(); } return(index); }
private static String Decompile(String method) { IMethodReference methodReference = AssemblyManager.FindMethod(typeof(PostIncrementTest).GetMethod(method, BindingFlags.NonPublic | BindingFlags.Static)); Assert.IsNotNull(methodReference); StringBuilder result = new StringBuilder(); foreach (IStatement statement in methodReference.Resolve().Body.Statements) { result.Append(TestUtils.WriteStatement(statement)); } return(result.ToString()); }
private static MethodVisibility __GetPropertyVisibility(IPropertyDeclaration propDecl, out IMethodDeclaration getter, out IMethodDeclaration setter) { IMethodReference getref = propDecl.GetMethod; IMethodReference setref = propDecl.SetMethod; if (getref == null) { getter = null; if (setref == null) { setter = null; return(MethodVisibility.Private); } else { setter = setref.Resolve(); return(setter.Visibility); } } else { getter = getref.Resolve(); if (setref == null) { setter = null; return(getter.Visibility); } else { setter = setref.Resolve(); MethodVisibility max = (MethodVisibility)System.Math.Max((int)getter.Visibility, (int)setter.Visibility); MethodVisibility min = (MethodVisibility)System.Math.Min((int)getter.Visibility, (int)setter.Visibility); return(min == MethodVisibility.Assembly && max == MethodVisibility.Family?MethodVisibility.FamilyOrAssembly:max); } } }
private static String DecompileMethod(String methodName) { MethodInfo netMethodInfo = typeof(MethodBodyTest).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static); if (netMethodInfo == null) { netMethodInfo = typeof(MethodBodyTest).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance); } IMethodReference methodReferece = AssemblyManager.FindMethod(netMethodInfo); CSharpWriter languageWriter = new CSharpWriter(); PlainTextWriter formattedCodeWriter = new PlainTextWriter(); languageWriter.WriteMethodDeclaration(methodReferece.Resolve(), formattedCodeWriter); return(formattedCodeWriter.ToString()); }
public static bool IsVisible(IMethodReference value, IVisibilityConfiguration visibility) { bool result; if (IsVisible(value.DeclaringType, visibility)) { IMethodDeclaration methodDeclaration = value.Resolve(); switch (methodDeclaration.Visibility) { case MethodVisibility.PrivateScope: case MethodVisibility.Private: result = visibility.Private; break; case MethodVisibility.FamilyAndAssembly: result = visibility.FamilyAndAssembly; break; case MethodVisibility.Assembly: result = visibility.Assembly; break; case MethodVisibility.Family: result = visibility.Family; break; case MethodVisibility.FamilyOrAssembly: result = visibility.FamilyOrAssembly; break; case MethodVisibility.Public: result = visibility.Public; break; default: throw new NotSupportedException(); } } else { result = false; } return(result); }
public override void VisitMethodReference(IMethodReference value) { if (value.GenericArguments.Count > 0) { WriteUnsupported(new MethodReferenceExpression { Method = value }); } else { TextFormatter textFormatter = new TextFormatter(); VisitorWriter visitorWriter = new VisitorWriter(textFormatter, _configuration); textFormatter.WriteKeyword("function"); visitorWriter.WriteWhitespace(); textFormatter.WriteDeclaration(value.Name); textFormatter.WriteLine(); using (new IndentedCodeBlock(textFormatter)) { visitorWriter.VisitParameterDeclarationCollection(value.Resolve().Parameters); } _formatter.WriteReference(value.Name, textFormatter.ToString(), value); } }
private static void WriteMethodReference(IMethodReference methodReference, IAssembly assembly, IFormattedCodeWriter writer) { if (!(methodReference is IConstructorReference)) { WriteTypeReference(methodReference.ReturnType, assembly, writer); writer.Write(' '); } WriteTypeReference(methodReference.Resolve().DeclaringType, assembly, writer); writer.Write("::"); writer.Write(methodReference.Name); writer.Write('('); if (methodReference.Parameters.Count > 0) { WriteTypeReference(methodReference.Parameters[0].ParameterType, assembly, writer); for (int i = 1; i < methodReference.Parameters.Count; i++) { writer.Write(", "); WriteTypeReference(methodReference.Parameters[i].ParameterType, assembly, writer); } } writer.Write(')'); }
private TreeNode FindNode(IMemberReference memberReference) { if (memberReference is IAssemblyReference) { foreach (TreeNode node in _assembliesTree.Nodes) { if (node.Tag == memberReference) { return(node); } } return(null); } if (memberReference is IResourceReference) { IResourceReference resourceReference = (IResourceReference)memberReference; TreeNode assemblyNode = FindNode(resourceReference.Resolve().Assembly); TreeNode resourcesNode = null; foreach (TreeNode childNode in assemblyNode.Nodes) { if (childNode.Text == "Resources") { resourcesNode = childNode; } } return(FindNode(memberReference, resourcesNode)); } if (memberReference is IModuleReference) { IModuleReference moduleReference = (IModuleReference)memberReference; return(FindNode(memberReference, FindNode(moduleReference.Resolve().Assembly))); } if (memberReference is ITypeReference) { ITypeReference typeReference = (ITypeReference)memberReference; if (typeReference.Resolve().DeclaringType != null) { TreeNode declaringTypeNode = FindNode(typeReference.Resolve().DeclaringType); return(FindNode(memberReference, declaringTypeNode)); } else { TreeNode moduleNode = FindNode(typeReference.Resolve().Module); foreach (TreeNode namespaceNode in moduleNode.Nodes) { if (((namespaceNode.Text == "-") && (typeReference.Namespace == null)) || (namespaceNode.Text == typeReference.Namespace)) { return(FindNode(memberReference, namespaceNode)); } } } return(null); } if (memberReference is IMethodReference) { IMethodReference methodReference = (IMethodReference)memberReference; TreeNode typeNode = FindNode(methodReference.Resolve().DeclaringType); if (typeNode == null) { return(null); } foreach (TreeNode node in typeNode.Nodes) { if (node.Tag == memberReference) { return(node); } if ((node.Tag is IPropertyReference) || (node.Tag is IEventReference)) { TreeNode nestedEventNode = FindNode(memberReference, node); if (nestedEventNode != null) { return(nestedEventNode); } } } return(null); } if (memberReference is IFieldReference) { IFieldReference fieldReference = (IFieldReference)memberReference; return(FindNode(memberReference, FindNode(fieldReference.Resolve().DeclaringType))); } if (memberReference is IPropertyReference) { IPropertyReference propertyReference = (IPropertyReference)memberReference; return(FindNode(memberReference, FindNode(propertyReference.Resolve().DeclaringType))); } if (memberReference is IEventReference) { IEventReference eventReference = (IEventReference)memberReference; return(FindNode(memberReference, FindNode(eventReference.Resolve().DeclaringType))); } return(null); }
public static bool IsVisible(IMethodReference value, IVisibilityConfiguration visibility) { if (IsVisible(value.DeclaringType, visibility)) { IMethodDeclaration methodDeclaration = value.Resolve(); switch (methodDeclaration.Visibility) { case MethodVisibility.Public: return visibility.Public; case MethodVisibility.Assembly: return visibility.Assembly; case MethodVisibility.FamilyOrAssembly: return visibility.FamilyOrAssembly; case MethodVisibility.Family: return visibility.Family; case MethodVisibility.Private: case MethodVisibility.PrivateScope: return visibility.Private; case MethodVisibility.FamilyAndAssembly: return visibility.FamilyAndAssembly; } throw new NotSupportedException(); } return false; }
public void TestStringSplit() { IMethodReference methodReference = AssemblyManager.FindMethod(typeof(String).GetMethod("Split")); IList <IStatement> statements = methodReference.Resolve().Body.Statements; String s; }
public void ForWithNestedIfTest() { IMethodReference methodReference = AssemblyManager.FindMethod(typeof(FlowControl).GetMethod("ForWithNestedIf")); IList <IStatement> statements = methodReference.Resolve().Body.Statements; }
public void OneWayIf2Test() { IMethodReference methodReference = AssemblyManager.FindMethod(typeof(FlowControl).GetMethod("OneWayIf2")); IList <IStatement> statements = methodReference.Resolve().Body.Statements; }
public void CaseEmptyDefaultTest() { IMethodReference methodReference = AssemblyManager.FindMethod(typeof(FlowControl).GetMethod("CaseEmptyDefault")); IList <IStatement> statements = methodReference.Resolve().Body.Statements; }
public static MethodVisibility GetVisibility(IPropertyReference value) { MethodVisibility visibility = MethodVisibility.Public; IPropertyDeclaration propertyDeclaration = value.Resolve(); if (propertyDeclaration != null) { IMethodReference setMethodReference = propertyDeclaration.SetMethod; IMethodDeclaration setMethod = (setMethodReference == null) ? null : setMethodReference.Resolve(); IMethodReference getMethodReference = propertyDeclaration.GetMethod; IMethodDeclaration getMethod = (getMethodReference == null) ? null : getMethodReference.Resolve(); if ((setMethod != null) && (getMethod != null)) { if (getMethod.Visibility == setMethod.Visibility) { visibility = getMethod.Visibility; } } else if (setMethod != null) { visibility = setMethod.Visibility; } else if (getMethod != null) { visibility = getMethod.Visibility; } } return(visibility); }
public static bool IsBaseMethod(IMethodReference value, IMethodReference baseMethod) { if (value.Name != baseMethod.Name) { return(false); } if (value.GenericMethod != null) { value = value.GenericMethod; } if (baseMethod.GenericMethod != null) { baseMethod = baseMethod.GenericMethod; } if (!value.ReturnType.Type.Equals(baseMethod.ReturnType.Type)) { return(false); } if ((value.HasThis != baseMethod.HasThis) && (value.ExplicitThis != baseMethod.ExplicitThis) && (value.CallingConvention != baseMethod.CallingConvention)) { return(false); } if (value.Parameters.Count != baseMethod.Parameters.Count) { return(false); } for (int i = 0; i < value.Parameters.Count; i++) { if (!value.Parameters[i].ParameterType.Equals(baseMethod.Parameters[i].ParameterType)) { return(false); } } if (value.GenericArguments.Count != baseMethod.GenericArguments.Count) { return(false); } IMethodDeclaration methodDeclaration = value.Resolve(); IMethodDeclaration baseMethodDeclaration = baseMethod.Resolve(); if ((methodDeclaration == null) || (baseMethodDeclaration == null)) { return(false); } if ((!methodDeclaration.Virtual) || (!baseMethodDeclaration.Virtual)) { return(false); } if (!IsBaseType(methodDeclaration.DeclaringType, baseMethodDeclaration.DeclaringType)) { return(false); } return(true); }
internal void processMethod(IMethodReference mth) { if (mth != null) { IMethodDeclaration decl = mth.Resolve(); if (decl != null) { processMethod(decl); } } }
private void Test(String methodName) { MethodInfo method = typeof(ExceptionHandlerTest).GetMethod(methodName); MethodBody body = method.GetMethodBody(); IMethodReference methodReference = AssemblyManager.FindMethod(method); ushort ip = 0; byte[] il = body.GetILAsByteArray(); SortedList <ushort, IInstruction> instructions = new SortedList <ushort, IInstruction>(); while (ip < il.Length) { instructions.Add(ip, OpCodeTable.GetInstruction(il, ref ip, (NDecompile.Model.Impl.Module)methodReference.Resolve().DeclaringType.Resolve().Module, new Type[0], new Type[0])); } foreach (ExceptionHandlingClause clause in body.ExceptionHandlingClauses) { Console.WriteLine(clause.Flags); Console.WriteLine(clause.TryOffset + " " + (clause.TryOffset + clause.TryLength)); Console.WriteLine(clause.HandlerOffset + " " + (clause.HandlerOffset + clause.HandlerLength)); Console.WriteLine(); } Node rootNode = new Node(); rootNode.StartIP = 0; rootNode.EndIP = (ushort)body.GetILAsByteArray().Length; rootNode.Type = "Return"; rootNode.Instructions.AddRange(instructions.Values); List <Node> nodes = new List <Node>(); nodes.Add(rootNode); // Add the exception information - build a sorted tree of clauses SortedList <int, TryHandler> clauses = new SortedList <int, TryHandler>(); foreach (ExceptionHandlingClause clause in body.ExceptionHandlingClauses) { Add(new TryHandler(clause), clauses); } Print(clauses, 0); Console.WriteLine(); foreach (TryHandler tryHandler in clauses.Values) { TraverseExceptionTree(tryHandler, nodes); } foreach (Node node in nodes) { Console.Write(node.StartIP + " " + node.EndIP + " " + node.Type); if (node.Type == "Try") { //Console.Write(" - Handler Node " + node.OutEdges[1].StartIP + " - Follow Node " + node.OutEdges[2].StartIP); Console.Write(" - Handler Node " + node.HandlerNode.StartIP + " - Follow Node " + node.FollowNode.StartIP); } ; Console.WriteLine(); foreach (IInstruction instruction in node.Instructions) { Console.WriteLine(" " + instruction.IP + " " + instruction.OpCode.Name); } } }
/// <summary> /// Determines whether the specified value is visible. /// </summary> /// <param name="value">The method reference value.</param> /// <param name="visibility">The visibility.</param> /// <returns> /// <c>true</c> if the specified value is visible; otherwise, <c>false</c>. /// </returns> internal static bool IsVisible(IMethodReference value, IVisibilityConfiguration visibility) { if (ReflectorHelper.IsVisible(value.DeclaringType, visibility)) { IMethodDeclaration methodDeclaration = value.Resolve(); switch (methodDeclaration.Visibility) { case MethodVisibility.Public: return visibility.Public; case MethodVisibility.Assembly: return visibility.Assembly; case MethodVisibility.FamilyOrAssembly: return visibility.FamilyOrAssembly; case MethodVisibility.Family: return visibility.Family; case MethodVisibility.Private: case MethodVisibility.PrivateScope: return visibility.Private; case MethodVisibility.FamilyAndAssembly: return visibility.FamilyAndAssembly; } throw new InvalidOperationException(); } return false; }
internal static int GetColor(IMemberReference memberReference) { IFieldReference fieldReference = memberReference as IFieldReference; if (fieldReference != null) { IFieldDeclaration fieldDeclaration = fieldReference.Resolve(); if (fieldDeclaration == null) { return(ColorInformation.Error); } switch (fieldDeclaration.Visibility) { case FieldVisibility.Private: case FieldVisibility.PrivateScope: case FieldVisibility.Assembly: case FieldVisibility.FamilyAndAssembly: return(ColorInformation.Hidden); case FieldVisibility.Public: case FieldVisibility.Family: case FieldVisibility.FamilyOrAssembly: return(ColorInformation.Normal); } } IMethodReference methodReference = memberReference as IMethodReference; if (methodReference != null) { IArrayType arrayType = methodReference.DeclaringType as IArrayType; if (arrayType != null) { return(IconHelper.GetColor(arrayType.ElementType as ITypeReference)); } IMethodDeclaration methodDeclaration = methodReference.Resolve(); if (methodDeclaration == null) { return(ColorInformation.Error); } switch (methodDeclaration.Visibility) { case MethodVisibility.Private: case MethodVisibility.PrivateScope: case MethodVisibility.Assembly: case MethodVisibility.FamilyAndAssembly: return(ColorInformation.Hidden); case MethodVisibility.Public: case MethodVisibility.Family: case MethodVisibility.FamilyOrAssembly: return(ColorInformation.Normal); } } IPropertyReference propertyReference = memberReference as IPropertyReference; if (propertyReference != null) { switch (Helper.GetVisibility(propertyReference)) { case MethodVisibility.Private: case MethodVisibility.PrivateScope: case MethodVisibility.Assembly: case MethodVisibility.FamilyAndAssembly: return(ColorInformation.Hidden); case MethodVisibility.Public: case MethodVisibility.Family: case MethodVisibility.FamilyOrAssembly: return(ColorInformation.Normal); } } IEventReference eventReference = memberReference as IEventReference; if (eventReference != null) { switch (Helper.GetVisibility(eventReference)) { case MethodVisibility.Private: case MethodVisibility.PrivateScope: case MethodVisibility.Assembly: case MethodVisibility.FamilyAndAssembly: return(ColorInformation.Hidden); case MethodVisibility.Public: case MethodVisibility.Family: case MethodVisibility.FamilyOrAssembly: return(ColorInformation.Normal); } } throw new NotSupportedException(); }
internal static int GetImageIndex(IMemberReference memberReference) { IFieldReference fieldReference = memberReference as IFieldReference; if (fieldReference != null) { IFieldDeclaration fieldDeclaration = fieldReference.Resolve(); if (fieldDeclaration == null) { return(BrowserResource.Error); } int icon = BrowserResource.Field; if (IsEnumerationElement(fieldReference)) { icon = BrowserResource.EnumerationElement; } else { if (fieldDeclaration.Static) { icon += 6; } } switch (fieldDeclaration.Visibility) { case FieldVisibility.Public: return(icon); case FieldVisibility.Assembly: return(icon + 1); case FieldVisibility.FamilyOrAssembly: return(icon + 2); case FieldVisibility.Family: return(icon + 3); case FieldVisibility.Private: case FieldVisibility.PrivateScope: return(icon + 4); case FieldVisibility.FamilyAndAssembly: return(icon + 5); } } IMethodReference methodReference = memberReference as IMethodReference; if (methodReference != null) { IArrayType arrayType = methodReference.DeclaringType as IArrayType; if (arrayType != null) { return(BrowserResource.Method); } IMethodDeclaration methodDeclaration = methodReference.Resolve(); if (methodDeclaration == null) { return(BrowserResource.Error); } int icon = BrowserResource.Method; string methodName = methodReference.Name; if ((methodName == ".ctor") || (methodName == ".cctor")) { icon = BrowserResource.Constructor; } else if ((methodDeclaration.Virtual) && (!methodDeclaration.Abstract)) { icon += 12; } if (methodDeclaration.Static) { icon += 6; } switch (methodDeclaration.Visibility) { case MethodVisibility.Public: return(icon); case MethodVisibility.Assembly: return(icon + 1); case MethodVisibility.FamilyOrAssembly: return(icon + 2); case MethodVisibility.Family: return(icon + 3); case MethodVisibility.Private: case MethodVisibility.PrivateScope: return(icon + 4); case MethodVisibility.FamilyAndAssembly: return(icon + 5); } } IPropertyReference propertyReference = memberReference as IPropertyReference; if (propertyReference != null) { IPropertyDeclaration propertyDeclaration = propertyReference.Resolve(); if (propertyDeclaration != null) { IMethodReference getMethodReference = propertyDeclaration.GetMethod; IMethodDeclaration getMethod = (getMethodReference == null) ? null : getMethodReference.Resolve(); IMethodReference setMethodReference = propertyDeclaration.SetMethod; IMethodDeclaration setMethod = (setMethodReference == null) ? null : setMethodReference.Resolve(); int index = BrowserResource.Property; if ((setMethod != null) && (getMethod != null)) { index = BrowserResource.Property; } else if (setMethod != null) { index = BrowserResource.PropertyWrite; } else if (getMethod != null) { index = BrowserResource.PropertyRead; } if (Helper.IsStatic(propertyReference)) { index += 6; } switch (Helper.GetVisibility(propertyReference)) { case MethodVisibility.Public: return(index + 0); case MethodVisibility.Assembly: return(index + 1); case MethodVisibility.FamilyOrAssembly: return(index + 2); case MethodVisibility.Family: return(index + 3); case MethodVisibility.Private: case MethodVisibility.PrivateScope: return(index + 4); case MethodVisibility.FamilyAndAssembly: return(index + 5); } } } IEventReference eventReference = memberReference as IEventReference; if (eventReference != null) { int index = BrowserResource.Event; if (Helper.IsStatic(eventReference)) { index += 6; } switch (Helper.GetVisibility(eventReference)) { case MethodVisibility.Public: return(index + 0); case MethodVisibility.Assembly: return(index + 1); case MethodVisibility.FamilyOrAssembly: return(index + 2); case MethodVisibility.Family: return(index + 3); case MethodVisibility.Private: case MethodVisibility.PrivateScope: return(index + 4); case MethodVisibility.FamilyAndAssembly: return(index + 5); } } throw new NotSupportedException(); }