Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1087473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:56:37+00:00 2026-05-16T22:56:37+00:00

I have a small problem, which might me a stupid mistake on my side.

  • 0

I have a small problem, which might me a stupid mistake on my side.

Here is my code to create a zipfile when needed and the method to add a file to the archive.

Adding a file works without problem but for some reason the Event is not fired after saving.

I set a breakpoint at zipFile_SaveProgress, the event is not fired.


class CoverArchive
{
        private ZipFile zipFile;
        private String coverArchivePath;

        public CoverArchive()
        {        
            coverArchivePath = "Archive\\Covers";

            if (!File.Exists("Archive\\Covers"))
            {
                CreateZipFile();
            }
            using (zipFile = ZipFile.Read(coverArchivePath))
            {
                //zipFile.AddProgress += zipFile_AddProgress;
                //zipFile.ExtractProgress += zipFile_ExtractProgress;
                //zipFile.ZipError += zipFile_ZipError;
                zipFile.SaveProgress += zipFile_SaveProgress;
            }
        }

        private void CreateZipFile()
        {
            zipFile = new ZipFile();
            zipFile.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
            zipFile.UseUnicodeAsNecessary = true;
            if (!Directory.Exists("Archive"))
                Directory.CreateDirectory("Archive");
            zipFile.Save(coverArchivePath);
        }

        public void AddCover(List<String> directories, String coverName, Stream fileStream)
        {
            try
            {
                using (zipFile = ZipFile.Read(coverArchivePath))
                {
                    String filePath = createPath(directories, coverName);
                    ZipEntry entry = zipFile.AddEntry(filePath, fileStream);
                    zipFile.Save();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error adding File" + ex);
            }
        }
        private void zipFile_SaveProgress(Object sender, SaveProgressEventArgs e)
        {
            if (e.EventType == ZipProgressEventType.Saving_Completed)
                Console.WriteLine("Save Done");
        }
}

Thanks a lot in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:56:37+00:00Added an answer on May 16, 2026 at 10:56 pm

    You’re adding the event handling after calling Save().
    Therefore, when it raised the SaveProgress event, there weren’t any handlers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a small problem here which i cannot fix,This post goes through but
I have a small problem which i can't seem to figure out. I tried
I have a small problem which i can't seem to solve myself. Look at
Dear community members, I have a small problem, which involves a text input field
Problem: Have made a small mail program which works perfectly on my developer pc
So here I believe I have a small buffer overflow problem I found when
have small problem, and would very much appreciate help :) I should convert byte
I have small problem with Spring MVC. Basically what I'm trying to do is
I have a small problem and I've figured out where when and why it
I have a small problem with the visibility of an ellipse. In runtime I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.