Fusion.Core.Shell.Invoker.Push C# (CSharp) Method

Push() public method

Parses and pushes command to the queue.
public Push ( string commandLine ) : Command
commandLine string
return Command
		public Command Push ( string commandLine )
		{				  
			var argList	=	CommandLineParser.SplitCommandLine( commandLine ).ToArray();

			if (!argList.Any()) {
				throw new CommandLineParserException("Empty command line.");
			} 



			var cmdName	=	argList[0];
			argList		=	argList.Skip(1).ToArray();
			

			lock (lockObject) {

				ConfigVariable variable;

				if (Variables.TryGetValue( cmdName, out variable )) {
					if (argList.Count()==0) {
						Log.Message("{0} = {1}", variable.FullName, variable.Get() );
						return null;
					} else {
						return Push( string.Format("set {0} \"{1}\"", cmdName, string.Join(" ", argList) ) );
					}
				}
				var command	=	GetCommand( cmdName );

				var parser	=	new CommandLineParser( command, cmdName );

				if (!parser.ParseCommandLine( argList )) {
					throw new CommandLineParserException("Failed to parse command line");
				}

				Push( command );

				return command;
			}
		}

Same methods

Invoker::Push ( Command command ) : void