Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to call method of mdi child form from mdi parent form Pin
0x3c021-Aug-09 3:27
0x3c021-Aug-09 3:27 
QuestionUnable to read Private Key as XML String Pin
Jadhav Ajay21-Aug-09 2:25
professionalJadhav Ajay21-Aug-09 2:25 
AnswerRe: Unable to read Private Key as XML String Pin
Keith Barrow21-Aug-09 3:04
professionalKeith Barrow21-Aug-09 3:04 
GeneralRe: Unable to read Private Key as XML String Pin
Jadhav Ajay22-Aug-09 0:37
professionalJadhav Ajay22-Aug-09 0:37 
QuestionObjectDisposedException within a while loop? Pin
Trapper-Hell21-Aug-09 1:56
Trapper-Hell21-Aug-09 1:56 
AnswerRe: ObjectDisposedException within a while loop? Pin
Gideon Engelberth21-Aug-09 3:46
Gideon Engelberth21-Aug-09 3:46 
AnswerRe: ObjectDisposedException within a while loop? Pin
Luc Pattyn21-Aug-09 4:21
sitebuilderLuc Pattyn21-Aug-09 4:21 
GeneralRe: ObjectDisposedException within a while loop? Pin
Trapper-Hell23-Aug-09 20:19
Trapper-Hell23-Aug-09 20:19 
First of all I would like to thank you for taking the time to reply Smile | :) You really seem like you want to help Wink | ;) So, I totally agree with you that by simplifying the code I might also be hiding the problem.

The program functions as follows. At every specified interval, the application extracts an image from a ZIP file according to "liked shoots" since this is based on a group of photographers each having their own shoots submitting, and so on...

The code in demand is a follows:

private byte[] GetShootImage(ZipFile originalZipFile, string pass, string shootName)
{
while (fm.LikedShoots.Count > 0) // fm is a class containing the "liked shoots" - by names
{
    ZipFile shootZipFile = originalZipFile; // <-- ERROR OCCURS HERE!!
    ZipEntry zipEntry = shootZipFile.GetEntry(fm.LikedShoots[0]);

    if (zipEntry != null)
    {
        TempSaveStream(shootZipFile.GetInputStream(zipEntry), zipEntry.Size, true); // Saves the an entry of the ZipFile (which is yet another ZipFile to a temporary file (C:\WINDOWS\Temp)

        zipEntry = null;

        shootZipFile.Close();
        shootZipFile = null;

        shootZipFile = new ZipFile("C:\\WINDOWS\\Temp\\TpTmp\\temp.tmp");
        shootZipFile.Password = pass;

        // For each photo in the Shoot...
        foreach (ZipEntry entry in shootZipFile)
        {
            // If Image is not generated
            if (!fm.ImageGenerated(fm.LikedShoots[0] + "\\" + entry.Name))
            {
                // List the Image in the GeneratedPhotos list
                fm.GeneratedPhotos.Add(fm.LikedShoots[0] + "\\" + entry.Name);

                // Get the Image in a byte[] (instead of saving it)
                buffer = TempSaveStream(shootZipFile.GetInputStream(entry), entry.Size, false);

                shootZipFile.Close();
                shootZipFile = null;

                return buffer;
            }
        }
    }

    // Add the Shoot to the ExhaustedShoot list
    fm.ExhaustedShoots.Add(fm.LikedShoots[0]);
    // Remove the Shoot from the LikedShoots list
    fm.LikedShoots.RemoveAt(0);
}
}


On the 2nd loop, the marked line of code throws an ObjectDisposedException within the originalZipFile object. However, as you can see, originalZipFile is not set to null or anything. Can the GC have collected it or what?

In the mean, I would like to thank you so much for taking the time to reply.
GeneralRe: ObjectDisposedException within a while loop? Pin
Luc Pattyn24-Aug-09 2:46
sitebuilderLuc Pattyn24-Aug-09 2:46 
GeneralRe: ObjectDisposedException within a while loop? Pin
Trapper-Hell24-Aug-09 20:19
Trapper-Hell24-Aug-09 20:19 
Questionhow to sync the data of two table? Pin
Tridip Bhattacharjee21-Aug-09 1:55
professionalTridip Bhattacharjee21-Aug-09 1:55 
AnswerRe: how to sync the data of two table? Pin
xstoneheartx21-Aug-09 3:28
xstoneheartx21-Aug-09 3:28 
AnswerRe: how to sync the data of two table? Pin
Mycroft Holmes21-Aug-09 17:08
professionalMycroft Holmes21-Aug-09 17:08 
Questionlink in dynamic menu Pin
rummer21-Aug-09 1:48
rummer21-Aug-09 1:48 
AnswerBad forum etiquette - don't post the same thing more than once Pin
Pete O'Hanlon21-Aug-09 1:56
mvePete O'Hanlon21-Aug-09 1:56 
GeneralRe: Bad forum etiquette - don't post the same thing more than once Pin
EliottA21-Aug-09 2:49
EliottA21-Aug-09 2:49 
QuestionToolStrip Scrolling Pin
Tiger45621-Aug-09 1:19
Tiger45621-Aug-09 1:19 
AnswerRe: ToolStrip Scrolling Pin
xstoneheartx21-Aug-09 3:40
xstoneheartx21-Aug-09 3:40 
QuestionDynamic menu Pin
rummer21-Aug-09 0:58
rummer21-Aug-09 0:58 
QuestionHow to open multiple pdf files Pin
kanchoette21-Aug-09 0:54
kanchoette21-Aug-09 0:54 
AnswerRe: How to open multiple pdf files Pin
stancrm21-Aug-09 0:58
stancrm21-Aug-09 0:58 
QuestionCan I use RequireFieldValidator or should I just try to write code to check two textboxes entry? Pin
vanillaET21-Aug-09 0:27
vanillaET21-Aug-09 0:27 
AnswerRe: Can I use RequireFieldValidator or should I just try to write code to check two textboxes entry? Pin
Pete O'Hanlon21-Aug-09 1:00
mvePete O'Hanlon21-Aug-09 1:00 
Question[Message Deleted] Pin
RS.Ratheesh21-Aug-09 0:01
RS.Ratheesh21-Aug-09 0:01 
AnswerRe: Selectable, resizable and movable Shapes Pin
Eddy Vluggen21-Aug-09 0:20
professionalEddy Vluggen21-Aug-09 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.