internal static void UploadFile(string localFile, string consoleFile) { FtpConnection ftpConnection = MainWindow.FtpConnection; string path = consoleFile.Contains("/") ? (consoleFile.Substring(0, consoleFile.LastIndexOf('/')) + "/") : "dev_hdd0/"; string remoteFile = consoleFile.Contains("/") ? consoleFile.Substring(consoleFile.LastIndexOf('/')).Replace("/", "").Replace("//", "") : consoleFile; if (!ftpConnection.DirectoryExists(path)) { CreateDirectory(path); } ftpConnection.SetCurrentDirectory(path); ftpConnection.PutFile(localFile, remoteFile); }
/// <summary> /// Upload the specified local file to the appropriate location on the console /// </summary> /// <param name="ipAddress">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 InstallFile(string ipAddress, string localFile, string consoleFile) { using (FtpConnection ps3 = new FtpConnection(ipAddress)) { var fileName = consoleFile.Contains("/") ? consoleFile.Substring(consoleFile.LastIndexOf('/')).Replace("/", "").Replace("//", "") : consoleFile; var dirPath = consoleFile.Contains("/") ? consoleFile.Substring(0, consoleFile.LastIndexOf('/')) + '/' : "dev_hdd0/"; ps3.SetCurrentDirectory(dirPath); ps3.PutFile(localFile, fileName); } }
/// <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(FtpConnection ftpConnection, string localFile, string consoleFile) { 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); }