public Program VisitInputFile(string projectFilePath, DecompilerInput_v3 sInput) { var bytes = loader.LoadImageBytes(ConvertToAbsolutePath(projectFilePath, sInput.Filename), 0); var sUser = sInput.User; var address = LoadAddress(sUser); Program program; if (sUser.Processor != null && (sUser.PlatformOptions == null || sUser.PlatformOptions.Name != null)) { var arch = sUser.Processor.Name; var platform = sUser.PlatformOptions != null ? sUser.PlatformOptions.Name : null; program = loader.LoadRawImage(sInput.Filename, bytes, arch, platform, address); } else { program = loader.LoadExecutable(sInput.Filename, bytes, address); } program.Filename = ConvertToAbsolutePath(projectFilePath, sInput.Filename); program.DisassemblyFilename = ConvertToAbsolutePath(projectFilePath, sInput.DisassemblyFilename); program.IntermediateFilename = ConvertToAbsolutePath(projectFilePath, sInput.IntermediateFilename); program.OutputFilename = ConvertToAbsolutePath(projectFilePath, sInput.OutputFilename); program.TypesFilename = ConvertToAbsolutePath(projectFilePath, sInput.TypesFilename); program.GlobalsFilename = ConvertToAbsolutePath(projectFilePath, sInput.GlobalsFilename); program.EnsureFilenames(program.Filename); LoadUserData(sUser, program, program.User); ProgramLoaded.Fire(this, new ProgramEventArgs(program)); return(program); }
public Program VisitInputFile(string projectFilePath, DecompilerInput_v3 sInput) { var binAbsPath = ConvertToAbsolutePath(projectFilePath, sInput.Filename); var bytes = loader.LoadImageBytes(binAbsPath, 0); var sUser = sInput.User; var address = LoadAddress(sUser); Program program; if (sUser.Processor != null && (sUser.PlatformOptions == null || sUser.PlatformOptions.Name != null)) { var arch = sUser.Processor.Name; var platform = sUser.PlatformOptions?.Name; program = loader.LoadRawImage(binAbsPath, bytes, address, new LoadDetails { ArchitectureName = arch, PlatformName = platform, LoadAddress = sUser.LoadAddress, }); } else { program = loader.LoadExecutable(sInput.Filename, bytes, null, address) ?? new Program(); // A previous save of the project was able to read the file, // but now we can't... } this.platform = program.Platform; program.Filename = ConvertToAbsolutePath(projectFilePath, sInput.Filename); program.DisassemblyFilename = ConvertToAbsolutePath(projectFilePath, sInput.DisassemblyFilename); program.IntermediateFilename = ConvertToAbsolutePath(projectFilePath, sInput.IntermediateFilename); program.OutputFilename = ConvertToAbsolutePath(projectFilePath, sInput.OutputFilename); program.TypesFilename = ConvertToAbsolutePath(projectFilePath, sInput.TypesFilename); program.GlobalsFilename = ConvertToAbsolutePath(projectFilePath, sInput.GlobalsFilename); program.EnsureFilenames(program.Filename); LoadUserData(sUser, program, program.User); ProgramLoaded.Fire(this, new ProgramEventArgs(program)); return(program); }