A class to create, list, or extract TAR archives. This is the primary, central class for the Tar library.
Bugs: does not read or write bzip2 compressed tarballs (.tar.bz2) uses Marshal.StructureToPtr and thus requires a LinkDemand, full trust.d
Ejemplo n.º 1
0
        /// <param name="archive"></param><param name="extractDirectory"></param> <param name="wantExtract"></param><param name="options"></param><returns></returns>
        private static List <TarEntry> ListOrExtract(
            string archive, string extractDirectory, bool wantExtract, Options options)
        {
            var t = new Tar {
                TarOptions = options ?? new Options()
            };

            return(t.InternalListOrExtract(archive, extractDirectory, wantExtract));
        }
Ejemplo n.º 2
0
        /// <summary>Create a tar archive with the given name, and containing the given set of files or directories, and using GZIP compression by default.</summary>
        /// <param name="outputFile">The name of the tar archive to create. The file must not exist at the time of the call.</param>
        /// <param name="filesOrDirectories">A list of filenames and/or directory names to be added to the archive.</param>
        /// <param name="options">The options to use during Tar operation.</param>
        public static void CreateArchive(
            string outputFile, IEnumerable<string> filesOrDirectories, Options options = null)
        {
            if (options == null)
            {
                options = new Options { Compression = TarCompression.GZip };
            }

            var tar = new Tar { TarOptions = options };
            tar.InternalCreateArchive(outputFile, filesOrDirectories);
        }
Ejemplo n.º 3
0
        /// <summary>Create a tar archive with the given name, and containing the given set of files or directories, and using GZIP compression by default.</summary>
        /// <param name="outputFile">The name of the tar archive to create. The file must not exist at the time of the call.</param>
        /// <param name="filesOrDirectories">A list of filenames and/or directory names to be added to the archive.</param>
        /// <param name="options">The options to use during Tar operation.</param>
        public static void CreateArchive(
            string outputFile, IEnumerable <string> filesOrDirectories, Options options = null)
        {
            if (options == null)
            {
                options = new Options {
                    Compression = TarCompression.GZip
                };
            }

            var tar = new Tar {
                TarOptions = options
            };

            tar.InternalCreateArchive(outputFile, filesOrDirectories);
        }
Ejemplo n.º 4
0
 /// <param name="archive"></param><param name="extractDirectory"></param> <param name="wantExtract"></param><param name="options"></param><returns></returns>
 private static List<TarEntry> ListOrExtract(
     string archive, string extractDirectory, bool wantExtract, Options options)
 {
     var t = new Tar { TarOptions = options ?? new Options() };
     return t.InternalListOrExtract(archive, extractDirectory, wantExtract);
 }