示例#1
0
        public void Dispose()
        {
            try
            {
                nitroxEntryPatch.Remove();
            }
            catch (Exception)
            {
                // Ignored
            }

            gameProcess?.Dispose();
            serverProcess?.Dispose();
        }
示例#2
0
文件: Main.cs 项目: yawaraka/Nitrox
        private void MultiplayerButton_Click(object sender, EventArgs e)
        {
            string subnauticaPath = "";

            if (ErrorConfiguringLaunch(ref subnauticaPath))
            {
                return;
            }

            if (PirateDetection.IsPirate(subnauticaPath))
            {
                PirateDetected();
                return;
            }

            SyncAssembliesBetweenSubnauticaManagedAndLib(subnauticaPath);

            NitroxEntryPatch nitroxEntryPatch = new NitroxEntryPatch(subnauticaPath);

            nitroxEntryPatch.Remove(); // Remove any previous instances first.
            nitroxEntryPatch.Apply();

            StartSubnautica(subnauticaPath);

            //TODO: maybe an async callback to remove when the app closes.
        }
示例#3
0
        private void SinglePlayerButton_Click(object sender, EventArgs e)
        {
            string subnauticaPath = "";

            if (ErrorConfiguringLaunch(ref subnauticaPath))
            {
                return;
            }

            if (PirateDetection.IsPirate(subnauticaPath))
            {
                PirateDetected();
                return;
            }

            SyncAssembliesBetweenSubnauticaManagedAndLib(subnauticaPath);

            NitroxEntryPatch nitroxEntryPatch = new NitroxEntryPatch(subnauticaPath);

            nitroxEntryPatch.Remove();

            string subnauticaExe = Path.Combine(subnauticaPath, "Subnautica.exe");

            Process.Start(subnauticaExe);
        }
示例#4
0
        internal void StartMultiplayer()
        {
            gameStarting = true;
            string subnauticaPath = "";

            if (ErrorConfiguringLaunch(ref subnauticaPath))
            {
                return;
            }

            if (PirateDetection.IsPirate(subnauticaPath))
            {
                if (PirateDetectedEvent != null)
                {
                    PirateDetectedEvent(this, new EventArgs());
                }
                return;
            }

            SyncAssembliesBetweenSubnauticaManagedAndLib(subnauticaPath);

            NitroxEntryPatch nitroxEntryPatch = new NitroxEntryPatch(subnauticaPath);

            nitroxEntryPatch.Remove(); // Remove any previous instances first.
            nitroxEntryPatch.Apply();

            StartSubnautica(subnauticaPath);
            Thread thread = new Thread(new ThreadStart(AsyncGetProcess));

            thread.Start();
        }
示例#5
0
        internal void StartSingleplayer()
        {
            string subnauticaPath = "";

            if (ErrorConfiguringLaunch(ref subnauticaPath))
            {
                return;
            }

            if (PirateDetection.IsPirate(subnauticaPath))
            {
                if (PirateDetectedEvent != null)
                {
                    PirateDetectedEvent(this, new EventArgs());
                }
                return;
            }
            SyncAssembliesBetweenSubnauticaManagedAndLib(subnauticaPath);

            NitroxEntryPatch nitroxEntryPatch = new NitroxEntryPatch(subnauticaPath);

            nitroxEntryPatch.Remove();

            StartSubnautica(subnauticaPath);
        }
示例#6
0
        internal void StartMultiplayer()
        {
            string subnauticaPath = "";

            if (ErrorConfiguringLaunch(ref subnauticaPath))
            {
                return;
            }

            if (PirateDetection.IsPirate(subnauticaPath))
            {
                if (PirateDetectedEvent != null)
                {
                    PirateDetectedEvent(this, new EventArgs());
                }
                return;
            }

            SyncAssembliesBetweenSubnauticaManagedAndLib(subnauticaPath);

            NitroxEntryPatch nitroxEntryPatch = new NitroxEntryPatch(subnauticaPath);

            nitroxEntryPatch.Remove(); // Remove any previous instances first.
            nitroxEntryPatch.Apply();

            StartSubnautica(subnauticaPath);

            //TODO: maybe an async callback to remove when the app closes.
        }
示例#7
0
        public void Dispose()
        {
            Application.Current.MainWindow?.Hide();

            try
            {
                nitroxEntryPatch.Remove();
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Error while disposing the launcher");
            }

            gameProcess?.Dispose();
            Server?.Dispose();
            LauncherNotifier.Shutdown();
        }
示例#8
0
        public void RemovePatches()
        {
            NitroxEntryPatch nitroxPatch = new NitroxEntryPatch(SubnauticaAssembliesPath);

            if (nitroxPatch.IsApplied)
            {
                nitroxPatch.Remove();
            }
        }
示例#9
0
        private void OnSubnauticaExited(object sender, EventArgs e)
        {
            gameStarting = false;
            string subnauticaPath = "";

            Optional <string> installation = GameInstallationFinder.Instance.FindGame(new List <string>());

            if (!installation.IsPresent())
            {
                MessageBox.Show("Please configure your Subnautica location in settings.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            subnauticaPath = installation.Get();

            NitroxEntryPatch nitroxEntryPatch = new NitroxEntryPatch(subnauticaPath);

            nitroxEntryPatch.Remove();
            Log.Info("Finished removing patches!");
        }
示例#10
0
        public static ActionResult UninstallPatch(Session session)
        {
            session.Log("Begin uninstall");

            try
            {
                string           managedDirectory = session.CustomActionData["MANAGEDDIR"];
                NitroxEntryPatch nitroxPatch      = new NitroxEntryPatch(managedDirectory);

                if (nitroxPatch.IsApplied)
                {
                    nitroxPatch.Remove();
                }
            }
            catch (Exception ex)
            {
                session.Log(ex.Message);
                return(ActionResult.Failure);
            }

            return(ActionResult.Success);
        }