Example #1
0
        /// <summary>
        /// Upload a local file to the specified location on the console
        /// </summary>
        /// <param name="ftpConnection">PS3 IP address</param>
        /// <param name="localFile">Path of the local file</param>
        /// <param name="consoleFile">Path of the uploading file directory</param>
        internal static void UploadFile(string localFile, string consoleFile)
        {
            FtpConnection ftpConnection = MainWindow.FtpConnection;

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

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

            if (!ftpConnection.DirectoryExists(dirPath))
            {
                CreateDirectory(dirPath);
            }

            ftpConnection.SetCurrentDirectory(dirPath);
            ftpConnection.PutFile(localFile, fileName);
        }
Example #2
0
        /// <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);
            }
        }
Example #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);
                    }
                }
            }
        }
Example #4
0
        /// <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);
            }
        }
Example #5
0
 public FtpDirectoryInfo(FtpConnection ftp, string path)
 {
     this._ftp     = ftp;
     base.FullPath = path;
 }