public LFunction(BHeader header, int[] code, LLocal[] locals, LObject[] constants, LUpvalue[] upvalues, LFunction[] functions, int maximumStackSize, int numUpValues, int numParams, int vararg) { this.header = header; this.code = code; this.locals = locals; this.constants = constants; this.upvalues = upvalues; this.functions = functions; this.maximumStackSize = maximumStackSize; this.numUpvalues = numUpValues; this.numParams = numParams; this.vararg = vararg; }
public ForBlock(LFunction function, int begin, int end, int register, Registers r) : base(function, begin, end) { this.register = register; this.r = r; statements = new List <Statement>(end - begin + 1); }
public Code(LFunction function) { code = function.Code; map = function.Header.Version.GetOpcodeMap(); }
public BooleanIndicator(LFunction function, int line) : base(function, line, line) { }
public ClosureExpression(LFunction function, int upvalueLine) : base(Precedence.ATOMIC) { _function = function; _upvalueLine = upvalueLine; }
static void Main(string[] args) { if (args.Length == 0) { PrintVersion(true); PrintError("no input file provided"); PrintUsage(true); Environment.Exit(1); } else { var fn = args[0]; LFunction lMain = null; //Console.BufferHeight = 2500; /* Error Levels * * 0 - Successfully decompiled file * 1 - An error occurred while processing the input file * 2 - The specified output file could not be created */ try { lMain = FileToFunction(fn); } catch (Exception e) { PrintVersion(true); PrintError(e.Message); Environment.Exit(1); } var d = new Decompiler(lMain); d.Decompile(); var writeLog = true; if (args.Length > 1) { // skip first arg for (int i = 1; i < args.Length; i++) { var arg = args[i]; if (arg.StartsWith("-")) { switch (arg.ToLower().TrimStart('-')) { case "nolog": writeLog = false; continue; default: // just ignore it if (writeLog) { Console.WriteLine("unknown argument '{0}'", arg); } continue; } } else { /** PROGRAM MUST TERMINATE ONCE FINISHED **/ var filename = arg; try { using (var writer = new StreamWriter(filename, false, new UTF8Encoding(false))) { d.Print(new Output(writer)); writer.Flush(); if (writeLog) { Console.WriteLine("successfully decompiled to '{0}'", filename); } Environment.Exit(0); } } catch (Exception e) { PrintVersion(true); PrintError(e.Message); Environment.Exit(2); } /** PROGRAM MUST BE TERMINATED BY THIS POINT **/ } } } // no output file was specified, spit out to console d.Print(); if (System.Diagnostics.Debugger.IsAttached) { Console.ReadKey(); } Environment.Exit(0); } }
public Block(LFunction function, int begin, int end) { _function = function; Begin = begin; End = end; }
public Break(LFunction function, int line, int target) : base(function, line, line) { this.target = target; }
public CompareBlock(LFunction function, int begin, int end, int target, Branch branch) : base(function, begin, end) { Target = target; Branch = branch; }
public ElseEndBlock(LFunction function, int begin, int end) : base(function, begin, end) => _statements = new List <Statement>(end - begin + 1);
public AlwaysLoop(LFunction function, int begin, int end) : base(function, begin, end) => _statements = new List <Statement>();
public OuterBlock(LFunction function, int length) : base(function, 0, length + 1) { statements = new List <Statement>(length); }
public Break(LFunction function, int line, int target) : base(function, line, line) => Target = target;
public ClosureExpression(LFunction function, int upvalueLine) : base(PRECEDENCE_ATOMIC) { this.m_function = function; this.m_upvalueLine = upvalueLine; }
public AlwaysLoop(LFunction function, int begin, int end) : base(function, begin, end) { statements = new List<Statement>(); }
public IfThenEndBlock(LFunction function, Branch branch, Registers r) : this(function, branch, null, r) { }
public Code(LFunction function) { _code = function.Code; _map = function.Header.Version.GetOpcodeMap(); _extractor = function.Header.Extractor; }