Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            string path      = args[0].Replace("\"", "");
            var    classFile = JavaClassFile.FromFile(path);
            var    image     = new JavaClassImage(classFile);
            var    rootClass = image.RootClass;

            Console.WriteLine("Basic information:");
            DumpStructure(rootClass);

            Console.WriteLine("Disassembly of each method:");
            DumpByteCode(rootClass);
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            string path      = args[0].Replace("\"", "");
            var    classFile = JavaClassFile.FromFile(path);

            classFile.MajorVersion = 52;
            var image = DumpImage(classFile);

            var    newClassFile = image.CreateClassFile();
            string outputPath   = Path.Combine(Path.GetDirectoryName(path), "output", Path.GetFileName(path));

            newClassFile.Write(outputPath);

            newClassFile = JavaClassFile.FromFile(outputPath);
            DumpImage(newClassFile);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Parses a class file located on tbhe disk, and opens a high-level representation of the class file.
 /// </summary>
 /// <param name="file">The path to the file to parse.</param>
 /// <returns>The high-level Java class image.</returns>
 /// <exception cref="BadImageFormatException">Occurs when the file does not provide a valid signature of
 /// a class file.</exception>
 public static JavaClassImage FromFile(string file)
 {
     return(new JavaClassImage(JavaClassFile.FromFile(file)));
 }