コード例 #1
0
    public void DownloadRandomFile()
    {
        ftp ftpClient = new ftp("ftp://xo2.x10hosting.com/public_html/Uploads/", "dioramaw", "1qaz@WSX3edc$RFV");

        string[] simpleDirectoryListing = ftpClient.directoryListSimple("/");
        //UpdateLog("Number of uploaded Dioramas: " + (simpleDirectoryListing.Length - 2));
        int i = UnityEngine.Random.Range(2, simpleDirectoryListing.Length - 1);

        ftpClient.download(simpleDirectoryListing[i], Globals.TEMPFOLDER + "temp.dio");
        ftpClient = null;
    }
コード例 #2
0
    public List <string> GetAllFiles()
    {
        List <string> files     = new List <string>();
        ftp           ftpClient = new ftp("ftp://xo2.x10hosting.com/public_html/Uploads/", "dioramaw", "1qaz@WSX3edc$RFV");

        /* Get Contents of a Directory (Names Only) */
        string[] simpleDirectoryListing = ftpClient.directoryListSimple("/");
        for (int i = 0; i < simpleDirectoryListing.Count(); i++)
        {
            if (simpleDirectoryListing[i].LastIndexOf(".dio") > 0)
            {
                files.Add(simpleDirectoryListing[i]);
            }
        }
        ftpClient = null;

        files = files.OrderByDescending(q => q).ToList();

        return(files);
    }