コード例 #1
0
        public static void SetField(string name, object value, ScriptRoutineCheckContext context = 0)
        {
            if (context == ScriptRoutineCheckContext.Fields)
            {
                for (int i = 0; i < Fields.Count; i++)
                {
                    var field = Fields [i];
                    if (field.Name == name)
                    {
                        field = CODE_READER.SetFieldValue(field, value);
                    }
                    Fields[i] = field;
                }

                for (int i = 0; i < EnvironmentFields.Count; i++)
                {
                    var field = EnvironmentFields [i];
                    if (field.Name == name)
                    {
                        field = CODE_READER.SetFieldValue(field, value);
                    }
                    EnvironmentFields[i] = field;
                }
            }
            if (context == ScriptRoutineCheckContext.ScriptFields)
            {
                for (int i = 0; i < ScriptFields.Count; i++)
                {
                    var field = ScriptFields [i];
                    if (field.Name == name)
                    {
                        field = CODE_READER.SetFieldValue(field, value);
                    }
                    ScriptFields[i] = field;
                }
            }
            if (context == ScriptRoutineCheckContext.StaticFields)
            {
                for (int i = 0; i < StaticFields.Count; i++)
                {
                    var field = StaticFields [i];
                    if (field.Name == name)
                    {
                        field = CODE_READER.SetFieldValue(field, value);
                    }
                    StaticFields[i] = field;
                }
                for (int i = 0; i < EnvironmentFields.Count; i++)
                {
                    var field = EnvironmentFields [i];
                    if (field.Name == name)
                    {
                        field = CODE_READER.SetFieldValue(field, value);
                    }
                    EnvironmentFields[i] = field;
                }
            }
        }
コード例 #2
0
        public static void AutoExecuteCode(string code)
        {
            code = CodeTranslator.TranslateCode(code);
            CODE_READER.CheckLanguageRoutines(code, 0);
            var name = CODE_READER.GetCodeDeclaration(code);
            var args = CODE_READER.GetReads(code);

            args = CorrectArgs(name, args);
            ExecuteCode(name, args);
        }