forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
73 lines (61 loc) · 2.3 KB
/
Program.cs
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
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
namespace MGCB
{
class Program
{
static int Main(string[] args)
{
// We force all stderr to redirect to stdout
// to avoid any out of order console output.
Console.SetError(Console.Out);
if (!Environment.Is64BitProcess && Environment.OSVersion.Platform != PlatformID.Unix)
{
Console.Error.WriteLine("The MonoGame content tools only work on a 64bit OS.");
return -1;
}
var content = new BuildContent();
// Parse the command line.
var parser = new MGBuildParser(content)
{
Title = "MonoGame Content Builder\n" +
"Builds optimized game content for MonoGame projects."
};
if (!parser.Parse(args))
return -1;
// Launch debugger if requested.
if (content.LaunchDebugger)
{
try {
System.Diagnostics.Debugger.Launch();
} catch (NotImplementedException) {
// not implemented under Mono
}
}
if (content.HasWork)
{
// Print a startup message.
var buildStarted = DateTime.Now;
if (!content.Quiet)
Console.WriteLine("Build started {0}\n", buildStarted);
// Let the content build.
int successCount, errorCount;
content.Build(out successCount, out errorCount);
// Print the finishing info.
if (!content.Quiet)
{
Console.WriteLine("\nBuild {0} succeeded, {1} failed.\n", successCount, errorCount);
Console.WriteLine("Time elapsed {0:hh\\:mm\\:ss\\.ff}.", DateTime.Now - buildStarted);
}
// Return the error count.
return errorCount;
}
return 0;
}
}
}