コード例 #1
0
 private FileViewModel ExtendFileViewModel(FileViewModel file)
 {
     file.IsImage = ResizerService.IsImageExtension(file.Extension);
     try
     {
         SetFileSizes(file);
     }
     catch
     {
     }
     return(file);
 }
コード例 #2
0
 private void SetFileSizes(FileViewModel file)
 {
     if (file.IsImage)
     {
         var size = ImageHeader.GetDimensions(file.ServerPath);
         file.Width  = size.Width;
         file.Height = size.Height;
     }
     else if (file.Extension == "swf")
     {
         int width, height;
         SwfService.GetSwfFileDimensions(file.ServerPath, out width, out height);
         file.Width  = width;
         file.Height = height;
     }
 }
コード例 #3
0
        private FileViewModel CreateFileViewModel(string serverFilePath)
        {
            var fileInfo = new FileInfo(serverFilePath);
            var result   = new FileViewModel
            {
                FileName   = fileInfo.Name,
                Extension  = fileInfo.Extension.Trim('.').ToLower(),
                Size       = fileInfo.Length,
                ServerPath = serverFilePath,
                SitePath   = GetSitePath(serverFilePath),
            };

            result.SiteFolder  = GetSiteFolder(result.SitePath, fileInfo.Name);
            result.DisplayPath = GetDisplayPath(result.SitePath);
            return(result);
        }
コード例 #4
0
 private void SetFileSizes(FileViewModel file)
 {
     if (file.IsImage)
     {
         var size = ImageHeader.GetDimensions(file.ServerPath);
         file.Width = size.Width;
         file.Height = size.Height;
     }
     else if (file.Extension == "swf")
     {
         int width, height;
         SwfService.GetSwfFileDimensions(file.ServerPath, out width, out height);
         file.Width = width;
         file.Height = height;
     }
 } 
コード例 #5
0
 private void SetLonLat(FileViewModel file)
 {
     var fileInfo = new FileInfo(file.ServerPath);
     if (fileInfo.Extension.ToLower() == ".jpg")
     {
         var exifReader = new ExifReader(file.ServerPath);
         file.Lat = exifReader.GetLat();
         file.Lon = exifReader.GetLon();
     }
 }
コード例 #6
0
 private FileViewModel ExtendFileViewModel(FileViewModel file)
 {
     file.IsImage = ResizerService.IsImageExtension(file.Extension);
     try
     {
         SetFileSizes(file);
         SetLonLat(file);
     }
     catch
     {
     }
     return file;
 }
コード例 #7
0
 private FileViewModel CreateFileViewModel(string serverFilePath)
 {
     var fileInfo = new FileInfo(serverFilePath);
     var result = new FileViewModel
     {
         FileName = fileInfo.Name,
         Extension = fileInfo.Extension.Trim('.').ToLower(),
         Size = fileInfo.Length,
         ServerPath = serverFilePath,
         SitePath = GetSitePath(serverFilePath),
     };
     result.SiteFolder = GetSiteFolder(result.SitePath, fileInfo.Name);
     result.DisplayPath = GetDisplayPath(result.SitePath);
     return result;
 }