Exemplo n.º 1
0
        static void ZipFolder(string pathFolder, string pathZipped)
        {
            Manage_Zip zipped = new Manage_Zip();
            int        res;

            if (File.Exists(pathZipped))
            {
                DialogResult dialogResult = MessageBox.Show("Zipped file already exist, should we delet it ?", "Oh NOOOOOO", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    try
                    {
                        File.Delete(pathZipped);
                        res = zipped.ZipFolder(pathFolder, pathZipped);
                        if (res == 1)
                        {
                            MessageBox.Show("error zipping folder", "error");
                        }
                        ;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("error occured : " + ex.ToString());
                        return;
                    }
                }
                else if (dialogResult == DialogResult.No)
                {
                    MessageBox.Show("Ok abording");
                    return;
                }
            }
            else
            {
                try
                {
                    Console.WriteLine("file does no exist");
                    res = zipped.ZipFolder(pathFolder, pathZipped);
                    if (res == 0)
                    {
                        MessageBox.Show("error zipping folder", "error");
                    }
                    ;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    MessageBox.Show("error occured : " + ex.ToString());
                    return;
                }
            }
        }
Exemplo n.º 2
0
        static void UnzipData(string pathfile, string pathOut)
        {
            Manage_Zip zipped = new Manage_Zip();

            zipped.UnzipFolder(pathfile, pathOut);
        }