public static void SaveAsFile(this Bitmap bitmap, IGameInfo game, string suffix, string systemId, PathEntryCollection paths, IDialogParent parent) { using var sfd = new SaveFileDialog { FileName = $"{game.FilesystemSafeName()}-{suffix}", InitialDirectory = paths.ScreenshotAbsolutePathFor(systemId), Filter = FilesystemFilterSet.Screenshots.ToString(), RestoreDirectory = true }; if (parent.ShowDialogWithTempMute(sfd) != DialogResult.OK) { return; } var file = new FileInfo(sfd.FileName); string extension = file.Extension.ToUpper(); ImageFormat i = extension switch { ".BMP" => ImageFormat.Bmp, _ => ImageFormat.Png, }; bitmap.Save(file.FullName, i); }
public static FileInfo SaveFileDialog(string currentFile, string path, FilesystemFilterSet filterSet, IDialogParent parent) { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } using var sfd = new SaveFileDialog { FileName = Path.GetFileName(currentFile), InitialDirectory = path, Filter = filterSet.ToString(), RestoreDirectory = true }; var result = parent.ShowDialogWithTempMute(sfd); return(result.IsOk() ? new FileInfo(sfd.FileName) : null); }
public static void Run(IDialogParent parent) { var form = new FFmpegDownloaderForm(); parent.ShowDialogWithTempMute(form); }