示例#1
0
    public MultimediaAsset Adapt(MultimediaInfo info)
    {
        if (info == null)
        {
            return(new MultimediaAsset());
        }

        return(new MultimediaAsset {
            Height = info.Height,
            Width = info.Width,
            Size = info.Size,
            Url = _urlSvc.GetImageUrl(info.Path)
        });
    }
示例#2
0
    public PhotoMultimediaAsset Adapt(MultimediaInfo info, int photoId, string size)
    {
        if (info == null)
        {
            return(new PhotoMultimediaAsset());
        }

        return(new PhotoMultimediaAsset {
            Height = info.Height,
            Width = info.Width,
            Size = info.Size,
            Url = _urlSvc.GetImageUrl(info.Path),
            DownloadUrl = _urlSvc.GetImageDownloadUrl(photoId, size)
        });
    }
示例#3
0
#pragma warning restore CA1822

    protected MultimediaInfo?BuildMultimediaInfo(dynamic path, dynamic width, dynamic height, dynamic size)
    {
        if (path == null)
        {
            return(null);
        }

        var mi = new MultimediaInfo();

        mi.Path   = GetValueOrDefault <string>(path);
        mi.Width  = GetValueOrDefault <short>(width);
        mi.Height = GetValueOrDefault <short>(height);
        mi.Size   = size == null ? 0 : Convert.ToInt64(size);

        return(mi);
    }