protected override void OnInsertComplete(int index, object value) { base.OnInsertComplete(index, value); CmdLineArg arg = (CmdLineArg)value; argsMap.Add(arg.Name, arg); }
protected override void OnRemoveComplete(int index, object value) { base.OnRemoveComplete(index, value); CmdLineArg arg = (CmdLineArg)value; argsMap.Remove(arg.Name); }
// public methods... /// <summary> /// Adds new command line argument. /// </summary> /// <param name="arg">The argument to add.</param> /// <returns>The index of newly added argument.</returns> public int Add(CmdLineArg arg) { if (arg == null) { return(-1); } argsMap.Add(arg.Name, arg); return(InnerList.Add(arg)); }
protected override void OnSetComplete(int index, object oldValue, object newValue) { base.OnSetComplete(index, oldValue, newValue); CmdLineArg oldArg = (CmdLineArg)oldValue; CmdLineArg newArg = (CmdLineArg)newValue; argsMap.Remove(oldArg.Name); argsMap.Add(newArg.Name, newArg); }
// public methods... /// <summary> /// Parsers the given command line arguments. /// </summary> /// <param name="args">The arguments to parse.</param> /// <returns>CmdLineArgs instance.</returns> public virtual CmdLineArgs Parse(string[] args) { CmdLineArgs arguments = new CmdLineArgs(); if (args == null) { return(arguments); } int count = args.Length; for (int i = 0; i < count; i++) { CmdLineArg arg = Parse(args[i]); if (arg != null) { arguments.Add(arg); } } return(arguments); }