0

I have to make a program to back up my IDM download list every day, because there is other ones using my computer and they removing my download list.

IDM API only lets me add download to IDM list, so is there any library or other way to back up my IDM download list using C#?

thanks for helping

  • I don't use this particular application so I can't be sure, but the first thing I'd look into would be UI Automation. See if it exposes the control (listbox?) that holds the desired list, using something like UIA Verify. If that doesn't work, then the brute force approach would be to read its memory using PInvoke. – Setsu Mar 03 '15 at 22:09
  • Well you can always create another user for `other ones`... – Hossain Muctadir Mar 03 '15 at 22:34
  • @Setsu I'm not a pro, but I guess both of these ways needs application to be running, and won't work if it is hidden or closed, please enlighten me if I'm wrong with some non-MSDN example because MSDN website is so complicated for me! I need the program to get the list anyway! no matter application is hidden or not running (there is a free program called IDM backup manager which is gets the IDM download list while IDM is not running) thanks – Sepehr Parsa Mar 03 '15 at 22:38
  • thank you @Muctadir but I tried all normal ways! they always using my account and I really want this program to be written! – Sepehr Parsa Mar 03 '15 at 22:40
  • I think Muctadir has a point. The simplest solution would be to just get them to use individual (user) accounts rather than deal with this beast of a problem you have here. Trying to coerce another program to do your bidding is never easy; this is especially true if you find MSDN difficult to use. – Setsu Mar 03 '15 at 22:44
  • @Setsu I tried, my siblings won't help me through it, so I have to do it like sneaky ways!! I always do this kind of stuffs in hard ways! but thanks for the advise anyway. – Sepehr Parsa Mar 03 '15 at 22:47
  • @SepehrParsa That's unfortunate. On second thought, IDM is most likely saving that list somewhere on the disk, and it's probably going to be plain text. If you can find it you can just archive that file directly. The first places I would look would be in "My Documents" or "\{username}\AppData\". – Setsu Mar 03 '15 at 22:52
  • OMG @Setsu you are a genius! I already made a bat file for backing up the IDM info and there is this registry key which is contains all info about the downloads, its: HKEY_CURRENT_USER\Software\DownloadManager but there is a question: this key contains a lots of numerical named keys which contains a value named Url0 that have the links in it. how can I get all Data of string values named Url0 under this key? please answer it as an answer so i can accept it :) – Sepehr Parsa Mar 03 '15 at 23:00
  • @SepehrParsa See [this question](http://stackoverflow.com/questions/18232972/how-to-read-value-of-a-registry-key-c-sharp). If you come up with a solution in C#, post a concise sample that demonstrates the key functionality and post it as an answer. As it stands this question has little to do with C#. – Setsu Mar 03 '15 at 23:09

1 Answers1

0

Thanks to @Setsu found out a solution. there is a key in registry which contains all of the URLs. the key is HKEY_CURRENT_USER\Software\DownloadManager and it contains keys which contains values named Url0 with the URL in it.

As an example HKEY_CURRENT_USER\Software\DownloadManager\85\Url0 contains one of added link to IDM download list.

So I searched all of the HKEY_CURRENT_USER\Software\DownloadManager subkeys for Url0 and saved the values to a list box using this code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace IDMListSaver
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\DownloadManager");
            string[] keys = key.GetSubKeyNames();
            for (int i = 0; i <= key.SubKeyCount-1; i++)
            {
                key = key.OpenSubKey(keys[i]);
                Object o = key.GetValue("Url0");
                if (o != null)
                {
                    listBox1.Items.Add(o);
                }
                key = Registry.CurrentUser.OpenSubKey("Software\\DownloadManager");
            }
        }
    }
}

It definitely can get better, but it solved my problem until here.

So thanks again @Setsu