Пример #1
0
        private void OnExtractFilesClick(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog dlg = new OpenFileDialog {
                    Filter = "FFX Image (*.iso)|*.iso"
                };
                if (dlg.ShowDialog() != true)
                {
                    return;
                }

                IsoInfo isoInfo = new IsoInfo(dlg.FileName);
                using (IsoFileCommander fileCommander = new IsoFileCommander(isoInfo))
                {
                    List <IsoTableEntry>     entries = UiProgressWindow.Execute("Поиск файлов", fileCommander, () => fileCommander.GetEntries());
                    List <IsoTableEntryInfo> infos   = UiProgressWindow.Execute("Анализ файлов", fileCommander, () => fileCommander.GetEntriesInfo(entries));

                    isoInfo.FillKnownFileInformation(infos);

                    UiProgressWindow.Execute("Чтение дополнительной информации", fileCommander, () => fileCommander.ReadAdditionalEntriesInfo(infos));
                    UiProgressWindow.Execute("Распаковка файлов", (total, incr) => ExtractFiles(fileCommander, infos, total, incr));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #2
0
        private void SafeExtractInfo(IsoFileCommander fileCommander, IsoTableEntryInfo info, Action <long> progressIncr)
        {
            try
            {
                if (info.CompressedSize < 1)
                {
                    return;
                }

                fileCommander.ExtractFile(info, Path.Combine(@"W:\FFX", info.GetRelativePath()));
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to extract file '{0}'", info.GetFileName());
            }
            finally
            {
                progressIncr(1);
            }
        }
Пример #3
0
 private void ExtractFiles(IsoFileCommander fileCommander, List <IsoTableEntryInfo> infos, Action <long> total, Action <long> incr)
 {
     total.NullSafeInvoke(infos.Count);
     Parallel.ForEach(infos, info => SafeExtractInfo(fileCommander, info, incr));
 }