Пример #1
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">Mod to uninstall</param>
        /// <param name="remoteFile">Mod to uninstall</param>
        /// <param name="modItem">Mod to uninstall</param>
        internal static void DownloadOriginalGameFile(string ipAddress, string remoteFile, ModsData.ModItem modItem)
        {
            /*foreach (var installFilePath in modInfo.InstallPaths)
             * {
             *  using (var ps3 = new FtpConnection(ipAddress))
             *  {
             *      if (ps3.FileExists(installFilePath) && !installFilePath.StartsWith("dev_hdd0/game/{REGION}/", StringComparison.InvariantCultureIgnoreCase))
             *          ps3.RemoveFile(installFilePath);
             *  }
             * }*/

            using (FtpConnection ps3 = new FtpConnection(ipAddress))
            {
                string dirPath = remoteFile.Contains("/")
                    ? remoteFile.Substring(0, remoteFile.LastIndexOf('/')) + '/'
                    : "dev_hdd0/";

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

                string localFilePath = $@"{AppDataPath}{modItem.GameId}\{modItem.Name}\";

                Directory.CreateDirectory(localFilePath);

                ps3.SetCurrentDirectory(dirPath);
                ps3.GetFile(remoteFile, $@"{localFilePath}{fileName}".Replace("/", @"\"), false);
                //ps3.PutFile(localFile, fileName);
            }
        }
Пример #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);
            }
        }
Пример #3
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);
            }
        }