当前位置: 首页>>代码示例>>C#>>正文


C# FunctionArguments类代码示例

本文整理汇总了C#中FunctionArguments的典型用法代码示例。如果您正苦于以下问题:C# FunctionArguments类的具体用法?C# FunctionArguments怎么用?C# FunctionArguments使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FunctionArguments类属于命名空间,在下文中一共展示了FunctionArguments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        /*
         * Evaluate the function.
         *
         * @param interpreter
         * @param pos Source position of function call
         * @return The result of evaluating the function.
         */
        public JavaScriptObject Execute(Scope parentscope, List<JavaScriptObject> arguments, SourcePosition pos, JavaScriptObject thisObject)
        {
            Scope executionscope = new Scope(parentscope);
            int numberMissingArgs = 0;
            int numberRequiredArgs = 0;
            FunctionArguments argumentsVariable = new FunctionArguments(arguments);
            for (int paramIndex = 0; paramIndex < this.ArgumentCount; paramIndex++)
            {
                String argumentName = this.GetArgumentName(paramIndex);
                JavaScriptObject value = this.GetDefaultValue(paramIndex);
                if (value == null)
                {
                    numberRequiredArgs++;
                }
                if (paramIndex < argumentsVariable.Count)
                {
                    // Value provided in function call overrides the default value
                    value = argumentsVariable[paramIndex];
                }
                if (value == null)
                {
                    numberMissingArgs++;
                }

                executionscope.SetLocalVariable(argumentName, value);
            }

            executionscope.SetLocalVariable("arguments", argumentsVariable);

            if (numberMissingArgs > 0)
            {
                throw new TooFewArgumentsException(this.Name, numberRequiredArgs, argumentsVariable.Count, pos);
            }

            return this.Execute(pos, executionscope, thisObject);
        }
开发者ID:snargledorf,项目名称:SnagScript,代码行数:43,代码来源:Function.cs

示例2: GetAccessToken

        public virtual OAuthAccessToken GetAccessToken()
        {
            var args = new FunctionArguments
            {
                ConsumerKey = consumerKey,
                ConsumerSecret = consumerSecret,
                Username = username,
                Password = password
            };

            var request = accessTokenQuery.Invoke(args);
            var header = EncodeUserDetails();
            request.AddHeader("Authorization", header);
            var response = oauth.Request(request);

            SetResponse(response);

            var accessToken = new OAuthAccessToken
            {
                Token = response.Content ?? "?"
            };

            return accessToken;
        }
开发者ID:ecomerc,项目名称:openbitly,代码行数:24,代码来源:BitlyService.OAuth.cs

示例3: GetAccessToken

        public virtual void GetAccessToken(OAuthRequestToken requestToken, string verifier, Action<OAuthAccessToken, TwitterResponse> action)
        {
            var args = new FunctionArguments
            {
                ConsumerKey = _consumerKey,
                ConsumerSecret = _consumerSecret,
                Token = requestToken.Token,
                TokenSecret = requestToken.TokenSecret,
                Verifier = verifier
            };

            var request = _accessTokenQuery.Invoke(args);

           _oauth.BeginRequest(request, (req, resp, state) =>
                               {
                                   Exception exception;
                                   var entity = TryAsyncResponse(() =>
                                   {
                                        if (resp == null || resp.StatusCode != HttpStatusCode.OK)
                                        {
                                            return null;
                                        }

                                       var query = HttpUtility.ParseQueryString(resp.Content);
                                       var accessToken = new OAuthAccessToken
                                       {
                                           Token = query["oauth_token"] ?? "?",
                                           TokenSecret = query["oauth_token_secret"] ?? "?",
                                           UserId = Convert.ToInt32(query["user_id"] ?? "0"),
                                           ScreenName = query["screen_name"] ?? "?"
                                       };
                                       return accessToken;
                                   },
                                   out exception);

                                   action(entity, new TwitterResponse(resp, exception));
                               }
               );
        }
开发者ID:Gnorme,项目名称:tweetsharp,代码行数:39,代码来源:TwitterService.OAuth.cs

示例4: GetRequestToken

        public virtual OAuthRequestToken GetRequestToken(string callback)
        {
            var args = new FunctionArguments
            {
                ConsumerKey = _consumerKey,
                ConsumerSecret = _consumerSecret
            };

            var request = _requestTokenQuery.Invoke(args);
            if(!callback.IsNullOrBlank())
            {
                request.AddParameter("oauth_callback", callback);
            }

            var response = _oauth.Request(request);

            SetResponse(response);

            var query = HttpUtility.ParseQueryString(response.Content);
            var oauth = new OAuthRequestToken
            {
                Token = query["oauth_token"] ?? "?",
                TokenSecret = query["oauth_token_secret"] ?? "?",
                OAuthCallbackConfirmed = Convert.ToBoolean(query["oauth_callback_confirmed"] ?? "false")
            };

            return oauth;
        }
开发者ID:Gnorme,项目名称:tweetsharp,代码行数:28,代码来源:TwitterService.OAuth.cs

示例5: XsltUnparsedEntityUri

		public XsltUnparsedEntityUri (FunctionArguments args) : base (args)
		{
			if (args == null || args.Tail != null)
				throw new XPathException ("unparsed-entity-uri takes 1 arg");
			
			arg0 = args.Arg;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:XslFunctions.cs

示例6: XsltKey

		public XsltKey (FunctionArguments args, IStaticXsltContext ctx) : base (args)
		{
			staticContext = ctx;
			if (args == null || args.Tail == null)
				throw new XPathException ("key takes 2 args");
			arg0 = args.Arg;
			arg1 = args.Tail.Arg;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:XslFunctions.cs

示例7: XsltFunctionAvailable

		public XsltFunctionAvailable (FunctionArguments args, IStaticXsltContext ctx) : base (args)
		{
			if (args == null || args.Tail != null)
				throw new XPathException ("element-available takes 1 arg");
			
			arg0 = args.Arg;
			this.ctx = ctx;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:XslFunctions.cs

示例8: XPathFunctionNormalizeSpace

		public XPathFunctionNormalizeSpace (FunctionArguments args) : base (args)
		{
			if (args != null) {
				arg0 = args.Arg;
				if (args.Tail != null)
					throw new XPathException ("normalize-space takes 1 or zero args");
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:DefaultContext.cs

示例9: XPathFunctionStringLength

		public XPathFunctionStringLength (FunctionArguments args) : base (args)
		{
			if (args != null) {
				arg0 = args.Arg;
				if (args.Tail != null)
					throw new XPathException ("string-length takes 1 or zero args");
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:DefaultContext.cs

示例10: XPathFunctionSubstring

		public XPathFunctionSubstring (FunctionArguments args) : base (args)
		{
			if (args == null || args.Tail == null || (args.Tail.Tail != null && args.Tail.Tail.Tail != null))
				throw new XPathException ("substring takes 2 or 3 args");
			
			arg0 = args.Arg;
			arg1 = args.Tail.Arg;
			if (args.Tail.Tail != null)
				arg2= args.Tail.Tail.Arg;
		}
开发者ID:nobled,项目名称:mono,代码行数:10,代码来源:DefaultContext.cs

示例11: XPathFunctionSubstringAfter

		public XPathFunctionSubstringAfter (FunctionArguments args) : base (args)
		{
			if (args == null || args.Tail == null || args.Tail.Tail != null)
				throw new XPathException ("substring-after takes 2 args");
			
			arg0 = args.Arg;
			arg1 = args.Tail.Arg;
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:DefaultContext.cs

示例12: XPathFunctionContains

		public XPathFunctionContains (FunctionArguments args) : base (args)
		{
			if (args == null || args.Tail == null || args.Tail.Tail != null)
				throw new XPathException ("contains takes 2 args");
			
			arg0 = args.Arg;
			arg1 = args.Tail.Arg;
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:DefaultContext.cs

示例13: XPathFunctionStartsWith

		public XPathFunctionStartsWith (FunctionArguments args) : base (args)
		{
			if (args == null || args.Tail == null || args.Tail.Tail != null)
				throw new XPathException ("starts-with takes 2 args");
			
			arg0 = args.Arg;
			arg1 = args.Tail.Arg;
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:DefaultContext.cs

示例14: XPathFunctionConcat

		public XPathFunctionConcat (FunctionArguments args) : base (args)
		{
			if (args == null || args.Tail == null)
				throw new XPathException ("concat takes 2 or more args");
			
			args.ToArrayList (rgs = new ArrayList ());
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:DefaultContext.cs

示例15: XsltDocument

		public XsltDocument (FunctionArguments args, Compiler c) : base (args)
		{
			if (args == null || (args.Tail != null && args.Tail.Tail != null))
				throw new XPathException ("document takes one or two args");
			
			arg0 = args.Arg;
			if (args.Tail != null)
				arg1 = args.Tail.Arg;
			doc = c.Input.Clone ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:10,代码来源:XslFunctions.cs


注:本文中的FunctionArguments类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。