Exemplo n.º 1
0
        public static void Main(string[] args)
        {
#if DEBUG
            try
            {
                AllocConsole();
#endif
            if (!TorchLauncher.IsTorchWrapped())
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

                // Early config: Resolve SE install directory.
                if (!File.Exists(Path.Combine(SpaceEngineersInstallAlias, _spaceEngineersVerifyFile)))
                {
                    SetupSpaceEngInstallAlias();
                }

                TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args,
                                     Path.Combine(SpaceEngineersInstallAlias, SpaceEngineersBinaries));
                return;
            }

            RunClient();
#if DEBUG
        }

        finally
        {
            FreeConsole();
        }
#endif
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Target.Register <FlowDocumentTarget>("FlowDocument");
            //Ensures that all the files are downloaded in the Torch directory.
            var workingDir = new FileInfo(typeof(Program).Assembly.Location).Directory.ToString();
            var binDir     = Path.Combine(workingDir, "DedicatedServer64");

            Directory.SetCurrentDirectory(workingDir);

            if (!TorchLauncher.IsTorchWrapped())
            {
                TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args, binDir);
                return;
            }

            if (!Environment.UserInteractive)
            {
                using (var service = new TorchService())
                    ServiceBase.Run(service);
                return;
            }

            var initializer = new Initializer(workingDir);

            if (!initializer.Initialize(args))
            {
                return;
            }

            initializer.Run();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            Target.Register <FlowDocumentTarget>("FlowDocument");
            //Ensures that all the files are downloaded in the Torch directory.
            var workingDir = new FileInfo(typeof(Program).Assembly.Location).Directory.ToString();
            var binDir     = Path.Combine(workingDir, "DedicatedServer64");

            Directory.SetCurrentDirectory(workingDir);

            //HACK for block skins update
            var badDlls = new[]
            {
                "System.Security.Principal.Windows.dll",
                "VRage.Platform.Windows.dll"
            };

            try
            {
                foreach (var file in badDlls)
                {
                    if (File.Exists(file))
                    {
                        File.Delete(file);
                    }
                }
            }
            catch (Exception e)
            {
                var log = LogManager.GetCurrentClassLogger();
                log.Error($"Error updating. Please delete the following files from the Torch root folder manually:\r\n{string.Join("\r\n", badDlls)}");
                log.Error(e);
                return;
            }

            if (!TorchLauncher.IsTorchWrapped())
            {
                TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args, binDir);
                return;
            }

            // Breaks on Windows Server 2019
            if (!new ComputerInfo().OSFullName.Contains("Server 2019") && !Environment.UserInteractive)
            {
                using (var service = new TorchService(args))
                    ServiceBase.Run(service);
                return;
            }

            var initializer = new Initializer(workingDir);

            if (!initializer.Initialize(args))
            {
                return;
            }

            initializer.Run();
        }