Maximize
Bookmark

VX Heaven

Library Collection Sources Engines Constructors Simulators Utilities Links Forum

Finding DC++ ShareFolders Via Xml in C#

Retro
Ready Rangers Liberation Front [7]
April 2006

[Back to index] [Comments]

Intro

If you dont already know, DC++ is a free open-source P2P client, like edonkey or kazaa. On the eve of writting of this code, I had never heard of DC++. It wasn't untill I asked a friend about the most common P2P clients today, his first answer as he's coming at me was, DC++. So as i'm bangaging my wounds, I installed DC to see what the hype was about. Unlike eDonkey for example, DC lets you choose which folders to share with others by default, whereas eDonkey creates it's own, in My Documents. All of DC settings are contained in a XML in the root install dir, wherever that maybe, called 'DCPlusPlus.xml'.

Requirements

For the code, i'm using Visual Studio .NET 2005 Beta 2, along side .NET 2.0 Framework. I had too many problems working with 1.1, and so I upgraded. It should work with 1.1 but you may need to edit 'XmlReader.Create' to 'New XmlReader' but dont quote me on that.

The code

                               
static void dcShares()
{
        // Check to see if DCPlusPlus is installed
        RegistryKey p2pKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\DC++");

        // Get the installation key
        object p2p = p2pKey.GetValue("Install_Dir");

        // If the key isnt there, then exit if statement
        if (p2p == null) { }
        else
        {
                // Append backslash too Path
                p2p += @"\";

                // Open the Config File
                XmlReader xmlRead = XmlReader.Create(p2p + "
DCPlusPlus.xml");

                // Read Xml File
                while (xmlRead.Read())
                {
                        // If the current node is 'Directory'
                        if (xmlRead.Name == "
Directory")
                        {
                                // Read the element
                                string dccShare = xmlRead.ReadString();
                               
                                // Show folder
                                Console.WriteLine(dccShare);
                        }
                }

                // Close the XmlReader
                xmlRead.Close();
        }
}

Outro

As you can see its very easy to understand, and can be applied to anything you wish, but obviously you'd want to copy itself to the folders though. Anyway enjoy the code.

http://retro.host.sk - www.rrlf.de.vu

By accessing, viewing, downloading or otherwise using this content you agree to be bound by the Terms of Use! vxheaven.org aka vx.netlux.org
deenesitfrplruua