コード例 #1
0
        public async Task <ActionResult> Post_File_Import(IFormFile file, string name)
        {
            try
            {
                if (Path.GetExtension(file.FileName) == ".txt")
                {
                    FileHandeling fileHandeling = new FileHandeling();
                    fileHandeling.Create_File_Import();
                    var new_Path = string.Empty;
                    var path     = Path.Combine($"Upload", file.FileName);
                    using (var this_file = new FileStream(path, FileMode.Create))
                    {
                        await file.CopyToAsync(this_file);

                        new_Path = Path.GetFullPath(this_file.Name);
                    }
                    fileHandeling.Compress_Huffman(new_Path, name);
                    fileHandeling.Delete_Import(path);
                    return(Ok("El archivo ha sido comprimido exitosamente!"));
                }
                return(BadRequest("El archivo enviado no es de extensión .txt"));
            }
            catch (Exception e)
            {
                return(StatusCode(500, "Archivo corrupto o no válido - " + e.Message));
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: EbGu3/Laboratorio3_EDII
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            CompressLZW compressLZW = new CompressLZW();

            while (true)
            {
                Console.WriteLine("\t..::LZW::..");
                Console.WriteLine("Ingrese una opción:");
                Console.WriteLine("  1)Compresión");
                Console.WriteLine("  2)Salir");
                var           option        = Console.ReadLine();
                var           RUTA          = string.Empty;
                var           newName       = string.Empty;
                FileHandeling fileHandeling = new FileHandeling();
                switch (option)
                {
                case "1":
                    Console.WriteLine("Ingrese el texto a comprimir");
                    var Texto_Comprimir  = Console.ReadLine();
                    var Texto_Comprimido = compressLZW.Compress_Text(Texto_Comprimir);
                    Console.WriteLine($"El texto comprimido es: {Texto_Comprimido}");
                    Console.ReadKey();
                    break;

                case "2":
                    Console.WriteLine("Saliendo...");
                    Environment.Exit(1);
                    break;

                default:
                    Console.WriteLine("Por favor seleccione una opción válida.");
                    break;
                }
            }
        }
コード例 #3
0
        private void btnAddStudentIDDocuments_Click(object sender, EventArgs e)
        {
            List <Data.Models.File> StudentIDDocumentsToUploaded = FileHandeling.UploadFile(
                UseMultipleFileSelect: true,
                AutomaicallyAddFileToDatabase: false,
                ImagesOnly: false);

            if (StudentIDDocumentsToUploaded.Count > 0)
            {
                using (var Dbconnection = new MCDEntities())
                {
                    foreach (Data.Models.File f in StudentIDDocumentsToUploaded)
                    {
                        Dbconnection.StudentIDDocuments.Add(new StudentIDDocument()
                        {
                            FileID    = f.FileID,
                            StudentID = this.CurrentStudentID,
                            File      = f
                        });
                        Dbconnection.SaveChanges();
                    }
                };
                this.refreshStudentIDDocumnets();
            }
        }
コード例 #4
0
        private void btnStudentPictureAdd_Click(object sender, EventArgs e)
        {
            StudentPictureToUploaded = FileHandeling.UploadFile(UseMultipleFileSelect: false, AutomaicallyAddFileToDatabase: false, ImagesOnly: true);

            if (StudentPictureToUploaded.Count > 0)
            {
                if (CurrentStudentID != 0)
                {
                    using (var Dbconnection = new MCDEntities())
                    {
                        Data.Models.File f = StudentPictureToUploaded.FirstOrDefault <Data.Models.File>();
                        Dbconnection.Files.Add(f);
                        Dbconnection.SaveChanges();

                        //Dbconnection.Files.Attach(f);
                        Dbconnection.StudentPhotos.Add(new StudentPhoto()
                        {
                            FileID         = f.FileID,
                            StudentID      = CurrentStudentID,
                            DateUpdated    = DateTime.Now,
                            StudentPhotoID = 0
                        });
                        Dbconnection.SaveChanges();
                    };
                }
            }

            ShowStudentPicture();
            switchStudentPictureButtons();
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <File> UploadedFiles = FileHandeling.UploadFile();

            foreach (File CurrentFile in UploadedFiles)
            {
            }
        }
コード例 #6
0
 public ActionResult Get_File()
 {
     try
     {
         FileHandeling fileHandeling = new FileHandeling();
         return(Ok(fileHandeling.Get_Compress("Huffman")));
     }
     catch (Exception e)
     {
         return(StatusCode(500, "No se han realizado compresiones previas - " + e.Message));
     }
 }
コード例 #7
0
ファイル: Form1.cs プロジェクト: Lirababe/Impendulo
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            List <File> UploadedFiles = FileHandeling.UploadFile();

            foreach (File CurrentFile in UploadedFiles)
            {
                /*
                 * Must Add Logic here to Link the inserted file to which ever entity that it maybe associated with.
                 * ****************************************************************************************************/
            }
            loadFiles();
        }
コード例 #8
0
 private void lnkUploadEnrollmentForm_Click(object sender, EventArgs e)
 {
     removeAllEnrollmentForms();
     CurrentEnrollmentFormDocument = FileHandeling.UploadFile();
     if (CurrentEnrollmentFormDocument.Count > 0)
     {
         lblEnrollmentFormStatus.Text          = "Completed Uploaded";
         lblEnrollmentFormStatus.BackColor     = Color.Green;
         chkEnrollmentFormNotAvailable.Checked = true;
     }
     else
     {
         lblEnrollmentFormStatus.Text      = "Not Uploaded";
         lblEnrollmentFormStatus.BackColor = Color.Red;
     }
     populateFileSummaryList();
 }
コード例 #9
0
        private void lnkUploadIDDocument_LinkClicked(object sender, EventArgs e)
        {
            removeAllIDDocuments();

            CurrentIDDocument = FileHandeling.UploadFile();
            if (CurrentIDDocument.Count > 0)
            {
                lblIDDocumentStatus.Text          = "Completed Uploaded";
                lblIDDocumentStatus.BackColor     = Color.Green;
                chkIDDocumentNotAvailable.Checked = true;
            }
            else
            {
                lblIDDocumentStatus.Text      = "Not Uploaded";
                lblIDDocumentStatus.BackColor = Color.Red;
            }
            populateFileSummaryList();
        }
コード例 #10
0
        private void btnUploadMessageTamplateAttachments_Click(object sender, EventArgs e)
        {
            List <File> UploadedFiles = FileHandeling.UploadFile();

            using (var Dbconnection = new MCDEntities())
            {
                MessageTemplate hh = CurrentMessageTemplate;
                Dbconnection.MessageTemplates.Attach(CurrentMessageTemplate);
                foreach (Data.Models.File x in UploadedFiles)
                {
                    Dbconnection.Files.Attach(x);
                    CurrentMessageTemplate.Files.Add(x);
                }

                Dbconnection.SaveChanges();

                this.refreshMessage();
            };
        }
コード例 #11
0
        private void dgvEnollmentFiles_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            switch (e.ColumnIndex)
            {
            case 0:


                var  FileObj = fileBindingSource.Current;
                File x       = new File();
                //loop through the properties of the object you want to covert:
                foreach (PropertyInfo pi in FileObj.GetType().GetProperties())
                {
                    try
                    {
                        //get the value of property and try
                        //to assign it to the property of T type object:
                        x.GetType().GetProperty(pi.Name).SetValue(x, pi.GetValue(FileObj, null), null);
                    }
                    catch { }
                }

                folderBrowserDialogForDownloading.ShowDialog();

                if (folderBrowserDialogForDownloading.SelectedPath.Length > 0)
                {
                    try
                    {
                        File   CurrentFile = FileHandeling.GetFile(x.FileID);
                        string path        = folderBrowserDialogForDownloading.SelectedPath + "\\" + x.FileName;
                        System.IO.File.WriteAllBytes(path, CurrentFile.FileImage);
                        MessageBox.Show(x.FileName + ", Successfully Saved to: " + path, "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                break;
            }
        }
コード例 #12
0
        private void btnStudentPictureUpdate_Click(object sender, EventArgs e)
        {
            List <Data.Models.File> FileToUpdate = FileHandeling.UploadFile(UseMultipleFileSelect: false, AutomaicallyAddFileToDatabase: false, ImagesOnly: true);


            Data.Models.File f = StudentPictureToUploaded.FirstOrDefault <Data.Models.File>();
            if (CurrentStudentID != 0)
            {
                using (var Dbconnection = new MCDEntities())
                {
                    Dbconnection.Files.Attach(f);
                    Dbconnection.Entry(f).State = EntityState.Modified;
                    f.FileImage = FileToUpdate.First <Data.Models.File>().FileImage;
                    Dbconnection.SaveChanges();
                };
            }
            else
            {
                f.FileImage = FileToUpdate.First <Data.Models.File>().FileImage;
            }
            ShowStudentPicture();
        }
コード例 #13
0
        public void Compress_File(FileStream ArchivoImportado, string nameFile = null)
        {
            Dictionary <string, int> diccionario_LZW = new Dictionary <string, int>();
            var      Extension = Path.GetExtension(ArchivoImportado.Name);
            var      PropiedadesArchivoActual = new Files();
            FileInfo ArchivoAnalizado         = new FileInfo(ArchivoImportado.Name);

            PropiedadesArchivoActual.TamanoArchivoDescomprimido = ArchivoAnalizado.Length;
            PropiedadesArchivoActual.NombreArchivoOriginal      = ArchivoAnalizado.Name;
            var ListaCaracteresExistentes = new List <byte>();
            var ListaCaracteresBinario    = new List <string>();
            var ASCIIescribir             = new List <int>();

            using (var Lectura = new BinaryReader(ArchivoImportado))
            {
                using (FileStream writeStream = new FileStream($"Compress/" + nameFile + ".lzw", FileMode.OpenOrCreate))
                {
                    PropiedadesArchivoActual.RutaArchivoComprimido = Path.GetFullPath(writeStream.Name);
                    using (BinaryWriter writer = new BinaryWriter(writeStream))
                    {
                        const int BufferLength = 100;
                        var       byteBuffer   = new byte[BufferLength];
                        while (Lectura.BaseStream.Position != Lectura.BaseStream.Length)
                        {
                            byteBuffer = Lectura.ReadBytes(BufferLength);
                            foreach (var item in byteBuffer)
                            {
                                if (!ListaCaracteresExistentes.Contains(item))
                                {
                                    ListaCaracteresExistentes.Add(item);
                                }
                            }
                        }
                        ListaCaracteresExistentes.Sort();
                        foreach (var item in ListaCaracteresExistentes)
                        {
                            var caractreres = Convert.ToChar(item);
                            diccionario_LZW.Add(caractreres.ToString(), diccionario_LZW.Count + 1);
                        }
                        var diccionarioTam = Convert.ToString(diccionario_LZW.LongCount()) + ".";
                        writer.Write(diccionarioTam.ToCharArray());
                        Lectura.BaseStream.Position = 0;
                        var thisCaracter = string.Empty;
                        var myOutput     = string.Empty;
                        while (Lectura.BaseStream.Position != Lectura.BaseStream.Length)
                        {
                            byteBuffer = Lectura.ReadBytes(BufferLength);
                            foreach (byte item in byteBuffer)
                            {
                                var toAnalizar = thisCaracter + Convert.ToChar(item);
                                if (diccionario_LZW.ContainsKey(toAnalizar))
                                {
                                    thisCaracter = toAnalizar;
                                }
                                else
                                {
                                    ASCIIescribir.Add(diccionario_LZW[thisCaracter]);
                                    diccionario_LZW.Add(toAnalizar, diccionario_LZW.Count + 1);
                                    thisCaracter = Convert.ToChar(item).ToString();
                                }
                            }
                        }
                        ASCIIescribir.Add(diccionario_LZW[thisCaracter]);
                        var textotamano = Convert.ToString(diccionario_LZW.LongCount()) + ".";
                        writer.Write(textotamano.ToCharArray());
                        foreach (var item in ListaCaracteresExistentes)
                        {
                            var Indice = Convert.ToByte(item);
                            writer.Write(Indice);
                        }
                        writer.Write(Environment.NewLine);
                        var mayorIndice     = ASCIIescribir.Max();
                        var bitsIndiceMayor = (Convert.ToString(mayorIndice, 2)).Count();
                        writer.Write(bitsIndiceMayor.ToString().ToCharArray());
                        writer.Write(Extension.ToCharArray());
                        writer.Write(Environment.NewLine);
                        if (mayorIndice > 255)
                        {
                            foreach (var item in ASCIIescribir)
                            {
                                var indiceBinario = Convert.ToString(item, 2);
                                while (indiceBinario.Count() < bitsIndiceMayor)
                                {
                                    indiceBinario = "0" + indiceBinario;
                                }
                                ListaCaracteresBinario.Add(indiceBinario);
                            }
                            var allBits = string.Empty;
                            foreach (var item in ListaCaracteresBinario)
                            {
                                for (int i = 0; i < item.Length; i++)
                                {
                                    if (allBits.Count() < 8)
                                    {
                                        allBits += item[i];
                                    }
                                    else
                                    {
                                        var allDecimal = Convert.ToInt64(allBits, 2);
                                        var allBytes   = Convert.ToByte(allDecimal);
                                        writer.Write((allBytes));
                                        allBits  = string.Empty;
                                        allBits += item[i];
                                    }
                                }
                            }
                            if (allBits.Length > 0)
                            {
                                var allResultado = Convert.ToInt64(allBits, 2);
                                writer.Write(Convert.ToByte(allResultado));
                            }
                        }
                        else
                        {
                            foreach (var item in ASCIIescribir)
                            {
                                writer.Write(Convert.ToByte(Convert.ToInt32(item)));
                            }
                        }
                        List <Files> PilaArchivosComprimidos = new List <Files>();
                        PropiedadesArchivoActual.TamanoArchivoComprimido = writeStream.Length;
                        PropiedadesArchivoActual.FactorCompresion        = Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoComprimido) / Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoDescomprimido);
                        PropiedadesArchivoActual.RazonCompresion         = Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoDescomprimido) / Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoComprimido);
                        PropiedadesArchivoActual.PorcentajeReduccion     = (Convert.ToDouble(1) - PropiedadesArchivoActual.FactorCompresion).ToString();
                        PilaArchivosComprimidos.Add(PropiedadesArchivoActual);
                        FileHandeling fileHandeling = new FileHandeling();
                        fileHandeling.Compressed(PilaArchivosComprimidos, Path.GetFileNameWithoutExtension(ArchivoImportado.Name), "LZW");
                    }
                }
            }
        }
コード例 #14
0
 public void Decompress_File(FileStream importFile)
 {
     using (var reader = new BinaryReader(importFile))
     {
         var diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         var countDiccionary    = string.Empty;
         while (diccionaryCaracter != '.')
         {
             countDiccionary   += diccionaryCaracter;
             diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         }
         var countText = string.Empty;
         diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         while (diccionaryCaracter != '.')
         {
             countText         += diccionaryCaracter;
             diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         }
         diccionaryCaracter = Convert.ToChar(reader.PeekChar());
         var writeByte      = reader.ReadByte();
         var DiccionarioCar = new Dictionary <int, string>();
         while (DiccionarioCar.Count != Convert.ToInt32(countDiccionary))
         {
             if (!DiccionarioCar.ContainsValue(Convert.ToString(Convert.ToChar(writeByte))))
             {
                 DiccionarioCar.Add(DiccionarioCar.Count + 1, Convert.ToString(Convert.ToChar(writeByte)));
             }
             writeByte = reader.ReadByte();
         }
         reader.ReadByte();
         reader.ReadByte();
         diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         var bitLenght = " ";
         while (diccionaryCaracter != '.')
         {
             bitLenght         += diccionaryCaracter;
             diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         }
         diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         var extension = Path.GetExtension(importFile.Name);
         while (diccionaryCaracter != '\u0002')
         {
             extension         += diccionaryCaracter;
             diccionaryCaracter = Convert.ToChar(reader.ReadByte());
         }
         extension = "." + extension;
         var byteNow      = string.Empty;
         var compressList = new List <int>();
         reader.ReadByte();
         reader.ReadByte();
         while (reader.BaseStream.Position != reader.BaseStream.Length && compressList.Count < Convert.ToInt32(countText))
         {
             var readedByte = Convert.ToString(reader.ReadByte(), 2);
             while (readedByte.Length < 8)
             {
                 readedByte = "0" + readedByte;
             }
             byteNow += readedByte;
             if (Convert.ToInt32(bitLenght) > 8)
             {
                 if (byteNow.Length >= Convert.ToInt32(bitLenght))
                 {
                     var thisComprimido = string.Empty;
                     for (int i = 0; i < Convert.ToInt32(bitLenght); i++)
                     {
                         thisComprimido += byteNow[i];
                     }
                     compressList.Add(Convert.ToInt32(thisComprimido, 2));
                     byteNow = byteNow.Substring(Convert.ToInt32(bitLenght));
                 }
             }
             else
             {
                 compressList.Add(Convert.ToInt32(byteNow, 2));
                 byteNow = string.Empty;
             }
         }
         if (byteNow.Length > 0)
         {
             compressList[compressList.Count - 1] = compressList[compressList.Count - 1] + Convert.ToInt32(byteNow, 2);
         }
         var first = DiccionarioCar[compressList[0]];
         compressList.RemoveAt(0);
         var Decompressed = new System.Text.StringBuilder(first);
         importFile.Close();
         FileHandeling fileHandeling = new FileHandeling();
         var           fileName      = fileHandeling.Get_Name("LZW", importFile.Name);
         using (FileStream newFile = new FileStream($"Decompress/" + fileName, FileMode.OpenOrCreate))
         {
             using (StreamWriter writer = new StreamWriter(newFile))
             {
                 foreach (var item in compressList)
                 {
                     var analis = string.Empty;
                     if (DiccionarioCar.ContainsKey(item))
                     {
                         analis = DiccionarioCar[item];
                     }
                     else if (item == DiccionarioCar.Count + 1)
                     {
                         analis = first + first[0];
                     }
                     Decompressed.Append(analis);
                     DiccionarioCar.Add(DiccionarioCar.Count + 1, first + analis[0]);
                     first = analis;
                 }
                 writer.Write(Decompressed.ToString());
             }
         }
     }
 }
コード例 #15
0
        /// <summary>
        /// Obtiene un archivo comprimido con extensión huff y devuelve el archivo original con extensión .txt
        /// </summary>
        /// <param name="fileToDecompress"></param>
        public void Decompress_File(FileStream fileToDecompress)
        {
            FileHandeling fileHandeling = new FileHandeling();
            var           fileName      = fileHandeling.Get_Name("Huffman", fileToDecompress.Name);
            var           full_path     = $"Decompress\\" + fileName + ".txt";

            using (FileStream archivo = new FileStream(full_path, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                int    contador       = 0;
                int    contadorCarac  = 0;
                int    CantCaracteres = 0;
                int    CaracteresDif  = 0;
                string texto          = string.Empty;
                string acumula        = "";
                byte   auxiliar       = 0;
                int    bufferLength   = 80;
                var    buffer         = new byte[bufferLength];
                string textoCifrado   = string.Empty;
                fileToDecompress.Close();
                using (var file = new FileStream(fileToDecompress.Name, FileMode.Open))
                {
                    using (var reader = new BinaryReader(file))
                    {
                        while (reader.BaseStream.Position != reader.BaseStream.Length)
                        {
                            buffer = reader.ReadBytes(bufferLength);
                            foreach (var item in buffer)
                            {
                                if (contador == ((CaracteresDif * 2) + 2) && contadorCarac < CantCaracteres)
                                {
                                    texto = Convert.ToString(item, 2);
                                    if (texto.Length < 8)
                                    {
                                        texto = texto.PadLeft(8, '0');
                                    }
                                    acumula = acumula + texto;
                                    int    cont         = 0;
                                    int    canteliminar = 0;
                                    string validacion   = "";
                                    foreach (var item2 in acumula)
                                    {
                                        validacion = validacion + item2;
                                        cont++;
                                        if (Data.Instance.DicCarcacteres.ContainsKey(validacion))
                                        {
                                            archivo.WriteByte(Data.Instance.DicCarcacteres[validacion]);
                                            acumula = acumula.Substring(cont);
                                            cont    = 0;
                                            contadorCarac++;
                                            canteliminar = cont;
                                            validacion   = "";
                                        }
                                    }
                                }
                                if (item != 44)
                                {
                                    byte[] byteCarac = { item };
                                    texto = texto + Encoding.ASCII.GetString(byteCarac);
                                }
                                if (item == 44 && contador > 1 && contador < ((CaracteresDif * 2) + 2))
                                {
                                    if (item == 44 && contador % 2 == 0)
                                    {
                                        auxiliar = Convert.ToByte(texto, 2);
                                        texto    = string.Empty;
                                        contador++;
                                    }
                                    else if (contador % 2 != 0 && item == 44)
                                    {
                                        Data.Instance.DicCarcacteres.Add(texto, auxiliar);
                                        texto = string.Empty;
                                        contador++;
                                    }
                                }
                                else
                                {
                                    if (item == 44 && contador == 0)
                                    {
                                        CantCaracteres = int.Parse(texto);
                                        texto          = string.Empty;
                                        contador++;
                                    }
                                    else if (item == 44 && contador == 1)
                                    {
                                        CaracteresDif = int.Parse(texto);
                                        texto         = string.Empty;
                                        contador++;
                                    }
                                }
                            }
                        }
                        reader.ReadBytes(bufferLength);
                    }
                }
            };
            Data.Instance.DicCarcacteres.Clear();
        }
コード例 #16
0
        /// <summary>
        /// Obtiene un archivo de texto para devolver un archivo comprimido con extensión .huff
        /// </summary>
        /// <param name="fileToCompress"></param>
        /// <param name="name"></param>
        public void Compress_File(FileStream fileToCompress, string name)
        {
            var huffman = new Huffman();
            var PropiedadesArchivoActual = new Files();

            PropiedadesArchivoActual.TamanoArchivoDescomprimido = fileToCompress.Length;
            var full_path = $"Compress\\" + name + ".huff";

            fileToCompress.Close();
            var direccion          = Path.GetFullPath(fileToCompress.Name);
            int cantidadCaracteres = huffman.Read(direccion);

            huffman.Create_Tree();
            byte[] encabezado = huffman.Create_Header(cantidadCaracteres);
            using (FileStream ArchivoComprimir = new FileStream(full_path, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                PropiedadesArchivoActual.NombreArchivoOriginal = Path.GetFileNameWithoutExtension(fileToCompress.Name);
                PropiedadesArchivoActual.RutaArchivoComprimido = Path.GetFullPath(ArchivoComprimir.Name);
                foreach (var item in encabezado)
                {
                    ArchivoComprimir.WriteByte(item);
                }
                int    bufferLength = 80;
                var    buffer       = new byte[bufferLength];
                string textoCifrado = string.Empty;
                using (var file = new FileStream(fileToCompress.Name, FileMode.Open))
                {
                    using (var reader = new BinaryReader(file))
                    {
                        while (reader.BaseStream.Position != reader.BaseStream.Length)
                        {
                            buffer = reader.ReadBytes(bufferLength);
                            foreach (var item in buffer)
                            {
                                int posiList;
                                posiList     = Data.Instance.codeList.FindIndex(x => x.caracter == item);
                                textoCifrado = textoCifrado + Data.Instance.codeList.ElementAt(posiList).codigo;
                                if ((textoCifrado.Length / 8) > 0)
                                {
                                    string escribirByte = textoCifrado.Substring(0, 8);
                                    byte   byteEscribir = Convert.ToByte(escribirByte, 2);
                                    ArchivoComprimir.WriteByte(byteEscribir);
                                    textoCifrado = textoCifrado.Substring(8);
                                }
                            }
                        }
                        reader.ReadBytes(bufferLength);
                        List <Files> PilaArchivosComprimidos = new List <Files>();
                        PropiedadesArchivoActual.TamanoArchivoComprimido = ArchivoComprimir.Length;
                        PropiedadesArchivoActual.RazonCompresion         = Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoComprimido) / Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoDescomprimido);
                        PropiedadesArchivoActual.FactorCompresion        = Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoDescomprimido) / Convert.ToDouble(PropiedadesArchivoActual.TamanoArchivoComprimido);
                        PropiedadesArchivoActual.PorcentajeReduccion     = (Convert.ToDouble(1) - PropiedadesArchivoActual.RazonCompresion).ToString();
                        PilaArchivosComprimidos.Add(PropiedadesArchivoActual);
                        FileHandeling fileHandeling = new FileHandeling();
                        fileHandeling.Compressed(PilaArchivosComprimidos, Path.GetFileNameWithoutExtension(fileToCompress.Name), "Huffman");
                    }
                }
                if (textoCifrado.Length > 0 && (textoCifrado.Length % 8) == 0)
                {
                    byte byteEsc = Convert.ToByte(textoCifrado, 2);
                }
                else if (textoCifrado.Length > 0)
                {
                    textoCifrado = textoCifrado.PadRight(8, '0');
                    byte byteEsc = Convert.ToByte(textoCifrado, 2);
                }
            }
        }