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


C# ItemData.ToString方法代码示例

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


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

示例1: GetItemAsync

 /// <summary>
 /// Get an item asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="itemId">Id of the item to retrieve.</param>
 /// <param name="itemData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>An item.</returns>
 public async Task<ItemStatic> GetItemAsync(Region region, int itemId, ItemData itemData = ItemData.none
     , Language language = Language.en_US)
 {
     var wrapper = Cache.Get<ItemStaticWrapper>(ItemCacheKey + itemId);
     if (wrapper != null && wrapper.Language == language && wrapper.ItemData == itemData)
     {
         return wrapper.ItemStatic;
     }
     else
     {
         var listWrapper = Cache.Get<ItemListStaticWrapper>(ItemsCacheKey);
         if (listWrapper != null && listWrapper.Language == language && listWrapper.ItemData == itemData)
         {
             if (listWrapper.ItemListStatic.Items.ContainsKey(itemId))
             {
                 return listWrapper.ItemListStatic.Items[itemId];
             }
             else
             {
                 return null;
             }
         }
         else
         {
             var json = await requester.CreateRequestAsync(string.Format(ItemRootUrl, region.ToString())
                 + string.Format(IdUrl, itemId)
                 , new List<string>() { string.Format("locale={0}", language.ToString())
                     , itemData == ItemData.none ? string.Empty
                         : string.Format("itemData={0}", itemData.ToString()) });
             var item = await JsonConvert.DeserializeObjectAsync<ItemStatic>(json);
             Cache.Add<ItemStaticWrapper>(ItemCacheKey + itemId, new ItemStaticWrapper(item, language, itemData));
             return item;
         }
     }
 }
开发者ID:Karunp,项目名称:RiotSharp,代码行数:43,代码来源:StaticRiotApi.cs

示例2: GetItemsAsync

 /// <summary>
 /// Get a list of all items synchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="itemData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>An ItemListStatic object containing all items.</returns>
 public async Task<ItemListStatic> GetItemsAsync(Region region, ItemData itemData = ItemData.none
     , Language language = Language.en_US)
 {
     var wrapper = Cache.Get<ItemListStaticWrapper>(ItemsCacheKey);
     if (wrapper == null || language != wrapper.Language || itemData != wrapper.ItemData)
     {
         var json = await requester.CreateRequestAsync(string.Format(ItemRootUrl, region.ToString())
             , new List<string>() { string.Format("locale={0}", language.ToString())
                 , itemData == ItemData.none ? string.Empty
                     : string.Format("itemListData={0}", itemData.ToString()) });
         var items = await JsonConvert.DeserializeObjectAsync<ItemListStatic>(json);
         wrapper = new ItemListStaticWrapper(items, language, itemData);
         Cache.Add<ItemListStaticWrapper>(ItemsCacheKey, wrapper);
     }
     return wrapper.ItemListStatic;
 }
开发者ID:Karunp,项目名称:RiotSharp,代码行数:23,代码来源:StaticRiotApi.cs

示例3: GetItemsAsync

 /// <summary>
 /// Get a list of all items synchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="itemData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>An ItemListStatic object containing all items.</returns>
 public async Task<ItemListStatic> GetItemsAsync(Region region, ItemData itemData = ItemData.none,
     Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, ItemListStaticWrapper>(ItemsCacheKey);
     if (wrapper != null && language == wrapper.Language && itemData == wrapper.ItemData)
     {
         return wrapper.ItemListStatic;
     }
     var json = await requester.CreateGetRequestAsync(
         string.Format(ItemRootUrl, region.ToString()),
         RootDomain,
         new List<string>
         {
             string.Format("locale={0}", language.ToString()),
             itemData == ItemData.none ?
                 string.Empty :
                 string.Format("itemListData={0}", itemData.ToString())
         });
     var items = await Task.Factory.StartNew(() =>
         JsonConvert.DeserializeObject<ItemListStatic>(json));
     wrapper = new ItemListStaticWrapper(items, language, itemData);
     cache.Add(ItemsCacheKey, wrapper, DefaultSlidingExpiry);
     return wrapper.ItemListStatic;
 }
开发者ID:RejectKid,项目名称:RiotSharp,代码行数:31,代码来源:StaticRiotApi.cs

示例4: GetItemAsync

 /// <summary>
 /// Get an item asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="itemId">Id of the item to retrieve.</param>
 /// <param name="itemData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>An item.</returns>
 public async Task<ItemStatic> GetItemAsync(Region region, int itemId, ItemData itemData = ItemData.none,
     Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, ItemStaticWrapper>(ItemCacheKey + itemId);
     if (wrapper != null && wrapper.Language == language && wrapper.ItemData == itemData)
     {
         return wrapper.ItemStatic;
     }
     var listWrapper = cache.Get<String, ItemListStaticWrapper>(ItemsCacheKey);
     if (listWrapper != null && listWrapper.Language == language && listWrapper.ItemData == itemData)
     {
         return listWrapper.ItemListStatic.Items.ContainsKey(itemId) ?
             listWrapper.ItemListStatic.Items[itemId] : null;
     }
     var json = await requester.CreateGetRequestAsync(
         string.Format(ItemRootUrl, region.ToString()) + string.Format(IdUrl, itemId),
         RootDomain,
         new List<string>
         {
             string.Format("locale={0}", language.ToString()),
             itemData == ItemData.none ?
                 string.Empty :
                 string.Format("itemData={0}", itemData.ToString())
         });
     var item = await Task.Factory.StartNew(() =>
         JsonConvert.DeserializeObject<ItemStatic>(json));
     cache.Add(ItemCacheKey + itemId, new ItemStaticWrapper(item, language, itemData), DefaultSlidingExpiry);
     return item;
 }
开发者ID:RejectKid,项目名称:RiotSharp,代码行数:37,代码来源:StaticRiotApi.cs

示例5: GetItems

 /// <summary>
 /// Get a list of all items synchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="itemData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>An ItemListStatic object containing all items.</returns>
 public ItemListStatic GetItems(Region region, ItemData itemData = ItemData.none,
     Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, ItemListStaticWrapper>(ItemsCacheKey);
     if (wrapper == null || language != wrapper.Language || itemData != wrapper.ItemData)
     {
         var json = requester.CreateGetRequest(
             string.Format(ItemRootUrl, region.ToString()),
             RootDomain,
             new List<string>
             {
                 string.Format("locale={0}", language.ToString()),
                 itemData == ItemData.none ?
                 string.Empty :
                 string.Format("itemListData={0}", itemData.ToString())
             });
         var items = JsonConvert.DeserializeObject<ItemListStatic>(json);
         wrapper = new ItemListStaticWrapper(items, language, itemData);
         cache.Add(ItemsCacheKey, wrapper, DefaultSlidingExpiry);
     }
     return wrapper.ItemListStatic;
 }
开发者ID:RejectKid,项目名称:RiotSharp,代码行数:29,代码来源:StaticRiotApi.cs


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