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

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

            ftpConnection.SetCurrentDirectory(parentDirectory);

            return(ftpConnection.FileExists(filePath));
        }
コード例 #2
0
ファイル: FtpExtensions.cs プロジェクト: vlad1000/ModioX
        /// <summary>
        /// Downloads the specified console file to the computer
        /// </summary>
        /// <param name="filePath">Path of the uploading file directory</param>
        internal static bool FileExists(string filePath)
        {
            FtpConnection ftpConnection = MainWindow.FtpConnection;

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

            ftpConnection.SetCurrentDirectory(dirPath);

            return(ftpConnection.FileExists(filePath));
        }
コード例 #3
0
        /// <summary>
        ///     Uninstall modded files specified in the InstallPath from the users console, ignore game specific files as this
        ///     could cause game to stop working (only .sprx files)
        /// </summary>
        /// <param name="ipAddress">Console address to connect to</param>
        /// <param name="modItem">Mod to uninstall</param>
        internal static void UninstallModFiles(string ipAddress, ModsData.ModItem modItem)
        {
            foreach (string installFilePath in modItem.InstallPaths)
            {
                using (FtpConnection ps3 = new FtpConnection(ipAddress))
                {
                    string dirPath = installFilePath.Contains("/")
                        ? installFilePath.Substring(0, installFilePath.LastIndexOf('/')) + '/'
                        : "dev_hdd0/";

                    string fileName = installFilePath.Contains("/")
                        ? installFilePath.Substring(installFilePath.LastIndexOf('/')).Replace("/", "").Replace("//", "")
                        : installFilePath;

                    if (ps3.FileExists(installFilePath) && !installFilePath.StartsWith("dev_hdd0/game/{REGION}/", StringComparison.InvariantCultureIgnoreCase))
                    {
                        ps3.RemoveFile(installFilePath);
                    }
                }
            }
        }