Example #1
0
        /// <summary>
        /// Install Entries.
        /// </summary>
        /// <param name="vm">The vm<see cref="SevenZipArchiveEntryViewModel"/>.</param>
        /// <param name="path">The path<see cref="string"/>.</param>
        public static void InstallEntry(this SevenZipArchiveEntryViewModel vm, string path)
        {
            string fullName = Path.Combine(path, vm.Name);

            if (vm.IsDirectory)
            {
                DirectoryCopy(vm.FullName, fullName);
                return;
            }

            FileCopy(vm.FullName, fullName);
        }
Example #2
0
        /// <summary>
        /// Install Checked Entries.
        /// </summary>
        /// <param name="vm">The vm<see cref="SevenZipArchiveEntryViewModel"/>.</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 SevenZipArchiveEntryViewModel vm, string path, bool overwrite = false)
        {
            if (overwrite == false)
            {
                Debug.Assert(vm.AreAnyCheckedEntriesInstalled(path) == false);
            }

            foreach (var entry in vm.SortedEntries.Values.Where(e => e.WillInstall))
            {
                if (entry.IsDirectory)
                {
                    DirectoryCopy(entry.FullName, path);
                    yield return(entry.Name);
                }
            }
        }