public override bool FromScriptVariable(SequenceProcEnv environment, ScriptVariable variable, ref string errorMessage)
        {
            SequenceData parent = environment.SelectedSequence;

            if (this.Parent != null && this.Parent.Value != null)
            {
                parent = this.Parent.Value;
            }
            switch (variable.Type)
            {
            case ScriptVariableType.Number:
                int index = variable.ToInteger();
                if (index < 0 || index >= parent.Values.ColumnCount)
                {
                    errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_IndexOutOfRange + ": " + index.ToString();
                    return(false);
                }
                this.Value = index;
                return(true);

            case ScriptVariableType.String:
                string name   = variable.ToString();
                int    index2 = -1;
                for (int i = 0; i < parent.Values.ColumnNames.Length; i++)
                {
                    if (parent.Values.ColumnNames[i] == name)
                    {
                        index2 = i;
                        break;
                    }
                }
                if (index2 == -1)
                {
                    errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_ColumnNameNotFound;
                    return(false);
                }
                this.Value = index2;
                return(true);

            default:
                errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_SpecifyIndexOfColumnOrColumnName;
                return(false);
            }
        }
        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);
        }
Esempio n. 3
0
 public override bool FromScriptVariable(TEnvironment environment, ScriptVariable variable, ref string errorMessage)
 {
     this.Value = variable.ToString();
     return(true);
 }