コード例 #1
0
        /// <summary>
        ///     Returns the users game region, either automatically set region by searching existing console directories or prompt
        ///     the user to select one
        /// </summary>
        /// <param name="ipAddress">Selected game</param>
        /// <param name="game">Automatically retrieve users region</param>
        /// <param name="detectRegion">Automatically retrieve users region</param>
        /// <returns></returns>
        internal static string GetUsersGameRegion(string ipAddress, GamesData.Game game, bool detectRegion)
        {
            if (detectRegion)
            {
                using (var ps3 = new FtpConnection(ipAddress))
                    foreach (var region in game.Regions)
                    {
                        if (ps3.DirectoryExists($"dev_hdd0/game/{region}/"))
                        {
                            return(region);
                        }
                    }
            }
            else
            {
                Windows.RegionsWindow frmRegions = new Windows.RegionsWindow();
                foreach (var region in game.Regions)
                {
                    frmRegions.ListViewRegions.Items.Add(new DarkUI.Controls.DarkListItem()
                    {
                        Text = region
                    });
                }
                frmRegions.ShowDialog();
                return(frmRegions.SelectedRegion);
            }

            return(null);
        }
コード例 #2
0
ファイル: FtpExtensions.cs プロジェクト: Doregon/ModioX
        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);
        }
コード例 #3
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(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);
        }