50 lines
No EOL
1.6 KiB
C#
50 lines
No EOL
1.6 KiB
C#
using System;
|
|
using System.IO;
|
|
using TeaBox.BuildVersion;
|
|
|
|
namespace TeaBox.Data
|
|
{
|
|
/// <summary>
|
|
/// The environment file contains the equivalent of the command line but in the package.
|
|
/// This is useful for final packages that cannot receive command line arguments
|
|
/// </summary>
|
|
public static class EnvironmentFile
|
|
{
|
|
public static string Create(GameOnlineEnvironment environment)
|
|
{
|
|
string tmpFile;
|
|
|
|
if (environment == GameOnlineEnvironment.Default)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
else
|
|
{
|
|
tmpFile = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), "cmdline.txt");
|
|
using (var fileStream = new FileStream(tmpFile, FileMode.Create))
|
|
using (var writer = new StreamWriter(fileStream))
|
|
{
|
|
writer.WriteLine($"onlineServer={environment.Identifier()}");
|
|
}
|
|
}
|
|
return tmpFile;
|
|
}
|
|
|
|
private static string Identifier(this GameOnlineEnvironment environment)
|
|
{
|
|
switch (environment)
|
|
{
|
|
case GameOnlineEnvironment.Default:
|
|
return "";
|
|
case GameOnlineEnvironment.Qc:
|
|
return "qc";
|
|
case GameOnlineEnvironment.Playtest:
|
|
return "playtest";
|
|
case GameOnlineEnvironment.E3:
|
|
return "e3";
|
|
default:
|
|
throw new NotImplementedException(environment.ToString());
|
|
}
|
|
}
|
|
}
|
|
} |