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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#include "standardpch.h"
#include "mcs.h"
#include "commandline.h"
#include "verbasmdump.h"
#include "verbinteg.h"
#include "verbdump.h"
#include "verbfracture.h"
#include "verbdumpmap.h"
#include "verbdumptoc.h"
#include "verbildump.h"
#include "verbtoc.h"
#include "verbremovedup.h"
#include "verbstat.h"
#include "verbconcat.h"
#include "verbmerge.h"
#include "verbstrip.h"
#include "verbsmarty.h"
#include "logging.h"
int __cdecl main(int argc, char* argv[])
{
#ifdef FEATURE_PAL
if (0 != PAL_Initialize(argc, argv))
{
fprintf(stderr, "Error: Fail to PAL_Initialize\n");
exit(1);
}
#endif // FEATURE_PAL
Logger::Initialize();
CommandLine::Options o;
if(!CommandLine::Parse(argc, argv, &o))
{
return -1;
}
//execute the chosen command.
int exitCode = 0;
if (o.actionASMDump)
{
exitCode = verbASMDump::DoWork(o.nameOfFile1, o.nameOfFile2, o.indexCount, o.indexes);
}
if (o.actionConcat)
{
exitCode = verbConcat::DoWork(o.nameOfFile1, o.nameOfFile2);
}
if (o.actionMerge)
{
exitCode = verbMerge::DoWork(o.nameOfFile1, o.nameOfFile2, o.recursive);
}
if (o.actionCopy)
{
exitCode = verbStrip::DoWork(o.nameOfFile1, o.nameOfFile2, o.indexCount, o.indexes, false, o.stripCR);
}
if (o.actionDump)
{
exitCode = verbDump::DoWork(o.nameOfFile1, o.indexCount, o.indexes);
}
if (o.actionFracture)
{
exitCode = verbFracture::DoWork(o.nameOfFile1, o.nameOfFile2, o.indexCount, o.indexes, o.stripCR);
}
if (o.actionDumpMap)
{
exitCode = verbDumpMap::DoWork(o.nameOfFile1);
}
if (o.actionDumpToc)
{
exitCode = verbDumpToc::DoWork(o.nameOfFile1);
}
if (o.actionILDump)
{
exitCode = verbILDump::DoWork(o.nameOfFile1, o.indexCount, o.indexes);
}
if (o.actionInteg)
{
exitCode = verbInteg::DoWork(o.nameOfFile1);
}
if (o.actionRemoveDup)
{
exitCode = verbRemoveDup::DoWork(o.nameOfFile1, o.nameOfFile2, o.stripCR, o.legacyCompare);
}
if (o.actionStat)
{
exitCode = verbStat::DoWork(o.nameOfFile1, o.nameOfFile2, o.indexCount, o.indexes);
}
if (o.actionStrip)
{
exitCode = verbStrip::DoWork(o.nameOfFile1, o.nameOfFile2, o.indexCount, o.indexes, true, o.stripCR);
}
if (o.actionTOC)
{
exitCode = verbTOC::DoWork(o.nameOfFile1);
}
if (o.actionSmarty)
{
exitCode = verbSmarty::DoWork(o.nameOfFile1, o.nameOfFile2, o.indexCount, o.indexes);
}
Logger::Shutdown();
return exitCode;
}
|