Esempio n. 1
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser)
        {
            string xpath = "";

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

            string text = "";

            if (Parameters[1].Type == CefType.StringLiteral)
            {
                text = Parameters[1].Name;
            }
            else
            {
                throw new CefTypeException("Can't convert " + Parameters[1].Type.ToString() + " to String");
            }


            var result = new Types.String(this.GetType().Name, xpath);
            await Browser.Enter(xpath, text);

            return(result);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
        {
            if (!Parameters[1].IsNumberLiteral())
            {
                throw new CefTypeException(Parameters[1].Name + " is not a number " + this.ToString());
            }

            return(Types.Variable.Create(Parameters[0].Name, Convert.ToInt32(Parameters[1].Name)));
        }
Esempio n. 4
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
        {
            if (!(Parameters[1].Type == CefType.StringLiteral))
            {
                throw new CefTypeException(Parameters[1].Name + " is not a string " + this.ToString());
            }

            return(Types.Variable.Create(Parameters[0].Name, Parameters[1].Name));
        }
Esempio n. 5
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
        {
            Types.Variable result = null;
            if (Parameters[0].Type == CefType.NumberLiteral || Parameters[0].Type == CefType.StringLiteral)
            {
                result = new Types.String(this.GetType().Name, Parameters[0].ToString());
            }
            else
            {
                throw new CefTypeException("Can't convert " + Parameters[0].Type.ToString() + " to String");
            }

            return(result);
        }
Esempio n. 6
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser)
        {
            string xpath = "";

            if (Parameters[0].Type == CefType.StringLiteral)
            {
                xpath = Convert.ToString(Parameters[0].Name);
            }
            else
            {
                throw new CefTypeException("Can't convert " + Parameters[0].Type.ToString() + " to StringLiteral");
            }

            string res = await Browser.GetInnerHTML(xpath);

            return(Types.Variable.Create(this.GetType().Name, res));
        }
Esempio n. 7
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser)
        {
            int n = 1000;

            if (Parameters[0].Type == CefType.NumberLiteral)
            {
                n = Convert.ToInt32(Parameters[0].Name);
            }
            else
            {
                throw new CefTypeException("Can't convert " + Parameters[0].Type.ToString() + " to Number");
            }

            await Browser.Wait(n);

            return(null);
        }
Esempio n. 8
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser)
        {
            string url;

            if (Parameters[0].Type == CefType.StringLiteral)
            {
                url = Parameters[0].Name;
            }
            else
            {
                throw new CefTypeException("Can't convert " + Parameters[0].Type.ToString() + " to String");
            }
            var result = new Types.String(this.GetType().Name, url);
            await Browser.Click(url);

            return(result);
        }
Esempio n. 9
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
        {
            string message = "";

            foreach (var parameter in Parameters)
            {
                if (parameter.Type == CefType.StringLiteral)
                {
                    message += parameter.Name;
                }
                else
                {
                    throw new CefTypeException("Can't convert " + parameter.Type + " to String");
                }
            }

            return(Types.Variable.Create(this.GetType().Name, message));
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
        {
            Types.Variable res = null;
            if (Parameters[0].Type == CefType.NumberLiteral)
            {
                int parami = 0;
                try
                {
                    parami = Convert.ToInt32(Parameters[0].Name);
                }
                catch { }
                if (parami == 0)
                {
                    res = Types.Variable.Create(this.GetType().Name, 0);
                }
                else
                {
                    res = res = Types.Variable.Create(this.GetType().Name, 1);
                }
            }
            else if (Parameters[0].Type == CefType.StringLiteral)
            {
                if (System.String.IsNullOrWhiteSpace(Parameters[0].ToString()))
                {
                    res = Types.Variable.Create(this.GetType().Name, 0);
                }
                else
                {
                    res = res = Types.Variable.Create(this.GetType().Name, 1);
                }
            }
            else
            {
                throw new CefTypeException(Parameters[0].Name + " is not a number/string " + this.ToString());
            }

            return(res);
        }
Esempio n. 12
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser)
        {
            int n = 1000;



            string xpath = "";

            if (Parameters[0].Type == CefType.StringLiteral)
            {
                xpath = Convert.ToString(Parameters[0].Name);
            }
            else
            {
                throw new CefTypeException("Can't convert " + Parameters[0].Type.ToString() + " to StringLiteral");
            }

            await Browser.WaitForElement(xpath);



            return(null);
        }
Esempio n. 13
0
 public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
 {
     System.Media.SoundPlayer snd = new System.Media.SoundPlayer("sounds/beep.wav");
     snd.Play();
     return(null);
 }
Esempio n. 14
0
 public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser = null)
 {
     return(null);
 }
Esempio n. 15
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser)
        {
            await Browser.Reload();//////////////////////////////////////////////////////////////////////////////

            return(null);
        }
Esempio n. 16
0
        public async override Task <Types.Variable> Exec(CefPreter.IBrowser Browser)
        {
            await Browser.GoForward();

            return(null);
        }