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


C# TokenInfo类代码示例

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


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

示例1: ParserResult

 public ParserResult(TokenInfo token, bool isSuccessed, LambdaExpression expr, SyntaxException error = null)
 {
     IsSuccessed = isSuccessed;
     Expression = expr;
     Token = token;
     Error = error;
 }
开发者ID:barbarossia,项目名称:ConsoleApplication2,代码行数:7,代码来源:ParserResult.cs

示例2: CreateTextRun

 private static Run CreateTextRun(string code, TokenInfo token)
 {
     var text = code.Substring(token.SourceSpan.Start.Index, token.SourceSpan.Length);
     var result = new Run(text);
     var style = _colorizationStyles.ContainsKey(token.Category) ? _colorizationStyles[token.Category] : _colorizationStyles[TokenCategory.None];
     result.Style = Application.Current.FindResource(style) as Style;
     return result;
 }
开发者ID:jflam,项目名称:repl-lib,代码行数:8,代码来源:Colorizer.cs

示例3: GetChannelInformation

        private ChannelInformations GetChannelInformation(string baseUrl, TokenInfo googleAuthorization, HttpClient httpClient)
        {
            var getChannels = baseUrl + "/channels?part=contentDetails&mine=true";
            var channelResponse = MakeYoutubeGetRequest(googleAuthorization, httpClient, getChannels);
            var channelInformation = new JavaScriptSerializer().Deserialize<ChannelInformations>(channelResponse);

            return channelInformation;
        }
开发者ID:Dudemanword,项目名称:Un-PIece,代码行数:8,代码来源:YoutubeOperations.cs

示例4: MapRuleAction

 private ParserResult MapRuleAction(ParserResult other)
 {
     Type source = Token.SourceType;
     Type target = other.Token.TargetType;
     var invoker = (IInvoker)Utilities.CreateType(typeof(MapGroupInvoker<,>), source, target)
                    .CreateInstance(Expression, other.Expression);
     var expr = invoker.Invoke();
     var token = new TokenInfo(RegisterKeys.MapRule, source, target);
     return new ParserResult(token, true, expr);
 }
开发者ID:barbarossia,项目名称:ConsoleApplication2,代码行数:10,代码来源:ParserResultAction.cs

示例5: IsUnaryOperator

            public static bool IsUnaryOperator(TokenInfo token)
            {
                switch (token.Token)
                {
                    case Token.Plus:
                    case Token.Minus:
                    case Token.Not:
                        return true;
                }

                return false;
            }
开发者ID:robertsundstrom,项目名称:vb-lite-compiler,代码行数:12,代码来源:BasicParser.Helper.cs

示例6: GetPlayListInformation

        private PlayListInformations GetPlayListInformation(ChannelInformations channelInformation, string baseUrl, TokenInfo googleAuthorization, HttpClient httpClient)
        {
            PlayListInformations playlistInformation = new PlayListInformations();
            foreach (var item in channelInformation.items)
            {
                var playlistItemUrl = baseUrl + "/playlistItems?part=snippet&playlistId=" + item.contentDetails.relatedPlaylists.uploads;
                var playlistResponse = MakeYoutubeGetRequest(googleAuthorization, httpClient, playlistItemUrl);
                playlistInformation = new JavaScriptSerializer().Deserialize<PlayListInformations>(playlistResponse);
            }

            return playlistInformation;
        }
开发者ID:Dudemanword,项目名称:Un-PIece,代码行数:12,代码来源:YoutubeOperations.cs

示例7: CreateToken

        /// <summary>
        /// 为客户端创建令牌
        /// </summary>
        /// <returns></returns>
        public string CreateToken()
        {
            string returnStr = "";
            if (Signature != GetParam("sig").ToString())
            {
                ErrorCode = (int)ErrorType.API_EC_SIGNATURE;
                return returnStr;
            }

            //应用程序类型为Web的时候应用程序没有调用此方法的权限
            if (this.App.ApplicationType == (int)ApplicationType.WEB)
            {
                ErrorCode = (int)ErrorType.API_EC_PERMISSION_DENIED;
                return returnStr;
            }

            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(Config.Passwordkey, Config.Onlinetimeout);
            int olid = oluserinfo.Olid;

            string expires = string.Empty;
            DateTime expireUTCTime;
            TokenInfo token = new TokenInfo();

            if (System.Web.HttpContext.Current.Request.Cookies["dnt"] == null || System.Web.HttpContext.Current.Request.Cookies["dnt"]["expires"] == null)
            {
                token.Token = "";
                if (Format == FormatType.JSON)
                    returnStr = "";
                else
                    returnStr = SerializationHelper.Serialize(token);
                return returnStr;
            }
            expires = System.Web.HttpContext.Current.Request.Cookies["dnt"]["expires"].ToString();
            ShortUserInfo userinfo = Discuz.Forum.Users.GetShortUserInfo(oluserinfo.Userid);
            expireUTCTime = DateTime.Parse(userinfo.Lastvisit).ToUniversalTime().AddSeconds(Convert.ToDouble(expires));
            expires = Utils.ConvertToUnixTimestamp(expireUTCTime).ToString();

            string time = string.Empty;
            if (oluserinfo == null)
                time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            else
                time = DateTime.Parse(oluserinfo.Lastupdatetime).ToString("yyyy-MM-dd HH:mm:ss");

            string authToken = Common.DES.Encode(string.Format("{0},{1},{2}", olid.ToString(), time, expires), this.Secret.Substring(0, 10)).Replace("+", "[");
            token.Token = authToken;
            if (Format == FormatType.JSON)
                returnStr = authToken;
            else
                returnStr = SerializationHelper.Serialize(token);
            return returnStr;

        }
开发者ID:khaliyo,项目名称:DiscuzNT,代码行数:56,代码来源:Auth.cs

示例8: IsArithmeticOperator

            public static bool IsArithmeticOperator(TokenInfo token)
            {
                switch (token.Token)
                {
                    case Token.Plus:
                    case Token.Minus:
                    case Token.Slash:
                    case Token.Star:
                    case Token.Percent:
                    case Token.Mod:
                        return true;
                }

                return false;
            }
开发者ID:robertsundstrom,项目名称:vb-lite-compiler,代码行数:15,代码来源:BasicParser.Helper.cs

示例9: IsBinaryOperator

            public static bool IsBinaryOperator(TokenInfo token)
            {
                switch (token.Token)
                {
                    case Token.Plus:
                    case Token.Minus:
                    case Token.Slash:
                    case Token.Star:
                    case Token.Percent:
                    case Token.LeftAngleBracket:
                    case Token.RightAngleBracket:
                    case Token.Is:
                    case Token.IsNot:
                    case Token.Mod:
                    case Token.Equality:
                    case Token.Inequality:
                    case Token.Period:
                        return true;
                }

                return false;
            }
开发者ID:robertsundstrom,项目名称:vb-lite-compiler,代码行数:22,代码来源:BasicParser.Helper.cs

示例10: Run

        public override bool Run(CommandParameter commandParam, ref string result)
        {
            if (commandParam.AppInfo.ApplicationType == (int)ApplicationType.WEB)
            {
                result = Util.CreateErrorMessage(ErrorType.API_EC_PERMISSION_DENIED, commandParam.ParamList);
                return false;
            }
            TokenInfo token = new TokenInfo();

            if (System.Web.HttpContext.Current.Request.Cookies["dnt"] == null || System.Web.HttpContext.Current.Request.Cookies["dnt"]["expires"] == null)
            {
                token.Token = "";
                result = commandParam.Format == FormatType.JSON ? string.Empty : SerializationHelper.Serialize(token);
                return true;
            }

            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(commandParam.GeneralConfig.Passwordkey, commandParam.GeneralConfig.Onlinetimeout);
            int olid = oluserinfo.Olid;

            string expires = string.Empty;
            DateTime expireUTCTime;

            expires = System.Web.HttpContext.Current.Request.Cookies["dnt"]["expires"].ToString();
            ShortUserInfo userinfo = Discuz.Forum.Users.GetShortUserInfo(oluserinfo.Userid);
            expireUTCTime = DateTime.Parse(userinfo.Lastvisit).ToUniversalTime().AddSeconds(Convert.ToDouble(expires));
            expires = Utils.ConvertToUnixTimestamp(expireUTCTime).ToString();

            string time = string.Empty;
            if (oluserinfo == null)
                time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            else
                time = DateTime.Parse(oluserinfo.Lastupdatetime).ToString("yyyy-MM-dd HH:mm:ss");

            string authToken = Common.DES.Encode(string.Format("{0},{1},{2}", olid.ToString(), time, expires), commandParam.AppInfo.Secret.Substring(0, 10)).Replace("+", "[");
            token.Token = authToken;
            result = commandParam.Format == FormatType.JSON ? authToken : SerializationHelper.Serialize(token);
            return true;
        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:38,代码来源:AuthCommand.cs

示例11: GetVideoList

        public Videos GetVideoList(TokenInfo tokenInfo)
        {
            var httpClient = new HttpClient();
            var baseUrl = "https://www.googleapis.com/youtube/v3";

            var channelInformation = GetChannelInformation(baseUrl, tokenInfo, httpClient);
            var playlistInformation = GetPlayListInformation(channelInformation, baseUrl, tokenInfo, httpClient);

            var video = playlistInformation.items.Select(x => new Video
            {
                Description = x.snippet.description,
                Name = x.snippet.title,
                ThumbnailUrl = x.snippet.thumbnails.high.url,
                VideoUrl = @"http://www.youtube.com/embed/" + x.snippet.resourceId.VideoId,
                PublishedDate = x.snippet.publishedAt
            }).ToList();

            var videos = new Videos
            {
                VideoList = video
            };

            return videos;
        }
开发者ID:Dudemanword,项目名称:Un-PIece,代码行数:24,代码来源:YoutubeOperations.cs

示例12: GetTokenInfoAt

 public int GetTokenInfoAt(TokenInfo[] infos, int col, ref TokenInfo info) {
   for (int i = 0, len = infos.Length; i < len; i++) {
     int start = infos[i].startIndex; // 1-based to zero based.
     int end = infos[i].endIndex; // 1-based to zero based.
     if (i == 0 && start > col)
       return -1;
     if (col >= start && col <= end) {
       info = infos[i];
       return i;
     }
   }
   return -1;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:13,代码来源:Source.cs

示例13: BeginParse

    internal void BeginParse( int line, int idx, TokenInfo info, ParseReason reason, IVsTextView view, ParseResultHandler callback) {
     
      string text = null;
      if (reason == ParseReason.MemberSelect || reason == ParseReason.MethodTip)
        text = this.GetTextUpToLine( line );
      else if (reason == ParseReason.CompleteWord || reason == ParseReason.QuickInfo)
        text = this.GetTextUpToLine( line+1 );
      else
        text = this.GetTextUpToLine( 0 ); // get all the text.      

      string fname = this.GetFilePath();

      this.service.BeginParse(new ParseRequest(line, idx, info, text, fname, reason, view), callback); 
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:14,代码来源:Source.cs

示例14: MatchBraces

 public virtual void MatchBraces(IVsTextView textView, int line, int idx, TokenInfo info) {
   this.BeginParse(line, idx, info, ParseReason.HighlightBraces, textView, new ParseResultHandler(this.HandleMatchBracesResponse));
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:3,代码来源:Source.cs

示例15: ScanInterpolatedStringLiteralTop

 internal void ScanInterpolatedStringLiteralTop(ArrayBuilder<Interpolation> interpolations, bool isVerbatim, ref TokenInfo info, ref SyntaxDiagnosticInfo error, out bool closeQuoteMissing)
 {
     var subScanner = new InterpolatedStringScanner(this, isVerbatim);
     subScanner.ScanInterpolatedStringLiteralTop(interpolations, ref info, out closeQuoteMissing);
     error = subScanner.error;
     info.Text = TextWindow.GetText(false);
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:7,代码来源:Lexer_StringLiteral.cs


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