void Decompile::work() { auto context = std::make_shared<core::Context>(); context->setModule(project_->module()); context->setInstructions(instructions_); context->setCancellationToken(cancellationToken()); context->setLogToken(project_->logToken()); project_->setContext(context); delegate(std::make_unique<Decompilation>(context)); }
void MainWindow::open(const QStringList &filenames) { if (filenames.empty()) { return; } auto context = std::make_shared<core::Context>(); context->setLogToken(logToken_); foreach (const QString &filename, filenames) { try { core::Driver::parse(*context, filename); } catch (const nc::Exception &e) { QMessageBox::critical(this, tr("Error"), e.unicodeWhat()); return; } catch (const std::exception &e) { QMessageBox::critical(this, tr("Error"), e.what()); return; } } auto project = std::make_unique<gui::Project>(); project->setName(QFileInfo(filenames.front()).fileName()); project->setContext(context); project->setImage(context->image()); project->setInstructions(context->instructions()); open(std::move(project)); if (project_->instructions()->empty()) { project_->disassemble(); } if (decompileAutomatically()) { project_->decompile(); } }