Package smart.updater.searches

Source Code of smart.updater.searches.LoopCycle

package smart.updater.searches;

import java.util.HashMap;
import java.util.Map.Entry;

import org.apache.bcel.classfile.*;
import org.apache.bcel.generic.*;

import smart.updater.InstructionSearcher2;
import smart.updater.RSClient;
import smart.updater.Search;

public class LoopCycle extends Search{

  @Override
  public SearchResult run(RSClient data, HashMap<String, ClassGen> classes) {
    for(Entry<String, ClassGen> c : classes.entrySet()){
      if(c.getValue().getClassName().equals("client")){
        ClassGen cg = new ClassGen(c.getValue().getJavaClass());
        ConstantPoolGen cpg = cg.getConstantPool();
        for(Method m : cg.getMethods()){
          InstructionSearcher2 iS = new InstructionSearcher2(cg, m);
          if(iS.nextSIPUSH(1500)!= null){
            FieldInstruction fi = iS.previousFieldInstruction();
            data.addField("LoopCycle", fi.getClassName(cpg)+'.'+fi.getFieldName(cpg));
            return SearchResult.Success;
          }
        }
      }
    }
    return SearchResult.Failure;
  }

}
TOP

Related Classes of smart.updater.searches.LoopCycle

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.