Example #1
0
        /// <summary>
        /// Des the compress file.
        /// </summary>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="destinationPath">The destination path.</param>
        /// <param name="deCompressed">The de compressed.</param>
        /// <returns>
        /// True if successful
        /// </returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public bool DeCompressFile(string sourcePath, string destinationPath, out DeCompressedElement deCompressed)
        {
            bool result = false;

            deCompressed = null;
            try
            {
                FileInfo fileToDecompress = new FileInfo(sourcePath);
                using (FileStream originalFileStream = fileToDecompress.OpenRead())
                {
                    string currentFileName = fileToDecompress.FullName;
                    string newFileName     = currentFileName.Remove(currentFileName.Length - fileToDecompress.Extension.Length);

                    using (FileStream decompressedFileStream = File.Create(newFileName))
                    {
                        using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress))
                        {
                            decompressionStream.CopyTo(decompressedFileStream);
                            /*TODO:Implement the deCompressed object logic*/
                            // Console.WriteLine("Decompressed: {0}", fileToDecompress.Name);
                        }
                    }
                }
            }
            catch (Exception)
            {
                result = false;
            }

            return(result);
        }
Example #2
0
 /// <summary>
 /// Des the compress file.
 /// </summary>
 /// <param name="sourcePath">The source path.</param>
 /// <param name="destinationPath">The destination path.</param>
 /// <param name="deCompressed">The de compressed.</param>
 /// <returns>
 /// True if successful
 /// </returns>
 public bool DeCompressFile(string sourcePath, string destinationPath, out DeCompressedElement deCompressed)
 {
     bool result = false;
     try
     {
        // System.IO.Compression.ZipFile.ExtractToDirectory(sourcePath, destinationPath);
         deCompressed = new DeCompressedElement(new object(), new FileInfo(sourcePath), false);
     }
     catch(Exception)
     {
         deCompressed = null;
     }
     return result;
 }
Example #3
0
        /// <summary>
        /// Des the compress file.
        /// </summary>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="destinationPath">The destination path.</param>
        /// <param name="deCompressed">The de compressed.</param>
        /// <returns>
        /// True if successful
        /// </returns>
        public bool DeCompressFile(string sourcePath, string destinationPath, out DeCompressedElement deCompressed)
        {
            bool result = false;

            try
            {
                // System.IO.Compression.ZipFile.ExtractToDirectory(sourcePath, destinationPath);
                deCompressed = new DeCompressedElement(new object(), new FileInfo(sourcePath), false);
            }
            catch (Exception)
            {
                deCompressed = null;
            }
            return(result);
        }
Example #4
0
 /// <summary>
 /// Des the compress file.
 /// </summary>
 /// <param name="sourcePath">The source path.</param>
 /// <param name="destinationPath">The destination path.</param>
 /// <param name="deCompressed">The de compressed.</param>
 /// <returns>
 /// True if successful
 /// </returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public bool DeCompressFile(string sourcePath, string destinationPath, out DeCompressedElement deCompressed)
 {
     throw new NotImplementedException();
 }
Example #5
0
        /// <summary>
        /// Des the compress file.
        /// </summary>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="destinationPath">The destination path.</param>
        /// <param name="deCompressed">The de compressed.</param>
        /// <returns>
        /// True if successful
        /// </returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public bool DeCompressFile(string sourcePath, string destinationPath, out DeCompressedElement deCompressed)
        {
            bool result = false;
            deCompressed = null;
            try
            {
                FileInfo fileToDecompress = new FileInfo(sourcePath);
                using (FileStream originalFileStream = fileToDecompress.OpenRead())
                {
                    string currentFileName = fileToDecompress.FullName;
                    string newFileName = currentFileName.Remove(currentFileName.Length - fileToDecompress.Extension.Length);

                    using (FileStream decompressedFileStream = File.Create(newFileName))
                    {
                        using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress))
                        {
                            decompressionStream.CopyTo(decompressedFileStream);
                            /*TODO:Implement the deCompressed object logic*/
                            // Console.WriteLine("Decompressed: {0}", fileToDecompress.Name);
                        }
                    }
                }
            }
            catch(Exception)
            {
                result = false;
            }

            return result;
        }
Example #6
0
 /// <summary>
 /// Des the compress file.
 /// </summary>
 /// <param name="sourcePath">The source path.</param>
 /// <param name="destinationPath">The destination path.</param>
 /// <param name="deCompressed">The de compressed.</param>
 /// <returns>
 /// True if successful
 /// </returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public bool DeCompressFile(string sourcePath, string destinationPath, out DeCompressedElement deCompressed)
 {
     throw new NotImplementedException();
 }