Esempio 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);
        }
Esempio n. 2
0
        public static TypeMeta Get(Types.Variable var, Types.Type type)
        {
            TypeMeta v = new TypeMeta(var);

            type.Accept(v);
            return(v);
        }
Esempio n. 3
0
 public Log(Types.Bean bean, System.IO.StreamWriter sw, Types.Variable var, string prefix)
 {
     this.bean   = bean;
     this.sw     = sw;
     this.var    = var;
     this.prefix = prefix;
 }
Esempio n. 4
0
        public static string GetDefault(Types.Variable var)
        {
            Default def = new Default(var);

            var.VariableType.Accept(def);
            return(def.Value);
        }
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 = 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. 7
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. 8
0
 public Property(System.IO.StreamWriter sw, Types.Variable var, string prefix)
 {
     this.sw     = sw;
     this.var    = var;
     this.prefix = prefix;
 }
Esempio n. 9
0
 public Equal(Variable var, string another, bool isEquals)
 {
     this.var      = var;
     this.another  = another;
     this.isEquals = isEquals;
 }
Esempio n. 10
0
 public Construct(System.IO.StreamWriter sw, Types.Variable variable, String prefix)
 {
     this.sw       = sw;
     this.variable = variable;
     this.prefix   = prefix;
 }
Esempio n. 11
0
 private Default(Types.Variable var)
 {
     this.variable = var;
 }