Exemple #1
0
        private void SaveFile(string fileName)
        {
            SaveRDAFileWindow saveRdaFileWindow = new SaveRDAFileWindow();

            saveRdaFileWindow.Folder = CurrentReader.rdaFolder;
            saveRdaFileWindow.field_OutputFile.Text = fileName;
            saveRdaFileWindow.MustChooseFolderVersionDueToEncryptedBlocks = CurrentReader.SkippedDataSections.Count > 0;
            if (!saveRdaFileWindow.ShowDialog().GetValueOrDefault())
            {
                return;
            }

            fileName = saveRdaFileWindow.field_OutputFile.Text;
            FileHeader.Version version = CurrentReader.SkippedDataSections.Count > 0 ? CurrentReader.rdaFolder.Version : saveRdaFileWindow.SelectedVersion;
            bool compress = saveRdaFileWindow.check_IsCompressed.IsChecked.Value;

            if (!Directory.Exists(Path.GetDirectoryName(fileName)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(fileName));
            }

            RDAWriter        writer = new RDAWriter(CurrentReader.rdaFolder);
            BackgroundWorker wrk    = new BackgroundWorker();

            wrk.WorkerReportsProgress     = true;
            progressBar_Status.Visibility = Visibility.Visible;
            wrk.ProgressChanged          += (s, e2) => DispatcherExtension.Dispatch(System.Windows.Application.Current, () =>
            {
                label_Status.Text        = writer.UI_LastMessage;
                progressBar_Status.Value = e2.ProgressPercentage;
            });
            wrk.RunWorkerCompleted += (s, e2) => DispatcherExtension.Dispatch(System.Windows.Application.Current, () =>
            {
                label_Status.Text             = CurrentReader.rdaFolder.GetAllFiles().Count + " files";
                progressBar_Status.Visibility = Visibility.Collapsed;
            });
            wrk.DoWork += (s, e2) =>
            {
                try
                {
                    writer.Write(fileName, version, compress, CurrentReader, wrk);
                }
                catch (Exception ex)
                {
                    int num2 = (int)DispatcherExtension.Dispatch(System.Windows.Application.Current, () => MessageWindow.Show(ex.Message));
                }
            };
            wrk.RunWorkerAsync();
            return;
        }
        private void SaveFile(string fileName)
        {
            SaveRDAFileWindow saveRdaFileWindow = new SaveRDAFileWindow();
            saveRdaFileWindow.Folder = CurrentReader.rdaFolder;
            saveRdaFileWindow.field_OutputFile.Text = fileName;
            saveRdaFileWindow.MustChooseFolderVersionDueToEncryptedBlocks = CurrentReader.SkippedDataSections.Count > 0;
            if (!saveRdaFileWindow.ShowDialog().GetValueOrDefault())
                return;

            fileName = saveRdaFileWindow.field_OutputFile.Text;
            FileHeader.Version version = CurrentReader.SkippedDataSections.Count > 0 ? CurrentReader.rdaFolder.Version : saveRdaFileWindow.SelectedVersion;
            bool compress = saveRdaFileWindow.check_IsCompressed.IsChecked.Value;

            if (!Directory.Exists(Path.GetDirectoryName(fileName)))
                Directory.CreateDirectory(Path.GetDirectoryName(fileName));

            RDAWriter writer = new RDAWriter(CurrentReader.rdaFolder);
            BackgroundWorker wrk = new BackgroundWorker();
            wrk.WorkerReportsProgress = true;
            progressBar_Status.Visibility = Visibility.Visible;
            wrk.ProgressChanged += (s, e2) => DispatcherExtension.Dispatch(System.Windows.Application.Current, () =>
            {
                label_Status.Text = writer.UI_LastMessage;
                progressBar_Status.Value = e2.ProgressPercentage;
            });
            wrk.RunWorkerCompleted += (s, e2) => DispatcherExtension.Dispatch(System.Windows.Application.Current, () =>
            {
                label_Status.Text = CurrentReader.rdaFolder.GetAllFiles().Count + " files";
                progressBar_Status.Visibility = Visibility.Collapsed;
            });
            wrk.DoWork += (s, e2) =>
            {
                try
                {
                    writer.Write(fileName, version, compress, CurrentReader, wrk);
                }
                catch (Exception ex)
                {
                    int num2 = (int)DispatcherExtension.Dispatch(System.Windows.Application.Current, () => MessageWindow.Show(ex.Message));
                }
            };
            wrk.RunWorkerAsync();
            return;
        }