public override List <AbstractParameter> GetParameters(IController hud)
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <int> .of(nameof(range), x => range = x)
     });
 }
        // Builds an argument for the constructor.
        public static void BuildArgument(IronyParser parser, Constructor method, ParseTreeNode node)
        {
            // Check for a directioned argument (out, ref).
            if (node.Term.ToString() == "out_parameter")
            {
                var a = new DirectionedParameter(null, node.FindToken().Convert());
                switch (node.ChildNodes[0].ChildNodes[0].Term.ToString())
                {
                case "ref":
                    a.Direction = ParameterDirection.Ref;
                    break;

                case "out":
                    a.Direction = ParameterDirection.Out;
                    break;
                }
                a.TypeName = parser.CheckAlias(node.ChildNodes[1].FindTokenAndGetText());
                a.Name     = node.ChildNodes[2].FindTokenAndGetText();
                method.Parameters.Add(a);
            }
            else
            {
                // Build an undirectioned argument.
                var a = new SimpleParameter(null, node.FindToken().Convert());
                a.TypeName = parser.CheckAlias(node.ChildNodes[0].FindTokenAndGetText());
                a.Name     = node.ChildNodes[1].FindTokenAndGetText();
                method.Parameters.Add(a);
            }
        }
Beispiel #3
0
        protected IParameter GetParameters()
        {
            IParameter p = DerivedFrom.CustomParameters;

            if (!DerivedFrom.IsStatic)
            {
                // parameters for a node will be where the Subject at this level is filtered by ID = this node's ID.
                // Nodes below this one should filter correctly with this parameter if the configuration has been set up correctly.
                var p2 = new SimpleParameter(DerivedFrom.Subject.IdField, "=", ID);

                // we also want to combine any custom parameters that this node might have
                if (p != null)
                {
                    var c = new Conjunction()
                            .Parameter(p)
                            .Parameter(p2);
                    p = c;
                }
                else
                {
                    p = p2;
                }
            }

            return(p);
        }
Beispiel #4
0
        public void TransferDoubleOwnerBalanceToRecipient()
        {
            var amount = new SimpleParameter(0);


            var fromStartingBalance = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _ownerParameter);
            var toStartingBalance   = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _nonOwnerParameter);


            amount.Value = fromStartingBalance * 2; //way over what the sender has in their posession


            var messages = _contract.InvokeBlockchainMethod("transfer", _ownerParameter, _nonOwnerParameter, amount);

            //ensure the transfer event was not fired
            if (messages.FindMessagesThatStartWith("transfer").Count != 0)
            {
                Assert.Fail("Transfer event should not have fired but it did");
            }


            var fromPostTransferBalance = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _ownerParameter);
            var toPostTransferBalance   = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _nonOwnerParameter);

            Assert.AreEqual(fromStartingBalance, fromPostTransferBalance, "From balance");
            Assert.AreEqual(toStartingBalance, toPostTransferBalance, "To balance");
        }
Beispiel #5
0
        public void BalanceOf_GetNonExistantAccountBalance()
        {
            var param   = new SimpleParameter(new UInt160(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })); //20 digit address but all zeroos
            var balance = _contract.InvokeLocalMethod <BigInteger>("balanceOf", param);

            Assert.AreEqual(new BigInteger(0), balance);
        }
Beispiel #6
0
 public override List <AbstractParameter> GetParameters()
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <bool> .of(nameof(Vitality), x => Vitality = x)
     });
 }
Beispiel #7
0
 public override List <AbstractParameter> GetParameters()
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <int> .of(nameof(HealthPercent), x => HealthPercent = x)
     });
 }
Beispiel #8
0
        /// <summary>
        ///     <para>Initializes a new instance of the <see cref="MsilWriter"/> class.</para>
        /// </summary>
        /// <param name="method">The dynamic method to write to.</param>
        public MsilWriter(DynamicMethod method)
        {
            var parameters = method.GetParameters();

            _methodHeader = new MethodHeader
            {
                Attributes     = method.CallingConvention,
                DeclaringType  = method.DeclaringType,
                ParameterTypes = method.GetParameters()
                                 .Select <ParameterInfo, Type>(p => p.ParameterType)
                                 .ToArray <Type>(),
                ReturnType = method.ReturnType ?? typeof(void)
            };
            _parameters = new SimpleParameter[parameters.Length];
            int positionOffset = method.IsStatic ? 0 : 1;

            for (int i = 0; i < parameters.Length; ++i)
            {
                _parameters[i] = new SimpleParameter(
                    this,
                    parameters[i].Position + positionOffset,
                    parameters[i].ParameterType,
                    null);
            }
            _ilGenerator = method.GetILGenerator();
        }
Beispiel #9
0
        /// <summary>
        /// Set a piwik user preference
        /// </summary>
        /// <param name="userLogin"></param>
        /// <param name="preferenceName"></param>
        /// <param name="preferenceValue"></param>
        /// <returns>Hashtable containing the result message</returns>
        public Hashtable setUserPreference(
            string userLogin,
            string preferenceName,
            object preferenceValue)
        {
            SimpleParameter valueParameter = null;
            Type            pType          = preferenceValue.GetType();

            switch (pType.Name)
            {
            case "String":
                valueParameter = new SimpleParameter("preferenceValue", (string)preferenceValue);
                break;

            case "Int32":
                valueParameter = new SimpleParameter("preferenceValue", (int)preferenceValue);
                break;

            default:
                throw new Exception("preferenceValue must be int or string");
            }

            Parameter[] parameters =
            {
                new SimpleParameter("userLogin",      userLogin),
                new SimpleParameter("preferenceName", preferenceName),
                valueParameter
            };

            return(this.sendRequest <Hashtable>("setUserPreference", new List <Parameter>(parameters)));
        }
 public override List <AbstractParameter> GetParameters(IController hud)
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <int> .of(nameof(minimumResourcePercent), x => minimumResourcePercent = x)
     });
 }
 public override List <AbstractParameter> GetParameters(IController hud)
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <int> .of(nameof(playerCountInParty), x => playerCountInParty = x)
     });
 }
Beispiel #12
0
        public SysConfig GetConfigById(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "v_id", Value = id
            };

            return(DBHelper <SysConfig> .SelectSingle(tableName, "*", s));
        }
Beispiel #13
0
        public int GetAnswerCountByQuestionId(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "questionId", Value = id
            };

            return(DBHelper <int> .SelectExecute(tableName, s));
        }
Beispiel #14
0
        public List <CommentInfo> GetCommentInfoByContentId(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "contentId", Value = id
            };

            return(DBHelper <CommentInfo> .Select(tableName, "*", s));
        }
Beispiel #15
0
        public CommentInfo GetCommentInfoById(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "id", Value = id
            };

            return(DBHelper <CommentInfo> .SelectSingle(tableName, "*", s));
        }
Beispiel #16
0
 public override List <AbstractParameter> GetParameters()
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <bool> .of(nameof(GreaterRift), x => GreaterRift = x),
         SimpleParameter <bool> .of(nameof(Empowered), x => Empowered = x),
     });
 }
Beispiel #17
0
        public List <CmContent> GetContentByCateId(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "cateId", Value = id
            };

            return(DBHelper <CmContent> .Select(tableName, "*", s));
        }
Beispiel #18
0
        public CmContent GetContentById(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "id", Value = id
            };

            return(DBHelper <CmContent> .SelectSingle(tableName, "*", s));
        }
Beispiel #19
0
        public List <CategoryProduct> GetProductByCategoryId(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "cateid", Value = id
            };

            return(DBHelper <CategoryProduct> .Select(tableName, "*", s));
        }
Beispiel #20
0
 public override List <AbstractParameter> GetParameters(IController hud)
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <int> .of(nameof(MinimumAmount), x => MinimumAmount = x),
         SimpleParameter <int> .of(nameof(Range), x => Range = x)
     });
 }
Beispiel #21
0
        public Solution GetSolutionById(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "id", Value = id
            };

            return(DBHelper <Solution> .SelectSingle(TABLE_NAME, FIELDS, s));
        }
Beispiel #22
0
        public Answers GetAnswerById(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "id", Value = id
            };

            return(DBHelper <Answers> .SelectSingle(tableName, "*", s));
        }
Beispiel #23
0
        public ProductTry GetTryById(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "id", Value = id
            };

            return(DBHelper <ProductTry> .SelectSingle(tableName, Fields, s));
        }
Beispiel #24
0
        public List <ProductTry> GetTryByProductId(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "productId", Value = id
            };

            return(DBHelper <ProductTry> .Select(tableName, Fields, s));
        }
Beispiel #25
0
        public List <ProductSolution> GetProductIdsBySolutionId(int solutionId)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "psId", Value = solutionId
            };

            return(DBHelper <ProductSolution> .Select(tableName, "*", s));
        }
Beispiel #26
0
        public ProductSolution GetSolutionById(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "id", Value = id
            };

            return(DBHelper <ProductSolution> .SelectSingle(tableName, "*", s));
        }
Beispiel #27
0
 public override List <AbstractParameter> GetParameters()
 {
     return(new List <AbstractParameter>
     {
         SimpleParameter <bool> .of(nameof(Yellows), x => Yellows = x),
         SimpleParameter <bool> .of(nameof(Blues), x => Blues = x),
         SimpleParameter <bool> .of(nameof(Whites), x => Whites = x)
     });
 }
Beispiel #28
0
        public List <ProductSolution> GetSolutionByProductId(int id)
        {
            SimpleParameter s = new SimpleParameter {
                Name = "productId", Value = id
            };

            //string sql = string.Format("select * from pm_solution_product where productId = {0}", id);
            return(DBHelper <ProductSolution> .Select(tableName, "*", s));
        }
Beispiel #29
0
        public MemberInfo GetMemberByName(string name)
        {
            SimpleParameter s = new SimpleParameter()
            {
                Name = "nickName", Value = name
            };

            return(DBHelper <MemberInfo> .SelectSingle(tableName, "*", s));
        }
Beispiel #30
0
        public MemberInfo GetMemberById(string id)
        {
            SimpleParameter s = new SimpleParameter()
            {
                Name = "id", Value = id
            };

            return(DBHelper <MemberInfo> .SelectSingle(tableName, "*", s));
        }