Ejemplo n.º 1
0
        public void UploadLocalFile()
        {
            try
            {
                string type = GridViewLocalFiles.GetRowCellValue(GridViewLocalFiles.FocusedRowHandle, "Type").ToString();
                string name = GridViewLocalFiles.GetRowCellValue(GridViewLocalFiles.FocusedRowHandle, "Name").ToString();

                if (type.Equals("file"))
                {
                    string localPath   = TextBoxLocalPath.Text + name;
                    string consolePath = TextBoxConsolePath.Text + name;

                    if (File.Exists(localPath))
                    {
                        SetLocalStatus($"Uploading file to {consolePath}...");

                        if (ConsoleType == ConsoleTypePrefix.PS3)
                        {
                            FtpExtensions.UploadFile(localPath, consolePath);
                        }
                        else
                        {
                            XboxConsole.SendFile(localPath, consolePath);
                        }

                        SetLocalStatus($"Successfully uploaded file: {Path.GetFileName(localPath)}");
                        LoadConsoleDirectory(DirectoryPathConsole);
                    }
                    else
                    {
                        SetLocalStatus("Unable to upload file as it doesn't exist on your computer.");
                    }
                }
                else if (type.Equals("folder"))
                {
                    string localPath   = TextBoxLocalPath.Text + name + @"\";
                    string consolePath = TextBoxConsolePath.Text + name;

                    SetLocalStatus($"Uploading folder to {consolePath}...");
                    //FtpClient.UploadDirectory(localPath, consolePath, FtpFolderSyncMode.Update, FtpRemoteExists.Overwrite);
                    SetLocalStatus($"Successfully uploaded folder: {localPath}");
                    LoadConsoleDirectory(DirectoryPathConsole);
                }
            }
            catch (Exception ex)
            {
                SetLocalStatus($"Unable to upload to console. Error: {ex.Message}", ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Upload a selected package file from the computer to console's packages folder.
        /// </summary>
        private void InstallPackage()
        {
            string localFilePath = DialogExtensions.ShowOpenFileDialog(this, "Choose Package File", "PKG Files (*.pkg)|*.pkg");

            if (!string.IsNullOrWhiteSpace(localFilePath))
            {
                string fileName        = Path.GetFileName(localFilePath);
                string installFilePath = PackageFilesPath + "/" + fileName;

                if (FtpClient.FileExists(installFilePath))
                {
                    DarkMessageBox.ShowError("Package file with this name already exists on your console.", "Package File Exists");
                    return;
                }

                UpdateStatus("Installing package file: " + fileName);
                FtpExtensions.UploadFile(localFilePath, installFilePath);
                UpdateStatus("Successfully installed package file.");
                LoadPackages();
            }
        }
Ejemplo n.º 3
0
        public void UploadLocalFile()
        {
            try
            {
                var type      = DgvLocalFiles.CurrentRow.Cells[0].Value.ToString();
                var localName = DgvLocalFiles.CurrentRow.Cells[2].Value.ToString();

                if (type.Equals("file"))
                {
                    var localPath   = TextBoxLocalPath.Text + localName;
                    var consolePath = TextBoxConsolePath.Text + localName;

                    if (File.Exists(localPath))
                    {
                        SetLocalStatus($"Uploading file to {consolePath}...");
                        FtpExtensions.UploadFile(MainWindow.FtpConnection, localPath, consolePath);
                        SetLocalStatus($"Successfully uploaded file: {Path.GetFileName(localPath)}");
                        LoadConsoleDirectory(FtpDirectoryPath);
                    }
                    else
                    {
                        SetLocalStatus("Unable to upload file as it doesn't exist on your computer.");
                    }
                }
                else if (type.Equals("folder"))
                {
                    var localPath   = TextBoxLocalPath.Text + localName + @"\";
                    var consolePath = TextBoxConsolePath.Text + localName;

                    SetLocalStatus($"Uploading folder to {consolePath}...");
                    //MainWindow.FtpClient.UploadDirectory(localPath, consolePath, FtpFolderSyncMode.Update, FtpRemoteExists.Overwrite);
                    SetLocalStatus($"Successfully uploaded folder: {localPath}");
                    LoadConsoleDirectory(FtpDirectoryPath);
                }
            }
            catch (Exception ex)
            {
                SetLocalStatus($"Unable to upload to console. Error: {ex.Message}", ex);
            }
        }