private FileViewModel ExtendFileViewModel(FileViewModel file)
 {
     file.IsImage = ResizerService.IsImageExtension(file.Extension);
     try
     {
         SetFileSizes(file);
     }
     catch
     {
     }
     return(file);
 }
 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;
     }
 }
        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);
        }
 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;
     }
 } 
 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();
     }
 }
 private FileViewModel ExtendFileViewModel(FileViewModel file)
 {
     file.IsImage = ResizerService.IsImageExtension(file.Extension);
     try
     {
         SetFileSizes(file);
         SetLonLat(file);
     }
     catch
     {
     }
     return file;
 }
 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;
 }