Beispiel #1
0
 public static void Init()
 {
     if (_torchResolver == null)
     {
         _torchResolver = new TorchAssemblyResolver(GetBinaries("TorchBinaries"), GetBinaries("GameBinaries"));
     }
 }
Beispiel #2
0
        public bool Initialize(string[] args)
        {
            if (_init)
            {
                return(false);
            }

            AppDomain.CurrentDomain.UnhandledException += HandleException;

            if (!args.Contains("-noupdate"))
            {
                RunSteamCmd();
            }

            _resolver = new TorchAssemblyResolver(Path.Combine(_basePath, "DedicatedServer64"));
            _config   = InitConfig();
            if (!_config.Parse(args))
            {
                return(false);
            }

            if (!string.IsNullOrEmpty(_config.WaitForPID))
            {
                try
                {
                    var pid      = int.Parse(_config.WaitForPID);
                    var waitProc = Process.GetProcessById(pid);
                    Log.Info("Continuing in 5 seconds.");
                    Thread.Sleep(5000);
                    if (!waitProc.HasExited)
                    {
                        Log.Warn($"Killing old process {pid}.");
                        waitProc.Kill();
                    }
                }
                catch
                {
                    // ignored
                }
            }

            _init = true;
            return(true);
        }