Пример #1
0
        public static Java_Class map_Methods(this Java_Class javaClass, object classFile)
        {
            var mappedConstantsPools = javaClass.ConstantsPool.getDictionaryWithValues();
            var methods = (IEnumerable)classFile.prop("Methods");

            foreach (var method in methods)
            {
                var javaMethod = new Java_Method {
                    Name = method.prop("Name").str(),
                    ParametersAndReturnType = method.prop("Signature").str(),
                    ClassName          = javaClass.Signature,
                    IsAbstract         = method.prop("IsAbstract").str().toBool(),
                    IsClassInitializer = method.prop("IsClassInitializer").str().toBool(),
                    IsNative           = method.prop("IsNative").str().toBool(),
                    IsPublic           = method.prop("IsPublic").str().toBool(),
                    IsStatic           = method.prop("IsStatic").str().toBool()
                };
                javaMethod.SimpleSignature = "{0}{1}".format(javaMethod.Name, javaMethod.ParametersAndReturnType);
                javaMethod.ReturnType      = javaMethod.ParametersAndReturnType.subString_After(")");
                javaMethod.Signature       = "{0}.{1}".format(javaMethod.ClassName, javaMethod.SimpleSignature);
                if (method.prop("GenericSignature").notNull())
                {
                    javaMethod.GenericSignature = method.prop("GenericSignature").str();
                }
                javaMethod.map_Annotations(method)
                .map_Variables(method);


                var instructions = (IEnumerable)method.prop("Instructions");
                if (instructions.notNull())
                {
                    foreach (var instruction in instructions)
                    {
                        var javaInstruction = new Java_Instruction();
                        javaInstruction.Pc           = instruction.prop("PC").str().toInt();
                        javaInstruction.OpCode       = instruction.prop("NormalizedOpCode").str();
                        javaInstruction.Target_Index = instruction.prop("TargetIndex").str().toInt();
                        javaMethod.Instructions.Add(javaInstruction);
                    }
                }

                javaClass.Methods.Add(javaMethod);
            }
            return(javaClass);
        }
Пример #2
0
		public static Java_Class map_Methods(this Java_Class javaClass, object classFile)
		{
			var mappedConstantsPools = javaClass.ConstantsPool.getDictionaryWithValues();
			var methods = (IEnumerable)classFile.prop("Methods");
			foreach(var method in methods)
			{		
				var javaMethod = new Java_Method {
													Name = method.prop("Name").str(),
													ParametersAndReturnType = method.prop("Signature").str(),														
													ClassName = javaClass.Signature,
													IsAbstract = method.prop("IsAbstract").str().toBool(), 
													IsClassInitializer = method.prop("IsClassInitializer").str().toBool(), 
													IsNative = method.prop("IsNative").str().toBool(), 
													IsPublic = method.prop("IsPublic").str().toBool(), 
													IsStatic = method.prop("IsStatic").str().toBool()
												 };															 
				javaMethod.SimpleSignature = "{0}{1}".format(javaMethod.Name,javaMethod.ParametersAndReturnType);
				javaMethod.ReturnType = javaMethod.ParametersAndReturnType.subString_After(")");
				javaMethod.Signature =  "{0}.{1}".format(javaMethod.ClassName, javaMethod.SimpleSignature);
				if (method.prop("GenericSignature").notNull())
					javaMethod.GenericSignature = method.prop("GenericSignature").str();
				javaMethod.map_Annotations(method)
						  .map_Variables(method);
				
				
				var instructions = (IEnumerable) method.prop("Instructions");
				if (instructions.notNull())
				{	
					foreach(var instruction in instructions)
					{
						var javaInstruction = new Java_Instruction();
						javaInstruction.Pc = instruction.prop("PC").str().toInt(); 
						javaInstruction.OpCode = instruction.prop("NormalizedOpCode").str(); 
						javaInstruction.Target_Index =  instruction.prop("TargetIndex").str().toInt();
						javaMethod.Instructions.Add(javaInstruction);						
					}
				}
				
				javaClass.Methods.Add(javaMethod);
			}
			return javaClass;
		}