remove GlobalWin.Game usage in ToolFormBase
This commit is contained in:
parent
cd146c0f79
commit
e9ca84f8bd
|
@ -359,8 +359,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SaveAsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var fileName = CurrentFileName;
|
||||
if (string.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
fileName = Game.FilesystemSafeName();
|
||||
}
|
||||
|
||||
var file = SaveFileDialog(
|
||||
CurrentFileName,
|
||||
fileName,
|
||||
Config.PathEntries.ToolsAbsolutePath(),
|
||||
"Bot files",
|
||||
"bot",
|
||||
|
|
|
@ -384,8 +384,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
private bool RunSaveAs()
|
||||
{
|
||||
var fileName = _currentFilename;
|
||||
if (string.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
fileName = Game.FilesystemSafeName();
|
||||
}
|
||||
|
||||
var file = SaveFileDialog(
|
||||
_currentFilename,
|
||||
fileName,
|
||||
Config.PathEntries.LogAbsolutePath(),
|
||||
"Code Data Logger Files",
|
||||
"cdl",
|
||||
|
|
|
@ -139,8 +139,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private bool SaveAs()
|
||||
{
|
||||
var fileName = MainForm.CheatList.CurrentFileName;
|
||||
if (string.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
fileName = Game.FilesystemSafeName();
|
||||
}
|
||||
|
||||
var file = SaveFileDialog(
|
||||
MainForm.CheatList.CurrentFileName,
|
||||
fileName,
|
||||
Config.PathEntries.CheatsAbsolutePath(Game.System),
|
||||
"Cheat Files",
|
||||
"cht",
|
||||
|
|
|
@ -86,9 +86,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
FileName = !string.IsNullOrWhiteSpace(currentFile)
|
||||
? Path.GetFileName(currentFile)
|
||||
: $"{GlobalWin.Game.FilesystemSafeName()}.{fileExt}",
|
||||
FileName = Path.GetFileName(currentFile),
|
||||
InitialDirectory = path,
|
||||
Filter = new FilesystemFilterSet(new FilesystemFilter(fileType, new[] { fileExt })).ToString(),
|
||||
RestoreDirectory = true
|
||||
|
|
|
@ -975,6 +975,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
sender == TruncateFromFileMenuItem);
|
||||
}
|
||||
|
||||
private string CurrentFileName()
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(_currentFileName)
|
||||
? _currentFileName
|
||||
: Game.FilesystemSafeName();
|
||||
}
|
||||
|
||||
private void SaveMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_currentFileName))
|
||||
|
@ -996,7 +1003,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
var result = watches.SaveAs(GetWatchSaveFileFromUser(watches.CurrentFileName));
|
||||
var result = watches.SaveAs(GetWatchSaveFileFromUser(CurrentFileName()));
|
||||
if (result)
|
||||
{
|
||||
MessageLabel.Text = $"{Path.GetFileName(_currentFileName)} saved";
|
||||
|
@ -1014,7 +1021,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
watches.Add(_searches[i]);
|
||||
}
|
||||
|
||||
if (watches.SaveAs(GetWatchSaveFileFromUser(watches.CurrentFileName)))
|
||||
if (watches.SaveAs(GetWatchSaveFileFromUser(CurrentFileName())))
|
||||
{
|
||||
_currentFileName = watches.CurrentFileName;
|
||||
MessageLabel.Text = $"{Path.GetFileName(_currentFileName)} saved";
|
||||
|
|
|
@ -525,9 +525,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
WatchListView.Refresh();
|
||||
}
|
||||
|
||||
private string CurrentFileName()
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(_watches.CurrentFileName)
|
||||
? _watches.CurrentFileName
|
||||
: Game.FilesystemSafeName();
|
||||
}
|
||||
|
||||
private void SaveAs()
|
||||
{
|
||||
var result = _watches.SaveAs(GetWatchSaveFileFromUser(_watches.CurrentFileName));
|
||||
var result = _watches.SaveAs(GetWatchSaveFileFromUser(CurrentFileName()));
|
||||
if (result)
|
||||
{
|
||||
UpdateStatusBar(saved: true);
|
||||
|
|
Loading…
Reference in New Issue