public override bool FromScriptVariable(SequenceProcEnv environment, ScriptVariable variable, ref string errorMessage)
        {
            if (variable.IsNull())
            {
                errorMessage = global::MotionDataHandler.Properties.Settings.Default.Msg_CannotSpecifyNull + ": " + this.ParamName;
                return(false);
            }
            this.Value = new Dictionary <string, string>();
            IList <ScriptVariable> list = variable.ToList();

            foreach (ScriptVariable row in list)
            {
                if (row.IsNull())
                {
                    continue;
                }
                IList <ScriptVariable> pair = row.ToList();
                if (pair.Count < 2)
                {
                    errorMessage = "各要素に二つの文字列が必要です";
                    return(false);
                }
                if (pair[0].IsNull() || pair[1].IsNull())
                {
                    errorMessage = "要素の文字列にnullを指定できません";
                    return(false);
                }
                this.Value[pair[0].ToString()] = pair[1].ToString();
            }
            return(true);
        }
예제 #2
0
        private ScriptVariable lengthOf(ScriptVariable arg)
        {
            if (arg.IsNull())
            {
                return(null);
            }
            switch (arg.Type)
            {
            case ScriptVariableType.String:
                return(new NumberVariable(arg.ToString().Length));

            case ScriptVariableType.List:
                return(new NumberVariable(arg.ToList().Count));
            }
            return(null);
        }
예제 #3
0
        public override bool FromScriptVariable(MotionProcEnv environment, ScriptVariable variable, ref string errorMessage)
        {
            if (variable.IsNull())
            {
                errorMessage = global::MotionDataHandler.Properties.Settings.Default.Msg_CannotSpecifyNull;
                return(false);
            }
            string name = variable.ToString();

            MotionObjectInfo info = environment.DataSet.GetObjectInfoByName(name);

            if (info == null)
            {
                errorMessage = global::MotionDataHandler.Properties.Settings.Default.Msg_ObjectNotFound + ": " + name;
                return(false);
            }
            this.Value = info;
            return(true);
        }
        public override bool FromScriptVariable(SequenceProcEnv environment, ScriptVariable variable, ref string errorMessage)
        {
            if (variable.IsNull())
            {
                errorMessage = global::MotionDataHandler.Properties.Settings.Default.Msg_CannotSpecifyNull + ": " + this.ParamName;
                return(false);
            }
            IList <ScriptVariable> list = variable.ToList();

            while (this.Value.Count <= list.Count)
            {
                this.Value.Add(0);
            }

            int index = 0;

            foreach (ScriptVariable row in list)
            {
                if (row.IsNull())
                {
                    this.Value[index] = 0;
                }
                else
                {
                    decimal value = row.ToNumber();
                    this.Value[index] = value;
                }
                index++;
            }
            if (index < this.NumberOfArgs)
            {
                errorMessage = string.Format("{0} 個の数値が必要です", this.NumberOfArgs);
                return(false);
            }
            return(true);
        }