private MediaFile BuildMediaFile(string relativePath, IStorageFile file)
 {
     return(new MediaFile {
         Name = file.GetName(),
         Size = file.GetSize(),
         LastUpdated = file.GetLastUpdated(),
         Type = file.GetFileType(),
         FolderName = relativePath,
         MediaPath = GetMediaPublicUrl(relativePath, file.GetName())
     });
 }
        private static FileData GetFileData(IStorageFile file)
        {
            if (file == null) return null;

            var lastUpdate = file.GetLastUpdated();
            return new FileData
            {
                Name = file.GetName(),
                VirtualPath = "/" + file.GetPath(),
                Created = lastUpdate,
                Updated = lastUpdate,
                Length = file.GetSize()
            };
        }
예제 #3
0
        private static FileData GetFileData(IStorageFile file)
        {
            if (file == null)
            {
                return(null);
            }

            var lastUpdate = file.GetLastUpdated();

            return(new FileData
            {
                Name = file.GetName(),
                VirtualPath = "/" + file.GetPath(),
                Created = lastUpdate,
                Updated = lastUpdate,
                Length = file.GetSize()
            });
        }
예제 #4
0
 private MediaFile BuildMediaFile(string relativePath, IStorageFile file) {
     return new MediaFile {
         Name = file.GetName(),
         Size = file.GetSize(),
         LastUpdated = file.GetLastUpdated(),
         Type = file.GetFileType(),
         FolderName = relativePath,
         MediaPath = GetMediaPublicUrl(relativePath, file.GetName())
     };
 }
예제 #5
0
        /// <summary>
        /// Compares the content of the photo with old photo.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="content">The content.</param>
        /// <returns></returns>
        private bool CompareFileContent(IStorageFile file, byte[] content)
        {
            if (file == null)
                return false;

            // The byte[] to save the data in
            var bytes = new byte[file.GetSize()];

            // Load a filestream and put its content into the byte[]
            using (Stream fs = file.OpenRead())
            {
                fs.Read(bytes, 0, bytes.Length);
            }

            return content.SequenceEqual(bytes);
        }