Beispiel #1
0
        void compresion_StartCompressElements(object sender, Pdf2Comic_ImageCompress.StartCompressEventArgs e)
        {
            pbBarraProgreso.Visible = true;
            pbBarraProgreso.Maximum = e.totalElements;
            pbBarraProgreso.Step = 1;
            pbBarraProgreso.Minimum = 1;

            lbStep.Text = "Compress Images...";
            lbStep.Visible = true;
        }
Beispiel #2
0
        private void Comprimir_Imagenes()
        {
            List<string> paths = new List<string>();
            foreach(ListViewItem item in lvImageList.Items)
            {
                paths.Add(item.Tag.ToString());
            }

            //Comprimimos las imagenes
            Pdf2Comic_ImageCompress compresion = new Pdf2Comic_ImageCompress(paths, Path.GetFileNameWithoutExtension(nombreArchivoPDF));
            compresion.StartCompressElements += compresion_StartCompressElements;
            compresion.StopCompressElements += compresion_StopCompressElements;
            compresion.NewElementCompress += compresion_NewElementCompress;

            compresion.Comprimir(Path.Combine(new string[] { pathArchivo, Path.GetFileNameWithoutExtension(nombreArchivoPDF) + ".zip" }));

            //Renombramos el archivo zip
            string antiguoPath = Path.Combine(new string[] { pathArchivo, Path.GetFileNameWithoutExtension(nombreArchivoPDF) + ".zip" });
            string nuevoPath = Path.Combine(new string[] { pathArchivo, Path.GetFileNameWithoutExtension(nombreArchivoPDF) + ".cbz" });

            if(File.Exists(nuevoPath))
            {
                if(MessageBox.Show("The File Exist, ¿Overwrite?", "Attention!!!",  MessageBoxButtons.YesNo) == DialogResult.OK)
                {
                    File.Delete(nuevoPath);
                    File.Move(antiguoPath, nuevoPath);
                }
            }
            else
                File.Move(antiguoPath, nuevoPath);

            //Borramos las images del disco duro
            foreach(string path in paths)
            {
                File.Delete(path);
            }
        }
Beispiel #3
0
 void compresion_NewElementCompress(object sender, Pdf2Comic_ImageCompress.CompressElementEventArgs e)
 {
     pbBarraProgreso.PerformStep();
 }
Beispiel #4
0
 void compresion_StopCompressElements(object sender, Pdf2Comic_ImageCompress.StopCompressEventArgs e)
 {
     pbBarraProgreso.Visible = false;
     lbStep.Visible = false;
 }