Files
UnrealEngineUWP/Engine/Source/Programs/IOS/DeploymentServerLauncher/Launcher.cs
Ryan Durand 9ef3748747 Updating copyrights for Engine Programs.
#rnx
#rb none
#jira none

#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869242 in //Fortnite/Release-12.00/... via CL 10869536
#ROBOMERGE-BOT: FORTNITE (Main -> Dev-EngineMerge) (v613-10869866)

[CL 10870955 by Ryan Durand in Main branch]
2019-12-26 23:01:54 -05:00

80 lines
2.7 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;
using System.Diagnostics;
namespace DeploymentServerLauncher
{
class Launcher
{
static int Main()
{
string CommandLine;
string UATExecutable;
string WorkingDirectory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
var ExitCode = 193;
if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
{
Process NewProcess = new Process();
NewProcess.StartInfo.WorkingDirectory = WorkingDirectory;
NewProcess.StartInfo.WorkingDirectory.TrimEnd('/');
NewProcess.StartInfo.FileName = NewProcess.StartInfo.WorkingDirectory + "/../../../Build/BatchFiles/Mac/RunMono.sh";
NewProcess.StartInfo.Arguments = "\"" + NewProcess.StartInfo.WorkingDirectory + "/DeploymentServer.exe\" server " + Process.GetCurrentProcess().Id.ToString() + " \"" + NewProcess.StartInfo.WorkingDirectory + "\"";
NewProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
NewProcess.StartInfo.UseShellExecute = true;
try
{
NewProcess.Start();
}
catch (System.Exception ex)
{
Console.WriteLine("Failed to create deployment server process ({0})", ex.Message);
}
}
else
{
var Domaininfo = new AppDomainSetup();
Domaininfo.ApplicationBase = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Domaininfo.ConfigurationFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\DeploymentServer.exe.config";
WorkingDirectory.TrimEnd('\\');
UATExecutable = WorkingDirectory + "\\DeploymentServer.exe";
CommandLine = "server " + Process.GetCurrentProcess().Id.ToString() + " \"" + WorkingDirectory + "\"";
Domaininfo.ShadowCopyFiles = "true";
// Create application domain setup information.
// Create the application domain.
var Domain = AppDomain.CreateDomain("DeploymentServer", AppDomain.CurrentDomain.Evidence, Domaininfo);
// Default exit code in case UAT does not even start, otherwise we always return UAT's exit code.
try
{
string[] Commands = CommandLine.Split(' ');
Console.WriteLine("Executing assembly");
ExitCode = Domain.ExecuteAssembly(UATExecutable, Commands);
Console.WriteLine("Assembly exited:" + ExitCode.ToString());
// Unload the application domain.
AppDomain.Unload(Domain);
}
catch (Exception Ex)
{
Console.WriteLine(Ex.Message);
Console.WriteLine(Ex.StackTrace);
}
}
Console.WriteLine("Deployment launcher exited.");
return ExitCode;
}
}
}