示例#1
0
 public void DropStorageItems(FileSystemElement droppedTo, IEnumerable <IStorageItem> droppeditems)
 {
 }
示例#2
0
        /// <summary>
        /// Loads a zip file
        /// </summary>
        /// <param name="fse"></param>
        /// <param name="thumbnailOptions"></param>
        private async void LoadZip(FileSystemElement fse, FileSystemRetrieveService.ThumbnailFetchOptions thumbnailOptions, CancellationToken token)
        {
            elements.Clear();
            currentDepth   = 0;
            folderIndex    = 0;
            currentZIPFile = await FileSystem.GetFileAsync(fse);

            currentFSE = fse;

            using (Stream stream = await currentZIPFile.OpenStreamForReadAsync())
            {
                var reader = ReaderFactory.Open(stream);
                while (reader.MoveToNextEntry())
                {
                    if (token.IsCancellationRequested)
                    {
                        return;
                    }

                    var entry    = reader.Entry;
                    var keySplit = entry.Key.Split("/");
                    var subPath  = string.Join(@"\", keySplit, 0, keySplit.Length - 1);

                    int            depth;
                    ZipFileElement element;
                    if (entry.IsDirectory)
                    {
                        var name = keySplit[keySplit.Length - 2];
                        depth = keySplit.Length - 2;

                        element = new ZipFileElement(
                            name,
                            fse.Path + @"\" + subPath,
                            entry.LastModifiedTime.Value,
                            (ulong)entry.Size,
                            entry.Key,
                            depth
                            );

                        elements.AddFirst(depth, element);
                    }
                    else
                    {
                        var name = keySplit[keySplit.Length - 1];
                        depth = keySplit.Length - 1;

                        string fileExtension = "";
                        var    fileName      = entry.Key.Split(".");
                        if (fileName.Length > 1)
                        {
                            fileExtension = fileName[fileName.Length - 1];
                        }

                        //Store fileStream to access it later
                        var elementStream = new MemoryStream();
                        reader.WriteEntryTo(elementStream);
                        await elementStream.FlushAsync();

                        var thumbnail = await FileSystem.GetFileExtensionThumbnail(fileExtension, thumbnailOptions.Mode, thumbnailOptions.Size, thumbnailOptions.Scale);

                        element = new ZipFileElement(
                            name,
                            fse.Path + @"\" + subPath,
                            entry.LastModifiedTime.Value,
                            (ulong)entry.Size,
                            thumbnail,
                            "." + fileExtension,
                            fileExtension,
                            entry.Key,
                            depth,
                            elementStream
                            );

                        elements.Add(depth, element);
                    }

                    AddToViewItems(element);
                }
            }
        }
示例#3
0
 public void DeleteFileSystemElement(FileSystemElement fse, bool permanently = false)
 {
 }
示例#4
0
 public void PasteFileSystemElement(FileSystemElement currentFolder)
 {
 }
示例#5
0
 public void RenameFileSystemElement(FileSystemElement fse, string newName)
 {
 }
 public void InitializeSubElements(FileSystemElement fileSystemElement)
 {
     addSubElements(fileSystemElement);
 }
 public void DropStorageItem(FileSystemElement droppedTo, IEnumerable <IStorageItem> droppeditems)
 {
     BrowserService.DropStorageItems(droppedTo, droppeditems);
 }
示例#8
0
 public void DeleteFileSystemElement(FileSystemElement fse)
 {
 }
示例#9
0
 public void FileBrowser_RequestedTabOpen(object sender, FileSystemElement e)
 {
     FileBrowserModels.Add(new FSEBrowserModel(e));
 }