Exemplo n.º 1
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
        {
            Types.Variable result = null;
            if (Parameters[0].Type == CefType.NumberLiteral && Parameters[1].Type == CefType.NumberLiteral)
            {
                if (Convert.ToInt32(Parameters[0].Name) == Convert.ToInt32(Parameters[1].Name))
                {
                    result = new Types.Number(this.GetType().Name, 1);
                }
                else
                {
                    result = new Types.Number(this.GetType().Name, 0);
                }
            }
            else if (Parameters[0].Type == CefType.StringLiteral && Parameters[1].Type == CefType.StringLiteral)
            {
                if (String.Compare(Parameters[0].Name, Parameters[1].Name) == 0)
                {
                    result = new Types.Number(this.GetType().Name, 1);
                }
                else
                {
                    result = new Types.Number(this.GetType().Name, 0);
                }
            }

            else
            {
                throw new CefTypeException("Can't convert " + Parameters[0].Type.ToString() + " to String");
            }

            return(result);
        }
Exemplo n.º 2
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
        {
            Types.Variable result = null;
            if (Parameters[0].Type == CefType.StringLiteral)
            {
                string a = Regex.Match(Parameters[0].ToString(), @"(\d+)").Groups[1].Value;
                int    r = Convert.ToInt32(a);
                result = new Types.Number(this.GetType().Name, r);
            }
            else if (Parameters[0].Type == CefType.NumberLiteral)
            {
                result = new Types.Number(this.GetType().Name, Convert.ToInt32(Parameters[0]));
            }
            else
            {
                throw new CefTypeException("Can't convert " + Parameters[0].Type.ToString() + " to String");
            }

            return(result);
        }