From e1a90430eac7557691b27d174627fe18fbaf41fe Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 30 Nov 2014 14:21:11 +0000 Subject: [PATCH] refactor MainForm.cs SaveStateAs() to use object initializer syntax --- BizHawk.Client.EmuHawk/MainForm.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 58eabc0419..319a8436b1 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -1748,19 +1748,23 @@ namespace BizHawk.Client.EmuHawk return; } - var sfd = new SaveFileDialog(); - sfd.AddExtension = true; - sfd.DefaultExt = "State"; - sfd.Filter = "Save States (*.State)|*.State|All Files|*.*"; var path = PathManager.GetSaveStatePath(Global.Game); - sfd.InitialDirectory = path; - sfd.FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State"; + 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) {