Exemple #1
0
        public void CloseArchive()
        {
            if (LoadedFileSystem == null)
            {
                return;
            }

            Log.Info(string.Format(Resources.IO_ArchiveClosing, LoadedFileSystem.FileSystem.Name), Resources.Tag_IO);

            LoadedFileSystem.Close();
            LoadedFileSystem = null;

            UpdateCommandAvailability();
        }
Exemple #2
0
        public void ExportAllFiles()
        {
            LoadedFileSystem.ExportFileOrFolder(LoadedFileSystem.Root, true);
            return;

            // select archive file
            // TODO default path
            Log.Note(Resources.IO_ExportFolderSelectionStarted, Resources.Tag_IO);
            string path = Service.Get <IFileService>().SelectDirectory("");

            if (string.IsNullOrWhiteSpace(path))
            {
                Log.Warn(Resources.IO_FolderSelectionAbortedByUser, Resources.Tag_IO);
                return;
            }
            Log.Note(string.Format(Resources.IO_ExportFolderSelectionEnded, path), Resources.Tag_IO);

            // TODO Temp
            //new ExportAllJob(LoadedFileSystem.FileSystem, path).Execute();
            //return;

            try {
                var srcFs = LoadedFileSystem.FileSystem;
                using (var dstFs = FileSystem.NewFolder(path)) {
                    foreach (string file in srcFs.GetFiles())
                    {
                        using (var srcFile = srcFs.OpenFile(file))
                            using (var dstFile = dstFs.CreateFile(file)) {
                                srcFile.CopyTo(dstFile);
                            }
                    }
                }
            }
            catch (Exception e) {
                Log.Fail(string.Format(Resources.IO_ExportAllFailed, e.GetType().Name, e.Message), Resources.Tag_IO);
                Log.Fail(e.StackTrace, Resources.Tag_IO);
            }
        }