-
Notifications
You must be signed in to change notification settings - Fork 29
/
ExtractNameLists.cpp
53 lines (41 loc) · 1.16 KB
/
ExtractNameLists.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <iomanip>
#include "UPKInfo.h"
#include <fstream>
using namespace std;
int main(int argN, char* argV[])
{
cout << "ExtractNameLists by wghost81 aka Wasteland Ghost" << endl;
if (argN < 2 || argN > 3)
{
cerr << "Usage: ExtractNameLists UnpackedResourceFile.upk [/v]" << endl;
return 1;
}
ifstream package(argV[1], ios::binary);
if (!package.is_open())
{
cerr << "Can't open " << argV[1] << endl;
return 1;
}
bool verbose = false;
if (argN == 3 && string(argV[2]) == "/v")
{
verbose = true;
}
UPKInfo PackageInfo(package);
UPKReadErrors err = PackageInfo.GetError();
if (err != UPKReadErrors::NoErrors)
{
cerr << "Error reading package:\n" << FormatReadErrors(err);
if (PackageInfo.IsCompressed())
{
cout << PackageInfo.FormatSummary();
}
return 1;
}
cout << PackageInfo.FormatSummary() << std::endl
<< PackageInfo.FormatNames(verbose) << std::endl
<< PackageInfo.FormatImports(verbose) << std::endl
<< PackageInfo.FormatExports(verbose);
return 0;
}