Esempio n. 1
0
        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        internal int SetReadOnly(
            Interpreter interpreter,
            string pattern,
            bool readOnly
            )
        {
            int result = 0;

            foreach (KeyValuePair <string, IVariable> pair in this)
            {
                IVariable variable = pair.Value;

                if (variable == null)
                {
                    continue;
                }

                if (EntityOps.IsUndefined(variable))
                {
                    continue;
                }

                string name = variable.Name;

                if ((pattern == null) || StringOps.Match(
                        interpreter, StringOps.DefaultMatchMode,
                        name, pattern, false))
                {
                    if (EntityOps.IsReadOnly(variable) == readOnly)
                    {
                        continue;
                    }

                    if (EntityOps.SetReadOnly(variable, readOnly))
                    {
                        result++;
                    }
                }
            }

            return(result);
        }