コード例 #1
0
ファイル: FtpExtensions.cs プロジェクト: vlad1000/ModioX
        /// <summary>
        /// Downloads the specified console file to the computer
        /// </summary>
        /// <param name="localFile">Path of the local file</param>
        /// <param name="consoleFile">Path of the uploading file directory</param>
        internal static void DownloadFile(string localFile, string consoleFile)
        {
            FtpConnection ftpConnection = MainWindow.FtpConnection;

            string dirPath = consoleFile.Contains("/")
                ? consoleFile.Substring(0, consoleFile.LastIndexOf('/')) + '/'
                : "dev_hdd0/";

            ftpConnection.SetLocalDirectory(Path.GetDirectoryName(localFile));
            ftpConnection.SetCurrentDirectory(dirPath);

            if (File.Exists(localFile))
            {
                File.Delete(localFile);
            }

            if (FileExists(consoleFile))
            {
                ftpConnection.GetFile(consoleFile, localFile, false);
            }
        }
コード例 #2
0
ファイル: FtpExtensions.cs プロジェクト: Doregon/ModioX
        /// <summary>
        /// Downloads the specified console file to the computer
        /// </summary>
        /// <param name="localFile"> Path of the local file </param>
        /// <param name="consoleFile"> Path of the uploading file directory </param>
        internal static void DownloadFile(string localFile, string consoleFile)
        {
            FtpConnection ftpConnection = MainWindow.FtpConnection;

            Program.Log.Info("Local file: " + localFile);
            Program.Log.Info("Console file: " + consoleFile);

            string parentDirectory = Path.GetDirectoryName(consoleFile).Replace(@"\", "/");

            ftpConnection.SetLocalDirectory(Path.GetDirectoryName(localFile));
            ftpConnection.SetCurrentDirectory(parentDirectory);

            if (File.Exists(localFile))
            {
                File.Delete(localFile);
            }

            if (FileExists(consoleFile))
            {
                ftpConnection.GetFile(consoleFile, localFile, false);
            }
        }