/// <summary>
        /// This function, when called upon, will connect to the provided Xbox Console, making it ready to initialize other functions.
        /// </summary>
        public void Connect()
        {
            //If we are not connected..
            if (!Connected)
            {
                //Initialize a new Xbox_Manager
                Xbox_Manager = new XDevkit.XboxManagerClass();
                //Initialize a new Xbox Console by Opening it with our Xbox Manager
                Xbox_Console = Xbox_Manager.OpenConsole(XboxName);
                //Open our connection to the xbox, set our connection code.
                Connection_Code = Xbox_Console.OpenConnection(null);


                try
                {
                    //Assign our Kit type
                    Xbox_Type = Xbox_Console.ConsoleType.ToString();
                }
                catch { }
                //Initialize our FileSystem class
                File_System = new FileSystem(Xbox_Console);
                //Set our bool indicating we are now connected
                Connected = true;
            }
        }
 /// <summary>
 /// This function, when initialized, will disconnect from the connected xbox.
 /// </summary>
 public void Disconnect()
 {
     //If we are connected
     if (Connected)
     {
         //Send our text command
         SendTextCommand("bye");
         //Close our connection with our connection code
         Xbox_Console.CloseConnection(Connection_Code);
         //Close our xbdm connection.
         //Xbdm.CloseConnection(dmSession);
         //Null our Xbox FileSystem
         File_System = null;
         //Set our bool as disconnected.
         Connected = false;
     }
 }
        /// <summary>
        /// This function, when called upon, will send a text command to the Xbox, and the Xbox will process this command, and send a response back.
        /// </summary>
        /// <param name="Command">The command to use.</param>
        /// <returns>Returns the response.</returns>
        public string SendTextCommand(string Command)
        {
            //Initialize our response string.
            string Response = "";

            //Send the text command and retrieve the response.
            Xbox_Console.SendTextCommand(Connection_Code, Command, out Response);

            if (Response.Contains("202") | Response.Contains("203"))
            {
                try
                {
                    //Loop.
                    while (true)
                    {
                        //Create our temporary string.
                        string tmp = "";

                        //Receive our line of text.
                        Xbox_Console.ReceiveSocketLine(Connection_Code, out tmp);

                        //If  the line isn't blank.
                        if (tmp.Length > 0)
                        {
                            //If the first character isn't .
                            if (tmp[0] != '.')
                            {
                                //Add it to our response.
                                Response += Environment.NewLine + tmp;
                            }
                            //Otherwise.
                            else
                            {
                                //Break.
                                break;
                            }
                        }
                    }
                }
                catch { }
            }

            //Return the response
            return(Response);
        }
            /// <summary>
            ///  This function, when called upon, will return all directories in a directory with their full filename.
            /// </summary>
            /// <param name="directory"></param>
            /// <returns></returns>
            public string[] GetDirectories(string directory)
            {
                //Obtain our Xbox Files and Directories.
                XDevkit.IXboxFiles xboxFiles = Xbox_Console.DirectoryFiles(directory);
                //Initialize a string list.
                List <string> directoryNames = new List <string>();

                //Loop through all the "xboxFiles"
                foreach (XDevkit.IXboxFile xboxFile in xboxFiles)
                {
                    //If the file is a directory
                    if (xboxFile.IsDirectory)
                    {
                        //Add it to the list
                        directoryNames.Add(xboxFile.Name);
                    }
                }
                //Return the list as a string[]
                return(directoryNames.ToArray());
            }
            /// <summary>
            /// This function, when called upon, will remove a directory at the path given.
            /// </summary>
            /// <param name="directory"></param>
            public void DeleteDirectory(string directory)
            {
                //Get our list of files for this folder
                string[] files = GetFiles(directory);
                //For each file in this folder
                foreach (string file in files)
                {
                    //Delete the file.
                    DeleteFile(file);
                }

                //Get our list of directories for this folder
                string[] folders = GetDirectories(directory);
                //For each folder in this folder
                foreach (string folder in folders)
                {
                    //Delete the folder
                    DeleteDirectory(folder);
                }

                //Remove the directory.
                Xbox_Console.RemoveDirectory(directory);
            }
 /// <summary>
 ///  This function, when called upon, will download a file to your local harddrive, from the remote(Xbox) harddrive.
 /// </summary>
 public void DownloadFile(string localName, string remoteName)
 {
     //Download our file
     Xbox_Console.ReceiveFile(localName, remoteName);
 }
 /// <summary>
 /// This function, when called upon, will create the directory specified.
 /// </summary>
 /// <param name="directory"></param>
 public void CreateDirectory(string directory)
 {
     //Make the directory specified.
     Xbox_Console.MakeDirectory(directory);
 }
 /// <summary>
 /// This function, when called upon, will delete a file at the remote location.
 /// </summary>
 /// <param name="remoteName"></param>
 public void DeleteFile(string remoteName)
 {
     //Delete the file at the remote name.
     Xbox_Console.DeleteFile(remoteName);
 }
 /// <summary>
 /// This function, when called upon, will rename a file on the Xbox 360 Development Kit
 /// </summary>
 /// <param name="remoteName"></param>
 /// <param name="newRemoteName"></param>
 public void RenameFile(string remoteName, string newRemoteName)
 {
     //Rename our file to the new filename
     Xbox_Console.RenameFile(remoteName, newRemoteName);
 }
 /// <summary>
 ///  This function, when called upon, will upload a file from your local harddrive, to the remote(Xbox) harddrive.
 /// </summary>
 public void UploadFile(string localName, string remoteName)
 {
     //Upload our file
     Xbox_Console.SendFile(localName, remoteName);
 }
 /// <summary>
 /// This function, when called upon, will capture a .dds screencapture from your Xbox Development Kit and save it to the specified location
 /// </summary>
 /// <param name="savePath"></param>
 public void Screenshot(string savePath)
 {
     //Capture our screenshot
     Xbox_Console.ScreenShot(savePath);
 }