private void MenuItemAddProfileDetails_ItemClick(object sender, ItemClickEventArgs e) { try { string fileName = DialogExtensions.ShowOpenFileDialog(this, "Load Profile", ""); if (!fileName.IsNullOrEmpty()) { if (XtraMessageBox.Show(this, $"Would you like to save this profile?", "Save Profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string localProfilePath = Path.Combine(UserFolders.XboxProfiles, Path.GetFileName(fileName) + @"\"); string localProfileFilePath = Path.Combine(UserFolders.XboxProfiles, Path.GetFileName(fileName) + @"\" + Path.GetFileName(fileName)); Directory.CreateDirectory(localProfilePath); File.Copy(fileName, localProfileFilePath + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bak"); } LoadProfile(fileName); } } catch (Exception ex) { UpdateStatus($"Unable to load profile details.", ex); XtraMessageBox.Show(this, $"Unable to load profile details. Error Message: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ImageFileLocation_Click(object sender, EventArgs e) { string fileLocation = DialogExtensions.ShowOpenFileDialog(this, "Choose File", "All Files|*.*"); if (!fileLocation.IsNullOrEmpty()) { TextBoxFileLocation.Text = fileLocation; } }
private void MenuItemReplace_ItemClick(object sender, ItemClickEventArgs e) { string fileName = DialogExtensions.ShowOpenFileDialog(this, "Replace Image", "PNG Image|*.png"); if (!fileName.IsNullOrEmpty()) { FileInfo fileInfo = new(fileName); if (fileInfo.Length <= 12000) { ImagePackage.LoadAsync(fileName); } else { XtraMessageBox.Show(this, "Image file size is too big!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/// <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(); } }