idTech4.idCmdArgs.AppendArg C# (CSharp) Method

AppendArg() public method

public AppendArg ( string text ) : void
text string
return void
		public void AppendArg(string text)
		{
			if(this.Length == 0)
			{
				_args = new string[] { text };
			}
			else
			{
				List<string> args = new List<string>(_args);
				args.Add(text);

				_args = args.ToArray();
			}
		}

Usage Example

Example #1
0
		private void ParseCommandLine(string[] args)
		{
			List<idCmdArgs> argList = new List<idCmdArgs>();
			idCmdArgs current = null;

			foreach(string arg in args)
			{
				if(arg.StartsWith("+") == true)
				{
					current = new idCmdArgs();
					current.AppendArg(arg.Substring(1));

					argList.Add(current);
				}
				else
				{
					if(current == null)
					{
						current = new idCmdArgs();
						argList.Add(current);
					}

					current.AppendArg(arg);
				}
			}

			_commandLineArguments = argList.ToArray();
		}