当前位置: 首页>>代码示例>>C#>>正文


C# SaveFileDialog.ShowHawkDialog方法代码示例

本文整理汇总了C#中System.Windows.Forms.SaveFileDialog.ShowHawkDialog方法的典型用法代码示例。如果您正苦于以下问题:C# SaveFileDialog.ShowHawkDialog方法的具体用法?C# SaveFileDialog.ShowHawkDialog怎么用?C# SaveFileDialog.ShowHawkDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.SaveFileDialog的用法示例。


在下文中一共展示了SaveFileDialog.ShowHawkDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTasProjSaveFileFromUser

		public static FileInfo GetTasProjSaveFileFromUser(string currentFile)
		{
			var sfd = new SaveFileDialog();
			if (!string.IsNullOrWhiteSpace(currentFile))
			{
				sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
				sfd.InitialDirectory = Path.GetDirectoryName(currentFile);
			}
			else if (!(Global.Emulator is NullEmulator))
			{
				sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
				sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);
			}
			else
			{
				sfd.FileName = "NULL";
				sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);
			}

			sfd.Filter = "Tas Project Files (*.tasproj)|*.tasproj|All Files|*.*";
			sfd.RestoreDirectory = true;
			var result = sfd.ShowHawkDialog();
			if (result != DialogResult.OK)
			{
				return null;
			}

			return new FileInfo(sfd.FileName);
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:29,代码来源:ToolHelpers.cs

示例2: SaveFileDialog

		public static FileInfo SaveFileDialog(string currentFile, string path, string fileType, string fileExt)
		{
			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
			}

			var sfd = new SaveFileDialog
			{
				FileName = !string.IsNullOrWhiteSpace(currentFile)
					? Path.GetFileName(currentFile)
					: PathManager.FilesystemSafeName(Global.Game) + "." + fileExt,
				InitialDirectory = path,
				Filter = string.Format("{0} (*.{1})|*.{1}|All Files|*.*", fileType, fileExt),
				RestoreDirectory = true,
			};

			var result = sfd.ShowHawkDialog();
			if (result != DialogResult.OK)
			{
				return null;
			}

			return new FileInfo(sfd.FileName);
		}
开发者ID:SaxxonPike,项目名称:BizHawk,代码行数:25,代码来源:ToolHelpers.cs

示例3: BrowseBtn_Click

        private void BrowseBtn_Click(object sender, EventArgs e)
        {
            var sfd = new SaveFileDialog
            {
                InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
                DefaultExt = "." + Global.MovieSession.Movie.PreferredExtension,
                FileName = RecordBox.Text,
                OverwritePrompt = false,
                Filter = "Movie Files (*." + Global.MovieSession.Movie.PreferredExtension + ")|*." + Global.MovieSession.Movie.PreferredExtension + "|All Files|*.*"
            };

            var result = sfd.ShowHawkDialog();
            if (result == DialogResult.OK
                && !string.IsNullOrWhiteSpace(sfd.FileName))
            {
                RecordBox.Text = sfd.FileName;
            }
        }
开发者ID:cas1993per,项目名称:bizhawk,代码行数:18,代码来源:RecordMovie.cs

示例4: Screenshot

		public void Screenshot()
		{
			var sfd = new SaveFileDialog
				{
					FileName = PathManager.FilesystemSafeName(Global.Game) + "-Nametables",
					InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"),
					Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
					RestoreDirectory = true
				};

			var result = sfd.ShowHawkDialog();
			if (result != DialogResult.OK)
			{
				return;
			}

			var file = new FileInfo(sfd.FileName);
			using (Bitmap b = new Bitmap(Width, Height))
			{
				Rectangle rect = new Rectangle(new Point(0, 0), Size);
				DrawToBitmap(b, rect);

				ImageFormat i;
				string extension = file.Extension.ToUpper();
				switch (extension)
				{
					default:
					case ".PNG":
						i = ImageFormat.Png;
						break;
					case ".BMP":
						i = ImageFormat.Bmp;
						break;
				}

				b.Save(file.FullName, i);
			}
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:38,代码来源:NameTableViewer.cs

示例5: NewScriptMenuItem_Click

		private void NewScriptMenuItem_Click(object sender, EventArgs e)
		{
			var sfd = new SaveFileDialog
			{
				InitialDirectory = !string.IsNullOrWhiteSpace(_luaList.Filename) ?
					Path.GetDirectoryName(_luaList.Filename) :
					PathManager.MakeAbsolutePath(Global.Config.PathEntries.LuaPathFragment, null),
				DefaultExt = ".lua",
				FileName = !string.IsNullOrWhiteSpace(_luaList.Filename) ?
					Path.GetFileNameWithoutExtension(_luaList.Filename) :
					Path.GetFileNameWithoutExtension(Global.Game.Name),
				OverwritePrompt = true,
				Filter = "Lua Scripts (*.lua)|*.lua|All Files (*.*)|*.*"
			};

			var result = sfd.ShowHawkDialog();
			if (result == DialogResult.OK
				&& !string.IsNullOrWhiteSpace(sfd.FileName))
			{
				string defaultTemplate = "while true do\n\temu.frameadvance();\nend";
				File.WriteAllText(sfd.FileName, defaultTemplate);
				_luaList.Add(new LuaFile(Path.GetFileNameWithoutExtension(sfd.FileName), sfd.FileName));
				UpdateDialog();
				System.Diagnostics.Process.Start(sfd.FileName);
			}
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:26,代码来源:LuaConsole.cs

示例6: GetSaveFileFromUser

		private FileInfo GetSaveFileFromUser()
		{
			var sfd = new SaveFileDialog();
			if (!string.IsNullOrWhiteSpace(_luaList.Filename))
			{
				sfd.FileName = Path.GetFileNameWithoutExtension(_luaList.Filename);
				sfd.InitialDirectory = Path.GetDirectoryName(_luaList.Filename);
			}
			else if (Global.Game != null)
			{
				sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
				sfd.InitialDirectory = PathManager.GetLuaPath();
			}
			else
			{
				sfd.FileName = "NULL";
				sfd.InitialDirectory = PathManager.GetLuaPath();
			}

			sfd.Filter = "Lua Session Files (*.luases)|*.luases|All Files|*.*";
			sfd.RestoreDirectory = true;
			var result = sfd.ShowHawkDialog();
			if (result != DialogResult.OK)
			{
				return null;
			}

			return new FileInfo(sfd.FileName);
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:29,代码来源:LuaConsole.cs

示例7: SaveMacroAs

        public static bool SaveMacroAs(MovieZone macro)
        {
            SaveFileDialog dialog = new SaveFileDialog();
            // Create directory?
            bool create = false;
            if (!Directory.Exists(SuggestedFolder()))
            {
                Directory.CreateDirectory(SuggestedFolder());
                create = true;
            }
            dialog.InitialDirectory = SuggestedFolder();
            dialog.FileName = macro.Name;
            dialog.Filter = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*";

            DialogResult result = dialog.ShowHawkDialog();
            if (result != DialogResult.OK)
            {
                if (create)
                    Directory.Delete(dialog.InitialDirectory);
                return false;
            }

            macro.Save(dialog.FileName);
            Global.Config.RecentMacros.Add(dialog.FileName);

            return true;
        }
开发者ID:cas1993per,项目名称:bizhawk,代码行数:27,代码来源:MacroInput.cs

示例8: GetSaveFileFromUser

		private static string GetSaveFileFromUser()
		{
			var sfd = new SaveFileDialog
			{
				Filter = "Text (*.txt)|*.txt|All Files|*.*",
				RestoreDirectory = true
			};

			if (Global.Emulator is NullEmulator)
			{
				sfd.FileName = "MemoryDump";
				sfd.InitialDirectory = PathManager.GetBasePathAbsolute();
			}
			else
			{
				sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
				sfd.InitialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(Global.Config.RecentRoms.MostRecent, null));
			}

			var result = sfd.ShowHawkDialog();

			return result == DialogResult.OK ? sfd.FileName : string.Empty;
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:23,代码来源:HexEditor.cs

示例9: ScreenshotAsMenuItem_Click

		private void ScreenshotAsMenuItem_Click(object sender, EventArgs e)
		{
			var path = String.Format(PathManager.ScreenshotPrefix(Global.Game) + ".{0:yyyy-MM-dd HH.mm.ss}.png", DateTime.Now);

			var sfd = new SaveFileDialog
			{
				InitialDirectory = Path.GetDirectoryName(path),
				FileName = Path.GetFileName(path),
				Filter = "PNG File (*.png)|*.png"
			};

			var result = sfd.ShowHawkDialog();
			if (result == DialogResult.OK)
			{
				TakeScreenshot(sfd.FileName);
			}
		}
开发者ID:pgrimsrud,项目名称:BizHawk,代码行数:17,代码来源:MainForm.Events.cs

示例10: GetBinarySaveFileFromUser

		private string GetBinarySaveFileFromUser()
		{
			var sfd = new SaveFileDialog
			{
				Filter = GetSaveFileFilter(),
				RestoreDirectory = true,
				InitialDirectory = RomDirectory
			};

			if (_domain.Name == "File on Disk")
			{
				sfd.FileName = RomName;
			}
			else
			{
				sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
			}

			var result = sfd.ShowHawkDialog();

			return result == DialogResult.OK ? sfd.FileName : string.Empty;
		}
开发者ID:TechnoTaff,项目名称:BizHawk,代码行数:22,代码来源:HexEditor.cs

示例11: GetCdlSaveFileFromUser

		public static FileInfo GetCdlSaveFileFromUser(string currentFile)
		{
			var sfd = new SaveFileDialog
			{
				Filter = "Code Data Logger Files (*.cdl)|*.cdl|All Files|*.*",
				InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
				RestoreDirectory = true
			};

			if (!string.IsNullOrWhiteSpace(currentFile))
			{
				sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
			}

			var result = sfd.ShowHawkDialog();
			if (result != DialogResult.OK)
			{
				return null;
			}

			return new FileInfo(sfd.FileName);
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:22,代码来源:ToolHelpers.cs

示例12: GetCheatSaveFileFromUser

		public static FileInfo GetCheatSaveFileFromUser(string currentFile)
		{
			var sfd = new SaveFileDialog();
			if (!string.IsNullOrWhiteSpace(currentFile))
			{
				sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
			}
			else if (!(Global.Emulator is NullEmulator))
			{
				sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
			}

			sfd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
			sfd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
			sfd.RestoreDirectory = true;
			var result = sfd.ShowHawkDialog();
			if (result != DialogResult.OK)
			{
				return null;
			}

			return new FileInfo(sfd.FileName);
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:23,代码来源:ToolHelpers.cs

示例13: GetBinarySaveFileFromUser

		private string GetBinarySaveFileFromUser()
		{
			var sfd = new SaveFileDialog
			{
				Filter = GetSaveFileFilter(),
				RestoreDirectory = true
			};

			if (Global.Emulator is NullEmulator)
			{
				sfd.FileName = "MemoryDump";
				sfd.InitialDirectory = PathManager.GetBasePathAbsolute();
			}
			else
			{
				if (_domain.Name == "File on Disk")
				{
					sfd.FileName = Path.GetFileName(Global.Config.RecentRoms.MostRecent);
				}
				else
				{
					sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
				}

				sfd.InitialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(Global.Config.RecentRoms.MostRecent, null));
			}

			var result = sfd.ShowHawkDialog();

			return result == DialogResult.OK ? sfd.FileName : string.Empty;
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:31,代码来源:HexEditor.cs

示例14: SaveStateAs

        private void SaveStateAs()
        {
            if (!Global.Emulator.HasSavestates())
            {
                return;
            }

            var path = PathManager.GetSaveStatePath(Global.Game);

            var file = new FileInfo(path);
            if (file.Directory != null && file.Directory.Exists == false)
            {
                file.Directory.Create();
            }

            var sfd = new SaveFileDialog
            {
                AddExtension = true,
                DefaultExt = "State",
                Filter = "Save States (*.State)|*.State|All Files|*.*",
                InitialDirectory = path,
                FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State"
            };

            var result = sfd.ShowHawkDialog();
            if (result == DialogResult.OK)
            {
                SaveState(sfd.FileName, sfd.FileName, false);
            }
        }
开发者ID:cas1993per,项目名称:bizhawk,代码行数:30,代码来源:MainForm.cs

示例15: _RecordAv


//.........这里部分代码省略.........
                }

                aw.SetAudioParameters(44100, 2, 16);

                // select codec token
                // do this before save dialog because ffmpeg won't know what extension it wants until it's been configured
                if (unattended)
                {
                    aw.SetDefaultVideoCodecToken();
                }
                else
                {
                    var token = aw.AcquireVideoCodecToken(this);
                    if (token == null)
                    {
                        GlobalWin.OSD.AddMessage("A/V capture canceled.");
                        aw.Dispose();
                        return;
                    }

                    aw.SetVideoCodecToken(token);
                }

                // select file to save to
                if (unattended)
                {
                    aw.OpenFile(filename);
                }
                else
                {
                    string ext = aw.DesiredExtension();
                    string pathForOpenFile;

                    //handle directories first
                    if (ext == "<directory>")
                    {
                        var fbd = new FolderBrowserEx();
                        if (fbd.ShowDialog() == DialogResult.Cancel)
                        {
                            aw.Dispose();
                            return;
                        }
                        pathForOpenFile = fbd.SelectedPath;
                    }
                    else
                    {
                        var sfd = new SaveFileDialog();
                        if (Global.Game != null)
                        {
                            sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + "." + ext; //dont use Path.ChangeExtension, it might wreck game names with dots in them
                            sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null);
                        }
                        else
                        {
                            sfd.FileName = "NULL";
                            sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null);
                        }

                        sfd.Filter = string.Format("{0} (*.{0})|*.{0}|All Files|*.*", ext);

                        var result = sfd.ShowHawkDialog();
                        if (result == DialogResult.Cancel)
                        {
                            aw.Dispose();
                            return;
                        }

                        pathForOpenFile = sfd.FileName;
                    }

                    aw.OpenFile(pathForOpenFile);
                }

                // commit the avi writing last, in case there were any errors earlier
                _currAviWriter = aw;
                GlobalWin.OSD.AddMessage("A/V capture started");
                AVIStatusLabel.Image = Properties.Resources.AVI;
                AVIStatusLabel.ToolTipText = "A/V capture in progress";
                AVIStatusLabel.Visible = true;
            }
            catch
            {
                GlobalWin.OSD.AddMessage("A/V capture failed!");
                aw.Dispose();
                throw;
            }

            if (_dumpaudiosync)
            {
                Global.Emulator.EndAsyncSound();
            }
            else
            {
                _aviSoundInput = !Global.Emulator.StartAsyncSound()
                    ? new MetaspuAsync(Global.Emulator.SyncSoundProvider, ESynchMethod.ESynchMethod_V)
                    : Global.Emulator.SoundProvider;
            }
            _dumpProxy = new MetaspuSoundProvider(ESynchMethod.ESynchMethod_V);
            RewireSound();
        }
开发者ID:cas1993per,项目名称:bizhawk,代码行数:101,代码来源:MainForm.cs


注:本文中的System.Windows.Forms.SaveFileDialog.ShowHawkDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。