Getting back variables after a program crashes
<p>I am trying to find a way to get back my previous variable's value so that I can resume my application to it's previous running state before it crashed when I MANUALLY relaunch it. I am currently using a 'config' file that is saved in the project folder. Is there a better way to do this?</p>

<p>Some small parts of my code that I want to save.</p>

<pre><code>if (EventID == WIA.EventID.wiaEventItemCreated)
        {
            if (d != null)
            {
                foreach (Property p in d.Properties)
                {
                    if (p.Name.Equals("Pictures Taken"))
                        Console.WriteLine("Taken");
                }

                wiaImageFile = (WIA.ImageFile)(d.Items[d.Items.Count].Transfer(FormatID.wiaFormatJPEG));
                wiaImageFile.SaveFile(Properties.Settings.Default.FolderNameRaw + "\\" + imageCount + ".jpg");
                imageCount++;//I want to save this count so that I can continue the sequence even after the application crashes
                Pluck.Default.PhotoExistsInDirectory = true;
                FacebookControls fbc = new FacebookControls();
                if(Properties.Settings.Default.UseFB == true)
                    fbc.UploadPhotos();


            }
        }
</code></pre>
