本文整理汇总了C#中Root.CanCreateThumbnail方法的典型用法代码示例。如果您正苦于以下问题:C# Root.CanCreateThumbnail方法的具体用法?C# Root.CanCreateThumbnail怎么用?C# Root.CanCreateThumbnail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Root
的用法示例。
在下文中一共展示了Root.CanCreateThumbnail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static DTOBase Create(FileInfo info, Root root)
{
if (info == null)
throw new ArgumentNullException("info");
if (root == null)
throw new ArgumentNullException("root");
string parentPath = info.Directory.FullName.Substring(root.Directory.FullName.Length);
string relativePath = info.FullName.Substring(root.Directory.FullName.Length);
FileDTO response;
if (root.CanCreateThumbnail(info))
{
ImageDTO imageResponse = new ImageDTO();
imageResponse.Thumbnail = root.GetExistingThumbHash(info) ?? (object)1;
var dim = root.GetImageDimension(info);
imageResponse.Dimension = string.Format("{0}x{1}", dim.Width, dim.Height);
response = imageResponse;
}
else
{
response = new FileDTO();
}
response.Read = 1;
response.Write = root.IsReadOnly ? (byte)0 : (byte)1;
response.Locked = (root.LockedFolders.Any(f => f == info.Directory.Name) || root.IsLocked) ? (byte)1 : (byte)0;
response.Name = info.Name;
response.Size = info.Length;
response.UnixTimeStamp = (long)(info.LastWriteTimeUtc - _unixOrigin).TotalSeconds;
response.Mime = Helper.GetMimeType(info);
response.Hash = root.VolumeId + Helper.EncodePath(relativePath);
response.ParentHash = root.VolumeId + Helper.EncodePath(parentPath.Length > 0 ? parentPath : info.Directory.Name);
return response;
}