46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using System;
|
|
using System.IO;
|
|
using JD.Application.Program;
|
|
using JD.TeaBoxAddinSystem.Bootstrap;
|
|
using PluginCommon;
|
|
using TeaBox.Bootstrap;
|
|
|
|
namespace Packager
|
|
{
|
|
/// <summary>
|
|
/// In this class the object of the game tool is created and is passed all the command line arguments.
|
|
/// </summary>
|
|
public class PackagerApplicationStartup : GenericApplicationStartup
|
|
{
|
|
private readonly string[] _arguments;
|
|
|
|
public PackagerApplicationStartup(string[] arguments, bool acceptMacroCmd = false, RuntimeMode runtimeMode = RuntimeMode.Normal)
|
|
: base(new string[0], acceptMacroCmd, runtimeMode)
|
|
{
|
|
_arguments = arguments;
|
|
}
|
|
|
|
protected override void OnStarting(out int exitCode)
|
|
{
|
|
var arguments = new CommandLineArgs(_arguments);
|
|
|
|
//In case a "parameters" argument is found. It means we pass the arguments through a text file which can be useful for long arguments
|
|
var parameters = arguments.getStringValue("parameters");
|
|
if (!string.IsNullOrEmpty(parameters))
|
|
{
|
|
using (TextReader reader = File.OpenText(parameters))
|
|
{
|
|
string temp = reader.ReadToEnd();
|
|
string[] args = { temp };
|
|
arguments = new CommandLineArgs(args);
|
|
}
|
|
}
|
|
|
|
new JD.Timeline.Initialization().Execute();
|
|
var gameTool = new GameTool(arguments);
|
|
gameTool.Start();
|
|
exitCode = 0;
|
|
Environment.Exit(exitCode);
|
|
}
|
|
}
|
|
}
|