From 42245749b3dbbaf83c7c7ea1bdff2adf7b55e04b Mon Sep 17 00:00:00 2001 From: Emiliana <38952746+emilianavt@users.noreply.github.com> Date: Fri, 21 Aug 2020 22:07:12 +0200 Subject: [PATCH] Added convenience functions for command line argument setting to `OpenSeeLauncher`. --- Unity/OpenSeeLauncher.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Unity/OpenSeeLauncher.cs b/Unity/OpenSeeLauncher.cs index 3944823..e8f8862 100644 --- a/Unity/OpenSeeLauncher.cs +++ b/Unity/OpenSeeLauncher.cs @@ -79,6 +79,30 @@ public class OpenSeeLauncher : MonoBehaviour { private System.IntPtr processStdOut = System.IntPtr.Zero; private System.IntPtr processStdErr = System.IntPtr.Zero; private Job job = null; + + public void UnsetOption(string name, bool hasArgument) { + int count = 1; + if (hasArgument) + count++; + int found = -1; + int i = 0; + foreach (string arg in commandlineOptions) { + if (arg == name) { + found = i; + break; + } + i++; + } + if (found > -1) + commandlineOptions.RemoveRange(found, count); + } + + public void SetOption(string name, string argument) { + UnsetOption(name, argument != null); + commandlineOptions.Add(name); + if (argument != null) + commandlineOptions.Add(name); + } private bool CheckSetup(bool requireTarget) { if (openSeeTarget == null)