コード例 #1
0
        /// <summary>
        /// Install Checked Entries.
        /// </summary>
        /// <param name="vm">The vm<see cref="SevenZipArchiveViewModel"/>.</param>
        /// <param name="path">The path<see cref="string"/>.</param>
        /// <param name="overwrite">The overwrite<see cref="bool"/>.</param>
        /// <returns>The <see cref="IEnumerable{string}"/>.</returns>
        public static IEnumerable <string> InstallCheckedEntries(this SevenZipArchiveViewModel vm, string path, bool overwrite = false)
        {
            if (vm.SelectedDirectory is SevenZipArchiveEntryViewModel svm)
            {
                foreach (var item in svm.InstallCheckedEntries(path, overwrite))
                {
                    yield return(item);
                }

                yield break;
            }

            if (overwrite == false)
            {
                Debug.Assert(vm.AreAnyCheckedEntriesInstalled(path) == false);
            }

            var installedFolders = new List <Tuple <int, string, DateTime> >();

            foreach (var entry in vm.SortedEntries.Values.Where(e => e.WillInstall))
            {
                var sentry = entry as SevenZipArchiveEntryViewModel;
                sentry.InstallEntry(path);
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZipArchiveWindow"/> class.
        /// </summary>
        /// <param name="zfr">The zfr<see cref="Core.ViewModels.ZipFileViewModel"/>.</param>
        public ZipArchiveWindow(Core.ViewModels.ZipFileViewModel zfr)
        {
            InitializeComponent();
            WpfHelper.PositionChildWindow(this);

            IArchiveViewModel archive;

            if (zfr.Filename.ToLower().EndsWith(".7z"))
            {
                archive = new SevenZipArchiveViewModel(zfr.Filename, zfr.FilePath, zfr.PackageId);
            }
            else
            {
                archive = new ZipArchiveViewModel(zfr.Filename, zfr.FilePath, zfr.PackageId);
            }

            view.DataContext = archive;
        }