コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public static void Run(IDialogParent parent)
        {
            var form = new FFmpegDownloaderForm();

            parent.ShowDialogWithTempMute(form);
        }