Backup the queue

Wouldn’t it be nice if DC++ could update your queue in case DC++ die or a mouse knaws on the power cable or something?

Download the source and fire up Visual Studio because here we go!

Add this line

File::copyFile(getQueueFile(), getQueueFile() + “.backup”);

to the end of QueueManager::saveQueue().
Now, every time saveQueue() is called the file ‘Queue.xml.backup’ will be created.

So, when is saveQueue() called? 1) When DC++ shut down. 2) When it has gone 10 seconds since the last save and the queue is ‘dirty’. That is, when something has been removed or added (well, yes, and changed…).
So, our backup will be created each time DC++ closes. And when DC++ start? Fine… I’ll throw in if you also close the queue…

Add

saveQueue();

to QueueManager::~QueueManager(). This will have DC++ create the backup when the download queue window is closed.

Add

QueueManager::getInstance()->saveQueue();

to MainFrame::OnCreate(…). This will have DC++ create the backup when DC++ start.

One Response to Backup the queue

  1. Ullner says:

    From the old blog:
    ####
    Excellent Upgrade! Good idea to save the que, but please add the Favorites list, to save hub sites logins and passwords. It would be nice to add a email section too. (an older version Zeroed my list and it took a couple of weeks to get back to half the hubs, thr rest were gone.) Consider offering a standard and /or just a Premium version .
    .6811 has been very quick after i applied big buffers, i will post more on machine to machine speed tests.
    Thanks again
    Jim
    Publicerad av Jim Sherrwood – 2006-01-30 13:41:18

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: