raocarlos600
9/18/2018 - 1:51 PM

UNZIP

Obtener dll de system32.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.IO;
using System.IO.Compression;
using Shell32;

namespace DescomprimirZIP
{
    class Program
    {
        [STAThread] 
        static void Main(string[] args)
        {
            string sourcePath = @ConfigurationManager.AppSettings["DirectorioPendientes"].ToString();
            string targetPath = @ConfigurationManager.AppSettings["DirectorioProcesados"].ToString();
            if (Directory.Exists(sourcePath))
            {
                string[] fileEntries = Directory.GetFiles(sourcePath);

                if (fileEntries.Length > 0)
                {
                    foreach (string fileNameWithPath in fileEntries)
                    {
                        string fileName = Path.GetFileName(fileNameWithPath);
                        //descomprimir
                        
                        Shell32.Shell objShell = new Shell32.Shell();
                        Shell32.Folder destinationFolder = objShell.NameSpace(sourcePath);
                        Shell32.Folder sourceFile = objShell.NameSpace(fileNameWithPath);

                        foreach (var file in sourceFile.Items())
                        {
                            destinationFolder.CopyHere(file, 4 | 16);
                        }


                        //tratar fichero
                        //mover fichero
                    }
                }
                else
                {
                }

            }
        }

    }
}