Ejemplo n.º 1
0
        protected override void OnInsertComplete(int index, object value)
        {
            base.OnInsertComplete(index, value);
            CmdLineArg arg = (CmdLineArg)value;

            argsMap.Add(arg.Name, arg);
        }
Ejemplo n.º 2
0
        protected override void OnRemoveComplete(int index, object value)
        {
            base.OnRemoveComplete(index, value);
            CmdLineArg arg = (CmdLineArg)value;

            argsMap.Remove(arg.Name);
        }
Ejemplo n.º 3
0
 // 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));
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        // 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);
        }