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


C# JToken.Contains方法代码示例

本文整理汇总了C#中JToken.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# JToken.Contains方法的具体用法?C# JToken.Contains怎么用?C# JToken.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JToken的用法示例。


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

示例1: DownloadAccounts

 public async Task DownloadAccounts(JToken args)
 {
     bool flag = false;
     bool flag1;
     flag1 = (!args.Contains<JToken>("cleanse") ? false : args["cleanse"].ToObject<bool>());
     bool flag2 = flag1;
     Func<string, string, bool> func = (string a, string b) => string.Equals(a, b, StringComparison.OrdinalIgnoreCase);
     Func<RiotAccount, AccountConfig, bool> username = (RiotAccount config, AccountConfig account) =>
     {
         if (!func(config.Username, account.Username) || !func(config.RealmId, account.RealmId))
         {
             return false;
         }
         return func(config.Password, account.Password);
     };
     AccountSettings accountSettings = await this.GetAccountSettings();
     AccountConfig[] accounts = accountSettings.Accounts;
     RiotAccount[] all = JsApiService.AccountBag.GetAll();
     if (!flag2)
     {
         RiotAccount[] riotAccountArray = all;
         IEnumerable<RiotAccount> riotAccounts = ((IEnumerable<RiotAccount>)riotAccountArray).Where<RiotAccount>((RiotAccount x) =>
         {
             if (!accounts.Any<AccountConfig>((AccountConfig config) => username(x, config)))
             {
                 return true;
             }
             return x.State == ConnectionState.Error;
         });
         foreach (RiotAccount riotAccount in riotAccounts)
         {
             JsApiService.AccountBag.Detach(riotAccount);
         }
     }
     else
     {
         RiotAccount[] riotAccountArray1 = all;
         for (int i = 0; i < (int)riotAccountArray1.Length; i++)
         {
             RiotAccount riotAccount1 = riotAccountArray1[i];
             JsApiService.AccountBag.Detach(riotAccount1);
         }
         if (flag)
         {
         }
     }
     AccountConfig[] accountConfigArray = accounts;
     for (int j = 0; j < (int)accountConfigArray.Length; j++)
     {
         AccountConfig accountConfig = accountConfigArray[j];
         JsApiService.AccountBag.Attach(accountConfig);
     }
     RiotAccount riotAccount2 = null;
     RiotAccount[] all1 = JsApiService.AccountBag.GetAll();
     AccountReference active = accountSettings.Active;
     if (active != null)
     {
         RiotAccount[] riotAccountArray2 = all1;
         riotAccount2 = ((IEnumerable<RiotAccount>)riotAccountArray2).FirstOrDefault<RiotAccount>((RiotAccount x) =>
         {
             if (!string.Equals(active.Username, x.Username, StringComparison.OrdinalIgnoreCase))
             {
                 return false;
             }
             return string.Equals(active.RealmId, x.RealmId, StringComparison.OrdinalIgnoreCase);
         });
     }
     if (riotAccount2 == null)
     {
         riotAccount2 = all1.FirstOrDefault<RiotAccount>();
         if (riotAccount2 != null)
         {
             LittleClient client = JsApiService.Client;
             AccountReference accountReference = new AccountReference()
             {
                 Username = riotAccount2.Username,
                 RealmId = riotAccount2.RealmId
             };
             client.Invoke("riot.accounts.activate", accountReference);
         }
     }
     JsApiService.AccountBag.SetActive(riotAccount2);
 }
开发者ID:RevivalCoding,项目名称:Wintermint,代码行数:83,代码来源:AccountService.cs


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