本文整理汇总了C#中BaseItem.GetImage方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.GetImage方法的具体用法?C# BaseItem.GetImage怎么用?C# BaseItem.GetImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseItem
的用法示例。
在下文中一共展示了BaseItem.GetImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentImagePath
/// <summary>
/// Gets the current image path.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="type">The type.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <returns>System.String.</returns>
/// <exception cref="System.ArgumentNullException">
/// imageIndex
/// or
/// imageIndex
/// </exception>
private string GetCurrentImagePath(BaseItem item, ImageType type, int? imageIndex)
{
switch (type)
{
case ImageType.Screenshot:
if (!imageIndex.HasValue)
{
throw new ArgumentNullException("imageIndex");
}
return item.ScreenshotImagePaths.Count > imageIndex.Value ? item.ScreenshotImagePaths[imageIndex.Value] : null;
case ImageType.Backdrop:
if (!imageIndex.HasValue)
{
throw new ArgumentNullException("imageIndex");
}
return item.BackdropImagePaths.Count > imageIndex.Value ? item.BackdropImagePaths[imageIndex.Value] : null;
default:
return item.GetImage(type);
}
}
示例2: GetImagePath
/// <summary>
/// Gets the image path.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="imageType">Type of the image.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <returns>System.String.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
/// <exception cref="System.InvalidOperationException"></exception>
public string GetImagePath(BaseItem item, ImageType imageType, int imageIndex)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
if (imageType == ImageType.Backdrop)
{
if (item.BackdropImagePaths == null)
{
throw new InvalidOperationException(string.Format("Item {0} does not have any Backdrops.", item.Name));
}
return item.BackdropImagePaths[imageIndex];
}
if (imageType == ImageType.Screenshot)
{
if (item.ScreenshotImagePaths == null)
{
throw new InvalidOperationException(string.Format("Item {0} does not have any Screenshots.", item.Name));
}
return item.ScreenshotImagePaths[imageIndex];
}
if (imageType == ImageType.Chapter)
{
return _itemRepo.GetChapter(item.Id, imageIndex).ImagePath;
}
return item.GetImage(imageType);
}