Example #1
0
        private string GetArgument(string opName, string friendlyInterpretation)
        {
            string value = "";

            if (friendlyInterpretation == null)
            {
                return(value);
            }

            Arguments argument;

            if (opName.Contains("FAST"))
            {
                argument = ArgumentsList.Where((Arguments x) => x.OpName.Contains("FAST") && x.Value.Equals(friendlyInterpretation)).LastOrDefault();
            }
            else
            {
                argument = ArgumentsList.Where((Arguments x) => x.OpName.Equals(opName) && x.Value.Equals(friendlyInterpretation)).LastOrDefault();
            }

            if (argument != null)
            {
                return(argument.Argument);
            }

            Arguments lastValue;

            if (opName.Contains("FAST"))
            {
                lastValue = ArgumentsList.Where(x => x.OpName.Contains("FAST")).LastOrDefault();
                value     = lastValue == null ? "0" : (int.Parse(lastValue.Argument) + 1).ToString();
            }
            else
            {
                if (opName.Contains("CONST"))
                {
                    lastValue = ArgumentsList.Where(x => x.OpName.Equals(opName)).LastOrDefault();
                    value     = lastValue == null ? "1" : (int.Parse(lastValue.Argument) + 1).ToString();
                }
                else if (opName.Contains("COMPARE"))
                {
                    lastValue = ArgumentsList.Where(x => x.OpName.Equals(opName)).LastOrDefault();
                    value     = lastValue == null ? "0" : (int.Parse(lastValue.Argument) + 1).ToString();
                }
            }

            argument = new Arguments
            {
                OpName   = opName,
                Value    = friendlyInterpretation,
                Argument = value
            };

            ArgumentsList.Add(argument);

            return(value);
        }
Example #2
0
        // routine to read 'value' part of 'name=value' pair if it is object ([type,name=value,...])
        protected bool getParsObject(out object val)
        {
            string typeName;

            val = null;

            if ('[' == _text[_pos])
            {
                _pos++; // pass '['
            }
            if (!getParsStr(false, out typeName))
            {
                return(false);
            }

            if (!_creators.ContainsKey(typeName))
            {
                return(false);
            }

            var    argsList = new ArgumentsList();
            string fieldName;
            object fieldValue;

            while (getParsField(out fieldName, out fieldValue))
            {
                argsList.Add(fieldName, fieldValue);
            }

            if (']' == _text[_pos])
            {
                _pos++; // pass ']'
            }
            try {
                val = _creators[typeName](argsList);
            } catch {
                val = null;
                return(false);
            }

            return(true);
        }
Example #3
0
        /// <summary>
        /// get the argument list from the command - either from the operation or from the menu entry
        /// </summary>
        /// <param name="command"></param>
        /// <param name="menuEntry"></param>
        /// <param name="mainProg"></param>
        /// <returns></returns>
        private ArgumentsList GetCommandArgumentList(IClientCommand command, MenuEntryProgram menuEntry, Task mainProg)
        {
            ExecOperCommand cmd = command as ExecOperCommand;

            ArgumentsList argList = null;

            if (cmd != null && cmd.Operation != null)
            {
                argList = cmd.Operation.GetArgList();
            }
            else if (menuEntry.MainProgVars != null)
            {
                argList = new ArgumentsList();
                foreach (String item in menuEntry.MainProgVars)
                {
                    Argument argument = new Argument();
                    argument.fillDataByMainProgVars(item, mainProg);
                    argList.Add(argument);
                }
            }

            return(argList);
        }
Example #4
0
 public void AddArgument(string key, string value)
 {
     ArgumentsList.Add(new KeyValuePair <string, string>(key, value));
 }
Example #5
0
 public ArgumentsList CreateArgumentList(string sortExpression, Int32 maximumRows, Int32 startRowIndex, String cultureValue)
 {
     ArgumentsList _arg = new ArgumentsList();
     _arg.Add(new ArgumentsListItem("Sort", sortExpression));
     _arg.Add(new ArgumentsListItem("PageSize", maximumRows.ToString()));
     _arg.Add(new ArgumentsListItem("PageNumber", startRowIndex.ToString()));
     _arg.Add(new ArgumentsListItem("CultureName", cultureValue));
     return _arg;
 }