Files
bowen 9937a677af Update Endless Trials for Steam build 26936481
- Add the isolated Windows launcher and checkpoint worker.
- Restore native bell and training interactions and enter the custom start page directly.
- Update run configuration, encounters, assists and the in-game GM menu.
2026-11-29 22:09:33 +08:00

54 lines
2.0 KiB
C#

using System.Runtime.InteropServices;
using System.Text;
namespace PBZRogue.Runtime;
internal static class Program
{
public static int Main(string[] args)
{
Options? options = null;
try
{
Console.OutputEncoding = new UTF8Encoding(false);
options = Options.Parse(args);
switch (options.Operation)
{
case "Launch": Launcher.Run(options); break;
case "Worker": SaveWorker.Run(options); break;
default:
new ProfileStore(options.GameRoot).Execute(options.ProfileDirectory!, options.Operation,
options.CheckpointId, options.JobId!);
break;
}
return 0;
}
catch (Exception error)
{
Console.Error.WriteLine(error.Message);
if (options?.Operation == "Worker")
{
try
{
var store = new ProfileStore(options.GameRoot);
store.AssertProfile(options.ProfileDirectory!);
ProfileStore.WriteDurable(Path.Combine(options.ProfileDirectory!,
"save-worker-" + options.WorkerId + ".error"), Encoding.UTF8.GetBytes(error.Message));
}
catch (Exception receiptError) { Console.Error.WriteLine(receiptError.Message); }
}
// Worker, menu, and redirected CLI failures must never wait on a dialog.
if (options?.Operation == "Launch" && options.ReadyFile is null
&& !Console.IsErrorRedirected && !Console.IsOutputRedirected)
{
MessageBoxW(IntPtr.Zero, error.Message,
options.Language == "zh" ? "无尽修炼启动失败" : "Endless Trials launch failed", 0x10);
}
return 1;
}
}
[DllImport("user32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
private static extern int MessageBoxW(IntPtr window, string text, string caption, uint type);
}