nod/main.cpp

36 lines
1002 B
C++
Raw Normal View History

2015-06-28 05:43:53 +00:00
#include <stdio.h>
#include <string.h>
2015-06-26 20:01:15 +00:00
#include "NODLib.hpp"
2015-06-26 19:30:03 +00:00
2015-06-26 20:01:15 +00:00
int main(int argc, char* argv[])
2015-06-26 19:30:03 +00:00
{
2015-06-26 20:01:15 +00:00
if (argc < 2)
2015-06-28 05:43:53 +00:00
{
fprintf(stderr, "Usage: nodlib <image-in>\n");
2015-06-26 20:01:15 +00:00
return -1;
2015-06-28 05:43:53 +00:00
}
2015-06-26 20:01:15 +00:00
2015-06-29 08:59:54 +00:00
std::unique_ptr<NOD::DiscBase> disc = NOD::OpenDiscFromImage(argv[1]);
2015-06-26 20:01:15 +00:00
if (!disc)
return -1;
2015-06-30 00:07:46 +00:00
const NOD::DiscBase::IPartition* dataPart = disc->getDataPartition();
if (dataPart)
{
for (const NOD::DiscBase::IPartition::Node& node : dataPart->getFSTRoot())
{
if (node.getKind() == NOD::DiscBase::IPartition::Node::NODE_FILE)
printf("FILE: %s\n", node.getName().c_str());
else if (node.getKind() == NOD::DiscBase::IPartition::Node::NODE_DIRECTORY)
{
printf("DIR: %s\n", node.getName().c_str());
for (const NOD::DiscBase::IPartition::Node& subnode : node)
printf("SUBFILE: %s\n", subnode.getName().c_str());
}
}
}
2015-06-26 19:30:03 +00:00
return 0;
}