CSL_Test__1.DirectoryHandler.UnzipFiles C# (CSharp) Method

UnzipFiles() public method

public UnzipFiles ( string zipFiles ) : List
zipFiles string
return List
        public List<FileInfo> UnzipFiles(string[] zipFiles)
        {
            List<FileInfo> items = new List<FileInfo>();
            List<FileInfo> fileinfos = new List<FileInfo>();
            foreach (string zipfile in zipFiles)
            {
                try
                {
                    fileinfos.Add(new FileInfo(zipfile));
                }
                catch (Exception e)
                {
                    LogError(e.Message + "\n" + e.StackTrace);
                }
            }

            FastZip fz = new FastZip();
            ErrorWindow ew = new ErrorWindow();

            string[] files = null;
            string filename;
            DirectoryInfo destination;
            int total = zipFiles.Length;
            double progress = 0;
            double count = 0;
            foreach (FileInfo zipfile in fileinfos)
            {
                filename = zipfile.Name;
                filename = filename.Replace(zipfile.Extension, "");
                string dest = SettingsHandler.GetTorrentSaveFolder() + @"\[CSL]--Temp\" + filename + @"\";
                destination = new DirectoryInfo(dest);
                if (!destination.Exists)
                {
                    try
                    {
                        destination.Create();
                    }
                    catch (Exception e)
                    {
                        LogError(e.Message + "\n" + e.StackTrace);
                    }
                }

                try
                {
                    fz.ExtractZip(zipfile.FullName, destination.FullName, ".torrent");
                }
                catch (Exception) { ew.IssueGeneralWarning("No action necessary", "Warning: Could not unzip " + filename, zipfile.Name); }

                try
                {
                    files = Directory.GetFiles(destination.FullName,
                        "*.torrent", SearchOption.AllDirectories);
                }
                catch (DirectoryNotFoundException) { ew.IssueGeneralWarning("No action necessary", "Warning: " + filename + "was empty", zipfile.Name); }

                finally
                {
                    foreach (string file in files)
                    {
                        try
                        {
                            items.Add(new FileInfo(file));
                        }
                        catch (Exception e)
                        {
                            LogError(e.Message + "\n" + e.StackTrace);
                        }
                    }
                }

                progress = (++count / total) * 100;

                if (progress <= 100 && progress >= 0)
                    ReportProgress((int)progress);
            }

            return items;
        }