Merge pull request #1515 from TASVideos/interp_emuhawk

Use string interpolation in BizHawk.Client.EmuHawk
This commit is contained in:
adelikat 2019-03-27 19:22:42 -05:00 committed by GitHub
commit 951dbfd83e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
129 changed files with 1015 additions and 1076 deletions

View File

@ -53,7 +53,7 @@ namespace BizHawk.Client.EmuHawk
int counter = 1; int counter = 1;
for (;;) for (;;)
{ {
yield return Path.Combine(dir, baseName) + "_" + counter + ext; yield return Path.Combine(dir, $"{baseName}_{counter}{ext}");
counter++; counter++;
} }
} }
@ -97,7 +97,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception e) catch (Exception e)
{ {
MessageBox.Show("AVIFIL32 Thread died:\n\n" + e); MessageBox.Show($"AVIFIL32 Thread died:\n\n{e}");
} }
} }
@ -321,10 +321,10 @@ namespace BizHawk.Client.EmuHawk
int bytes = 0; int bytes = 0;
if (a_bits == 16) bytes = 2; if (a_bits == 16) bytes = 2;
else if (a_bits == 8) bytes = 1; else if (a_bits == 8) bytes = 1;
else throw new InvalidOperationException("only 8/16 bits audio are supported by AviWriter and you chose: " + a_bits); else throw new InvalidOperationException($"only 8/16 bits audio are supported by AviWriter and you chose: {a_bits}");
if (a_channels == 1) { } if (a_channels == 1) { }
else if (a_channels == 2) { } else if (a_channels == 2) { }
else throw new InvalidOperationException("only 1/2 channels audio are supported by AviWriter and you chose: " + a_channels); else throw new InvalidOperationException($"only 1/2 channels audio are supported by AviWriter and you chose: {a_channels}");
wfex.Init(); wfex.Init();
wfex.nBlockAlign = (ushort)(bytes * a_channels); wfex.nBlockAlign = (ushort)(bytes * a_channels);
@ -648,7 +648,7 @@ namespace BizHawk.Client.EmuHawk
if (Win32.FAILED(Win32.AVIFileOpenW(ref pAviFile, destPath, Win32.OpenFileStyle.OF_CREATE | Win32.OpenFileStyle.OF_WRITE, 0))) if (Win32.FAILED(Win32.AVIFileOpenW(ref pAviFile, destPath, Win32.OpenFileStyle.OF_CREATE | Win32.OpenFileStyle.OF_WRITE, 0)))
{ {
throw new InvalidOperationException("Couldnt open dest path for avi file: " + destPath); throw new InvalidOperationException($"Couldnt open dest path for avi file: {destPath}");
} }
// initialize the video stream // initialize the video stream
@ -991,7 +991,7 @@ namespace BizHawk.Client.EmuHawk
// using (Font f = new Font(FontFamily.GenericMonospace, 10)) // using (Font f = new Font(FontFamily.GenericMonospace, 10))
// g.DrawString(i.ToString(), f, Brushes.Black, 0, 0); // g.DrawString(i.ToString(), f, Brushes.Black, 0, 0);
// } // }
// //bmp.Save(string.Format("c:\\dump\\{0}.bmp", i), ImageFormat.Bmp); // //bmp.Save($"c:\\dump\\{i}.bmp", ImageFormat.Bmp);
// for (int y = 0, idx = 0; y < 256; y++) // for (int y = 0, idx = 0; y < 256; y++)
// for (int x = 0; x < 256; x++) // for (int x = 0; x < 256; x++)
// video.buffer[idx++] = bmp.GetPixel(x, y).ToArgb(); // video.buffer[idx++] = bmp.GetPixel(x, y).ToArgb();

View File

@ -91,8 +91,7 @@ namespace BizHawk.Client.EmuHawk
ffmpeg.StartInfo.FileName = "ffmpeg"; // expecting native version to be in path ffmpeg.StartInfo.FileName = "ffmpeg"; // expecting native version to be in path
#endif #endif
string filename = _baseName + (_segment > 0 ? $"_{_segment}" : "") + _ext; _ffmpeg.StartInfo.Arguments = $"-y -f nut -i - {_token.Commandline} \"{_baseName}{(_segment == 0 ? string.Empty : $"_{_segment}")}{_ext}\"";
_ffmpeg.StartInfo.Arguments = string.Format("-y -f nut -i - {1} \"{0}\"", filename, _token.Commandline);
_ffmpeg.StartInfo.CreateNoWindow = true; _ffmpeg.StartInfo.CreateNoWindow = true;
// ffmpeg sends informative display to stderr, and nothing to stdout // ffmpeg sends informative display to stderr, and nothing to stdout
@ -100,7 +99,7 @@ namespace BizHawk.Client.EmuHawk
_ffmpeg.StartInfo.RedirectStandardInput = true; _ffmpeg.StartInfo.RedirectStandardInput = true;
_ffmpeg.StartInfo.UseShellExecute = false; _ffmpeg.StartInfo.UseShellExecute = false;
_commandline = "ffmpeg " + _ffmpeg.StartInfo.Arguments; _commandline = $"ffmpeg {_ffmpeg.StartInfo.Arguments}";
_ffmpeg.ErrorDataReceived += new DataReceivedEventHandler(StderrHandler); _ffmpeg.ErrorDataReceived += new DataReceivedEventHandler(StderrHandler);
@ -132,7 +131,7 @@ namespace BizHawk.Client.EmuHawk
_stderr.Dequeue(); _stderr.Dequeue();
} }
_stderr.Enqueue(line.Data + "\n"); _stderr.Enqueue($"{line.Data}\n");
} }
} }
@ -193,7 +192,7 @@ namespace BizHawk.Client.EmuHawk
if (_ffmpeg.HasExited) if (_ffmpeg.HasExited)
{ {
throw new Exception("unexpected ffmpeg death:\n" + ffmpeg_geterror()); throw new Exception($"unexpected ffmpeg death:\n{ffmpeg_geterror()}");
} }
var video = source.GetVideoBuffer(); var video = source.GetVideoBuffer();
@ -203,7 +202,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch catch
{ {
MessageBox.Show("Exception! ffmpeg history:\n" + ffmpeg_geterror()); MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
throw; throw;
} }
@ -274,7 +273,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (_ffmpeg.HasExited) if (_ffmpeg.HasExited)
{ {
throw new Exception("unexpected ffmpeg death:\n" + ffmpeg_geterror()); throw new Exception($"unexpected ffmpeg death:\n{ffmpeg_geterror()}");
} }
if (samples.Length == 0) if (samples.Length == 0)
@ -289,7 +288,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch catch
{ {
MessageBox.Show("Exception! ffmpeg history:\n" + ffmpeg_geterror()); MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
throw; throw;
} }
} }

View File

@ -142,7 +142,7 @@ namespace BizHawk.Client.EmuHawk
if (listBox1.SelectedIndex != -1) if (listBox1.SelectedIndex != -1)
{ {
var f = (FormatPreset)listBox1.SelectedItem; var f = (FormatPreset)listBox1.SelectedItem;
label5.Text = "Extension: " + f.Extension; label5.Text = $"Extension: {f.Extension}";
label3.Text = f.Desc; label3.Text = f.Desc;
textBox1.Text = f.Commandline; textBox1.Text = f.Commandline;
} }

View File

@ -45,9 +45,7 @@ namespace BizHawk.Client.EmuHawk
public void AddFrame(IVideoProvider source) public void AddFrame(IVideoProvider source)
{ {
string ext = Path.GetExtension(_baseName); string ext = Path.GetExtension(_baseName);
string name = Path.GetFileNameWithoutExtension(_baseName) + "_" + _frame; var name = Path.Combine(Path.GetDirectoryName(_baseName), $"{Path.GetFileNameWithoutExtension(_baseName)}_{_frame}{ext}");
name += ext;
name = Path.Combine(Path.GetDirectoryName(_baseName), name);
BitmapBuffer bb = new BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer()); BitmapBuffer bb = new BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer());
using (var bmp = bb.ToSysdrawingBitmap()) using (var bmp = bb.ToSysdrawingBitmap())
{ {

View File

@ -671,7 +671,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception e) catch (Exception e)
{ {
System.Windows.Forms.MessageBox.Show("JMD Worker Thread died:\n\n" + e); System.Windows.Forms.MessageBox.Show($"JMD Worker Thread died:\n\n{e}");
return; return;
} }
} }

View File

@ -592,7 +592,7 @@ namespace BizHawk.Client.EmuHawk
{ {
dest.Write(data, 0, actual_length); dest.Write(data, 0, actual_length);
_pool.ReleaseBuffer(data); _pool.ReleaseBuffer(data);
//dbg.WriteLine(string.Format("{0},{1},{2}", pts, ptsnum, ptsden)); //dbg.WriteLine($"{pts},{ptsnum},{ptsden}");
} }
} }

View File

@ -38,11 +38,11 @@ namespace BizHawk.Client.EmuHawk
mProjectFile = projFile; mProjectFile = projFile;
mBaseDirectory = Path.GetDirectoryName(mProjectFile); mBaseDirectory = Path.GetDirectoryName(mProjectFile);
string basename = Path.GetFileNameWithoutExtension(projFile); string basename = Path.GetFileNameWithoutExtension(projFile);
string framesDirFragment = basename + "_frames"; string framesDirFragment = $"{basename}_frames";
mFramesDirectory = Path.Combine(mBaseDirectory, framesDirFragment); mFramesDirectory = Path.Combine(mBaseDirectory, framesDirFragment);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine("version=1"); sb.AppendLine("version=1");
sb.AppendLine("framesdir=" + framesDirFragment); sb.AppendLine($"framesdir={framesDirFragment}");
File.WriteAllText(mProjectFile, sb.ToString()); File.WriteAllText(mProjectFile, sb.ToString());
} }
@ -55,7 +55,7 @@ namespace BizHawk.Client.EmuHawk
using (var bb = new BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer())) using (var bb = new BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer()))
{ {
string subpath = GetAndCreatePathForFrameNum(mCurrFrame); string subpath = GetAndCreatePathForFrameNum(mCurrFrame);
string path = subpath + ".png"; string path = $"{subpath}.png";
bb.ToSysdrawingBitmap().Save(path, System.Drawing.Imaging.ImageFormat.Png); bb.ToSysdrawingBitmap().Save(path, System.Drawing.Imaging.ImageFormat.Png);
} }
} }
@ -63,7 +63,7 @@ namespace BizHawk.Client.EmuHawk
public void AddSamples(short[] samples) public void AddSamples(short[] samples)
{ {
string subpath = GetAndCreatePathForFrameNum(mCurrFrame); string subpath = GetAndCreatePathForFrameNum(mCurrFrame);
string path = subpath + ".wav"; string path = $"{subpath}.wav";
WavWriterV wwv = new WavWriterV(); WavWriterV wwv = new WavWriterV();
wwv.SetAudioParameters(paramSampleRate, paramChannels, paramBits); wwv.SetAudioParameters(paramSampleRate, paramChannels, paramBits);
wwv.OpenFile(path); wwv.OpenFile(path);
@ -149,7 +149,7 @@ namespace BizHawk.Client.EmuHawk
string subpath = GetPathFragmentForFrameNum(index); string subpath = GetPathFragmentForFrameNum(index);
string path = mFramesDirectory; string path = mFramesDirectory;
path = Path.Combine(path, subpath); path = Path.Combine(path, subpath);
string fpath = path + ".nothing"; string fpath = $"{path}.nothing";
Directory.CreateDirectory(Path.GetDirectoryName(fpath)); Directory.CreateDirectory(Path.GetDirectoryName(fpath));
return path; return path;
} }

View File

@ -21,8 +21,8 @@ namespace BizHawk.Client.EmuHawk
string subpath = SynclessRecorder.GetPathFragmentForFrameNum(index); string subpath = SynclessRecorder.GetPathFragmentForFrameNum(index);
string path = mFramesDirectory; string path = mFramesDirectory;
path = Path.Combine(path, subpath); path = Path.Combine(path, subpath);
png = path + ".png"; png = $"{path}.png";
wav = path + ".wav"; wav = $"{path}.wav";
} }
private string mSynclessConfigFile; private string mSynclessConfigFile;
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var ofd = new OpenFileDialog var ofd = new OpenFileDialog
{ {
FileName = PathManager.FilesystemSafeName(Global.Game) + ".syncless.txt", FileName = $"{PathManager.FilesystemSafeName(Global.Game)}.syncless.txt",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null) InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null)
}; };

View File

@ -265,7 +265,7 @@ namespace BizHawk.Client.EmuHawk
int counter = 1; int counter = 1;
while (true) while (true)
{ {
yield return new FileStream(Path.Combine(dir, baseName) + "_" + counter + ext, FileMode.Create); yield return new FileStream($"{Path.Combine(dir, baseName)}_{counter}{ext}", FileMode.Create);
counter++; counter++;
} }
} }

View File

@ -163,9 +163,9 @@ namespace BizHawk.Client.EmuHawk
private void AboutBox_Load(object sender, EventArgs e) private void AboutBox_Load(object sender, EventArgs e)
{ {
#if DEBUG #if DEBUG
Text = "BizHawk Developer Build (DEBUG MODE) GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH; Text = $"BizHawk Developer Build (DEBUG MODE) GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH}";
#else #else
Text = "BizHawk Developer Build (RELEASE MODE) GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH; Text = $"BizHawk Developer Build (RELEASE MODE) GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH}";
#endif #endif
if (DateTime.Now.Month == 12) if (DateTime.Now.Month == 12)
if (DateTime.Now.Day > 17 && DateTime.Now.Day <= 25) if (DateTime.Now.Day > 17 && DateTime.Now.Day <= 25)

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
public string SocketServerSend(string SendString) public string SocketServerSend(string SendString)
{ {
return "Sent : " + GlobalWin.socketServer.SendString(SendString).ToString() + " bytes"; return $"Sent : {GlobalWin.socketServer.SendString(SendString)} bytes";
} }
public string SocketServerResponse() public string SocketServerResponse()
{ {

View File

@ -303,7 +303,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
AddMessage("File not found: " + path); AddMessage($"File not found: {path}");
return; return;
} }
@ -331,7 +331,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
Console.WriteLine("File not found: " + path); Console.WriteLine($"File not found: {path}");
return; return;
} }
@ -371,7 +371,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
Console.WriteLine("File not found: " + path); Console.WriteLine($"File not found: {path}");
return; return;
} }

View File

@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (slotNum >= 0 && slotNum <= 9) if (slotNum >= 0 && slotNum <= 9)
{ {
GlobalWin.MainForm.LoadQuickSave("QuickSave" + slotNum, true); GlobalWin.MainForm.LoadQuickSave($"QuickSave{slotNum}", true);
} }
} }
@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (slotNum >= 0 && slotNum <= 9) if (slotNum >= 0 && slotNum <= 9)
{ {
GlobalWin.MainForm.SaveQuickSave("QuickSave" + slotNum); GlobalWin.MainForm.SaveQuickSave($"QuickSave{slotNum}");
} }
} }
} }

View File

@ -145,8 +145,8 @@ namespace BizHawk.Client.EmuHawk
errMsg = errMsg.Substring(errMsg.IndexOf('-') + 2); errMsg = errMsg.Substring(errMsg.IndexOf('-') + 2);
// Balloon is bugged on first invocation // Balloon is bugged on first invocation
errorBalloon.Show("Error parsing RegEx: " + errMsg, tb); errorBalloon.Show($"Error parsing RegEx: {errMsg}", tb);
errorBalloon.Show("Error parsing RegEx: " + errMsg, tb); errorBalloon.Show($"Error parsing RegEx: {errMsg}", tb);
} }
} }

View File

@ -31,14 +31,14 @@ namespace BizHawk.Client.EmuHawk
mainversion += " (x64)"; mainversion += " (x64)";
if (VersionInfo.DeveloperBuild) if (VersionInfo.DeveloperBuild)
{ {
Text = " BizHawk (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")"; Text = $" BizHawk (GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH})";
} }
else else
{ {
Text = "Version " + mainversion + " (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")"; Text = $"Version {mainversion} (GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH})";
} }
VersionLabel.Text = "Version " + mainversion; VersionLabel.Text = $"Version {mainversion}";
DateLabel.Text = VersionInfo.RELEASEDATE; DateLabel.Text = VersionInfo.RELEASEDATE;
var cores = Assembly var cores = Assembly
@ -59,12 +59,12 @@ namespace BizHawk.Client.EmuHawk
}); });
} }
linkLabel2.Text = "Commit # " + SubWCRev.GIT_SHORTHASH; linkLabel2.Text = $"Commit # {SubWCRev.GIT_SHORTHASH}";
} }
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
System.Diagnostics.Process.Start("https://github.com/TASVideos/BizHawk/commit/" + SubWCRev.GIT_SHORTHASH); System.Diagnostics.Process.Start($"https://github.com/TASVideos/BizHawk/commit/{SubWCRev.GIT_SHORTHASH}");
} }
private void btnCopyHash_Click(object sender, EventArgs e) private void btnCopyHash_Click(object sender, EventArgs e)

View File

@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk
if (!string.IsNullOrEmpty(attributes.Author)) if (!string.IsNullOrEmpty(attributes.Author))
{ {
CoreAuthorLabel.Text = "authors: " + attributes.Author; CoreAuthorLabel.Text = $"authors: {attributes.Author}";
} }
else else
{ {

View File

@ -229,10 +229,7 @@ namespace BizHawk.Client.EmuHawk
.ThenBy(t => t.CoreAttributes.CoreName) .ThenBy(t => t.CoreAttributes.CoreName)
.ToList(); .ToList();
toolStripStatusLabel1.Text = string.Format("Total: {0} Released: {1} Profiled: {2}", toolStripStatusLabel1.Text = $"Total: {possiblecoretypes.Count} Released: {KnownCores.Values.Count(c => c.Released)} Profiled: {KnownCores.Count}";
possiblecoretypes.Count,
KnownCores.Values.Count(c => c.Released),
KnownCores.Count);
CoreTree.Nodes.Clear(); CoreTree.Nodes.Clear();
CoreTree.BeginUpdate(); CoreTree.BeginUpdate();

View File

@ -36,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
_maxSize = domainSize - 1; _maxSize = domainSize - 1;
MaxLength = _maxSize.Value.NumHexDigits(); MaxLength = _maxSize.Value.NumHexDigits();
_addressFormatStr = "{0:X" + MaxLength + "}"; _addressFormatStr = $"{{0:X{MaxLength}}}";
//try to preserve the old value, as best we can //try to preserve the old value, as best we can
if(!wasMaxSizeSet) if(!wasMaxSizeSet)

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
// Convenience hack // Convenience hack
public override string ToString() public override string ToString()
{ {
return string.IsNullOrEmpty(Column) ? "?" : Column + " - " + (RowIndex.HasValue ? RowIndex.ToString() : "?"); return string.IsNullOrEmpty(Column) ? "?" : $"{Column} - {(RowIndex.HasValue ? RowIndex.ToString() : "?")}";
} }
} }

View File

@ -505,7 +505,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception ex) catch (Exception ex)
{ {
System.Diagnostics.Trace.WriteLine("VirtualListView.SetItemState error=" + ex.Message); System.Diagnostics.Trace.WriteLine($"VirtualListView.SetItemState error={ex.Message}");
// TODO: should this eat any exceptions? // TODO: should this eat any exceptions?
throw; throw;
@ -551,7 +551,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception e) catch (Exception e)
{ {
Debug.WriteLine("Failed to copy text name from client: " + e, "VirtualListView.OnDispInfoNotice"); Debug.WriteLine($"Failed to copy text name from client: {e}", "VirtualListView.OnDispInfoNotice");
} }
} }
} }
@ -687,7 +687,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception ex) catch (Exception ex)
{ {
Trace.WriteLine(string.Format("Message {0} caused an exception: {1}", m, ex.Message)); Trace.WriteLine($"Message {m} caused an exception: {ex.Message}");
} }
} }
} }
@ -705,7 +705,7 @@ namespace BizHawk.Client.EmuHawk
if (item == null) if (item == null)
{ {
throw new ArgumentException("cannot find item " + idx + " via QueryItem event"); throw new ArgumentException($"cannot find item {idx} via QueryItem event");
} }
return item; return item;

View File

@ -146,7 +146,7 @@ namespace BizHawk.Client.EmuHawk
public override string ToString() public override string ToString()
{ {
return "{Left: " + _Left + "; " + "Top: " + _Top + "; Right: " + _Right + "; Bottom: " + _Bottom + "}"; return $"{{Left: {_Left}; Top: {_Top}; Right: {_Right}; Bottom: {_Bottom}}}";
} }
public override int GetHashCode() public override int GetHashCode()

View File

@ -306,7 +306,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var pass = retroChain.Passes[i]; var pass = retroChain.Passes[i];
var rsp = new Filters.RetroShaderPass(retroChain, i); var rsp = new Filters.RetroShaderPass(retroChain, i);
string fname = string.Format("{0}[{1}]", name, i); string fname = $"{name}[{i}]";
program.AddFilter(rsp, fname); program.AddFilter(rsp, fname);
rsp.Parameters = properties; rsp.Parameters = properties;
} }
@ -491,7 +491,7 @@ namespace BizHawk.Client.EmuHawk
bufferWidth += padding.Horizontal; bufferWidth += padding.Horizontal;
bufferHeight += padding.Vertical; bufferHeight += padding.Vertical;
//Console.WriteLine("DISPZOOM " + zoom); //test //Console.WriteLine($"DISPZOOM {zoom}"); //test
//old stuff //old stuff
var fvp = new FakeVideoProvider(); var fvp = new FakeVideoProvider();
@ -915,7 +915,7 @@ namespace BizHawk.Client.EmuHawk
public DisplaySurface LockLuaSurface(string name, bool clear=true) public DisplaySurface LockLuaSurface(string name, bool clear=true)
{ {
if (MapNameToLuaSurface.ContainsKey(name)) if (MapNameToLuaSurface.ContainsKey(name))
throw new InvalidOperationException("Lua surface is already locked: " + name); throw new InvalidOperationException($"Lua surface is already locked: {name}");
SwappableDisplaySurfaceSet sdss; SwappableDisplaySurfaceSet sdss;
if (!LuaSurfaceSets.TryGetValue(name, out sdss)) if (!LuaSurfaceSets.TryGetValue(name, out sdss))
@ -939,7 +939,7 @@ namespace BizHawk.Client.EmuHawk
height += GameExtraPadding.Vertical; height += GameExtraPadding.Vertical;
} }
else if(name == "native") { width = currNativeWidth; height = currNativeHeight; } else if(name == "native") { width = currNativeWidth; height = currNativeHeight; }
else throw new InvalidOperationException("Unknown lua surface name: " +name); else throw new InvalidOperationException($"Unknown lua surface name: {name}");
DisplaySurface ret = sdss.AllocateSurface(width, height, clear); DisplaySurface ret = sdss.AllocateSurface(width, height, clear);
MapNameToLuaSurface[name] = ret; MapNameToLuaSurface[name] = ret;

View File

@ -138,11 +138,11 @@ namespace BizHawk.Client.EmuHawk.FilterManager
public override string ToString() public override string ToString()
{ {
if (Type == ProgramStepType.Run) if (Type == ProgramStepType.Run)
return string.Format("Run {0} ({1})", (int)Args, Comment); return $"Run {(int)Args} ({Comment})";
if (Type == ProgramStepType.NewTarget) if (Type == ProgramStepType.NewTarget)
return string.Format("NewTarget {0}", (Size)Args); return $"NewTarget {(Size)Args}";
if (Type == ProgramStepType.FinalTarget) if (Type == ProgramStepType.FinalTarget)
return string.Format("FinalTarget"); return "FinalTarget";
return null; return null;
} }
} }

View File

@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk.Filters
Shaders[i] = shader; Shaders[i] = shader;
if (!shader.Available) if (!shader.Available)
{ {
Errors += string.Format("===================\r\nPass {0}:\r\n{1}",i,shader.Errors); Errors += $"===================\r\nPass {i}:\r\n{shader.Errors}";
ok = false; ok = false;
} }
} }
@ -141,25 +141,25 @@ namespace BizHawk.Client.EmuHawk.Filters
sp.Index = i; sp.Index = i;
Passes.Add(sp); Passes.Add(sp);
sp.InputFilterLinear = FetchBool(dict, "filter_linear" + i, false); //Should this value not be defined, the filtering option is implementation defined. sp.InputFilterLinear = FetchBool(dict, $"filter_linear{i}", false); //Should this value not be defined, the filtering option is implementation defined.
sp.OuputFloat = FetchBool(dict, "float_framebuffer" + i, false); sp.OuputFloat = FetchBool(dict, $"float_framebuffer{i}", false);
sp.FrameCountMod = FetchInt(dict, "frame_count_mod" + i, 1); sp.FrameCountMod = FetchInt(dict, $"frame_count_mod{i}", 1);
sp.ShaderPath = FetchString(dict, "shader" + i, "?"); //todo - change extension to .cg for better compatibility? just change .cg to .glsl transparently at last second? sp.ShaderPath = FetchString(dict, $"shader{i}", "?"); //todo - change extension to .cg for better compatibility? just change .cg to .glsl transparently at last second?
//If no scale type is assumed, it is assumed that it is set to "source" with scaleN set to 1.0. //If no scale type is assumed, it is assumed that it is set to "source" with scaleN set to 1.0.
//It is possible to set scale_type_xN and scale_type_yN to specialize the scaling type in either direction. scale_typeN however overrides both of these. //It is possible to set scale_type_xN and scale_type_yN to specialize the scaling type in either direction. scale_typeN however overrides both of these.
sp.ScaleTypeX = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, "scale_type_x" + i, "Source"), true); sp.ScaleTypeX = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, $"scale_type_x{i}", "Source"), true);
sp.ScaleTypeY = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, "scale_type_y" + i, "Source"), true); sp.ScaleTypeY = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, $"scale_type_y{i}", "Source"), true);
ScaleType st = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, "scale_type" + i, "NotSet"), true); ScaleType st = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, $"scale_type{i}", "NotSet"), true);
if (st != ScaleType.NotSet) if (st != ScaleType.NotSet)
sp.ScaleTypeX = sp.ScaleTypeY = st; sp.ScaleTypeX = sp.ScaleTypeY = st;
//scaleN controls both scaling type in horizontal and vertical directions. If scaleN is defined, scale_xN and scale_yN have no effect. //scaleN controls both scaling type in horizontal and vertical directions. If scaleN is defined, scale_xN and scale_yN have no effect.
sp.Scale.X = FetchFloat(dict, "scale_x" + i, 1); sp.Scale.X = FetchFloat(dict, $"scale_x{i}", 1);
sp.Scale.Y = FetchFloat(dict, "scale_y" + i, 1); sp.Scale.Y = FetchFloat(dict, $"scale_y{i}", 1);
float scale = FetchFloat(dict, "scale" + i, -999); float scale = FetchFloat(dict, $"scale{i}", -999);
if (scale != -999) if (scale != -999)
sp.Scale.X = sp.Scale.Y = FetchFloat(dict, "scale" + i, 1); sp.Scale.X = sp.Scale.Y = FetchFloat(dict, $"scale{i}", 1);
//TODO - LUTs //TODO - LUTs
} }
@ -251,7 +251,7 @@ namespace BizHawk.Client.EmuHawk.Filters
public override string ToString() public override string ToString()
{ {
return string.Format("RetroShaderPass[#{0}]", RSI); return $"RetroShaderPass[#{RSI}]";
} }
public RetroShaderPass(RetroShaderChain RSC, int index) public RetroShaderPass(RetroShaderChain RSC, int index)

View File

@ -105,8 +105,8 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
//make a menuitem to let you explore to it //make a menuitem to let you explore to it
var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" }; var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" };
string explorePath = "\"" + hf.FullPathWithoutMember + "\""; string explorePath = $"\"{hf.FullPathWithoutMember}\"";
tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + explorePath); }; tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", $"/select, {explorePath}"); };
tsdd.Items.Add(tsmiExplore); tsdd.Items.Add(tsmiExplore);
var tsmiCopyFile = new ToolStripMenuItem { Text = "Copy &File" }; var tsmiCopyFile = new ToolStripMenuItem { Text = "Copy &File" };
@ -217,12 +217,12 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
GlobalWin.Sound.StopSound(); GlobalWin.Sound.StopSound();
if (recent.Frozen) if (recent.Frozen)
{ {
var result = MessageBox.Show("Could not open " + path, "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error); var result = MessageBox.Show($"Could not open {path}", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
else else
{ {
// ensure topmost, not to have to minimize everything to see and use our modal window, if it somehow got covered // ensure topmost, not to have to minimize everything to see and use our modal window, if it somehow got covered
var result = MessageBox.Show(new Form(){TopMost = true},"Could not open " + path + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error); var result = MessageBox.Show(new Form(){TopMost = true}, $"Could not open {path}\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (result == DialogResult.Yes) if (result == DialogResult.Yes)
{ {
if (encodedPath != null) if (encodedPath != null)

View File

@ -220,19 +220,19 @@ namespace BizHawk.Client.EmuHawk
for (int i = 0; i < state.GetButtons().Length; i++) for (int i = 0; i < state.GetButtons().Length; i++)
{ {
int j = i; int j = i;
AddItem(string.Format("B{0}", i + 1), () => state.IsPressed(j)); AddItem($"B{i + 1}", () => state.IsPressed(j));
} }
for (int i = 0; i < state.GetPointOfViewControllers().Length; i++) for (int i = 0; i < state.GetPointOfViewControllers().Length; i++)
{ {
int j = i; int j = i;
AddItem(string.Format("POV{0}U", i + 1), AddItem($"POV{i + 1}U",
() => { int t = state.GetPointOfViewControllers()[j]; return (t >= 0 && t <= 4500) || (t >= 31500 && t < 36000); }); () => { int t = state.GetPointOfViewControllers()[j]; return (t >= 0 && t <= 4500) || (t >= 31500 && t < 36000); });
AddItem(string.Format("POV{0}D", i + 1), AddItem($"POV{i + 1}D",
() => { int t = state.GetPointOfViewControllers()[j]; return t >= 13500 && t <= 22500; }); () => { int t = state.GetPointOfViewControllers()[j]; return t >= 13500 && t <= 22500; });
AddItem(string.Format("POV{0}L", i + 1), AddItem($"POV{i + 1}L",
() => { int t = state.GetPointOfViewControllers()[j]; return t >= 22500 && t <= 31500; }); () => { int t = state.GetPointOfViewControllers()[j]; return t >= 22500 && t <= 31500; });
AddItem(string.Format("POV{0}R", i + 1), AddItem($"POV{i + 1}R",
() => { int t = state.GetPointOfViewControllers()[j]; return t >= 4500 && t <= 13500; }); () => { int t = state.GetPointOfViewControllers()[j]; return t >= 4500 && t <= 13500; });
} }
} }

View File

@ -25,7 +25,7 @@ namespace BizHawk.Client.EmuHawk
static void IPCThread() static void IPCThread()
{ {
string pipeName = string.Format("bizhawk-pid-{0}-IPCKeyInput", System.Diagnostics.Process.GetCurrentProcess().Id); string pipeName = $"bizhawk-pid-{System.Diagnostics.Process.GetCurrentProcess().Id}-IPCKeyInput";
for (; ; ) for (; ; )

View File

@ -198,7 +198,7 @@ namespace BizHawk.Client.EmuHawk
public InputEventType EventType; public InputEventType EventType;
public override string ToString() public override string ToString()
{ {
return string.Format("{0}:{1}", EventType.ToString(), LogicalButton.ToString()); return $"{EventType.ToString()}:{LogicalButton.ToString()}";
} }
} }
@ -360,7 +360,7 @@ namespace BizHawk.Client.EmuHawk
//analyze xinput //analyze xinput
foreach (var pad in GamePad360.EnumerateDevices()) foreach (var pad in GamePad360.EnumerateDevices())
{ {
string xname = "X" + pad.PlayerNumber + " "; string xname = $"X{pad.PlayerNumber} ";
for (int b = 0; b < pad.NumButtons; b++) for (int b = 0; b < pad.NumButtons; b++)
HandleButton(xname + pad.ButtonName(b), pad.Pressed(b)); HandleButton(xname + pad.ButtonName(b), pad.Pressed(b));
foreach (var sv in pad.GetFloats()) foreach (var sv in pad.GetFloats())
@ -376,7 +376,7 @@ namespace BizHawk.Client.EmuHawk
//analyze joysticks //analyze joysticks
foreach (var pad in GamePad.EnumerateDevices()) foreach (var pad in GamePad.EnumerateDevices())
{ {
string jname = "J" + pad.PlayerNumber + " "; string jname = $"J{pad.PlayerNumber} ";
for (int b = 0; b < pad.NumButtons; b++) for (int b = 0; b < pad.NumButtons; b++)
HandleButton(jname + pad.ButtonName(b), pad.Pressed(b)); HandleButton(jname + pad.ButtonName(b), pad.Pressed(b));
foreach (var sv in pad.GetFloats()) foreach (var sv in pad.GetFloats())
@ -513,7 +513,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var kvp in LastState) foreach (var kvp in LastState)
if (kvp.Value) if (kvp.Value)
{ {
Console.WriteLine("Unpressing " + kvp.Key); Console.WriteLine($"Unpressing {kvp.Key}");
UnpressState[kvp.Key] = true; UnpressState[kvp.Key] = true;
} }

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
JoystickState jss = Joystick.GetState(i); JoystickState jss = Joystick.GetState(i);
if (jss.IsConnected) if (jss.IsConnected)
{ {
Console.WriteLine(string.Format("joydevice index: {0}", i)); //OpenTK doesn't expose the GUID, even though it stores it internally... Console.WriteLine($"joydevice index: {i}"); //OpenTK doesn't expose the GUID, even though it stores it internally...
OTK_GamePad ogp = new OTK_GamePad(i); OTK_GamePad ogp = new OTK_GamePad(i);
Devices.Add(ogp); Devices.Add(ogp);
@ -77,7 +77,7 @@ namespace BizHawk.Client.EmuHawk
return state; return state;
} }
public string Name { get { return "Joystick " + _stickIdx; } } public string Name { get { return $"Joystick {_stickIdx}"; } }
public Guid Guid { get { return _guid; } } public Guid Guid { get { return _guid; } }
@ -122,17 +122,17 @@ namespace BizHawk.Client.EmuHawk
int jb = 1; int jb = 1;
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
AddItem(string.Format("B{0}", jb), () => state.GetButton(i)==ButtonState.Pressed); AddItem($"B{jb}", () => state.GetButton(i)==ButtonState.Pressed);
jb++; jb++;
} }
jb = 1; jb = 1;
foreach (JoystickHat enval in Enum.GetValues(typeof(JoystickHat))) foreach (JoystickHat enval in Enum.GetValues(typeof(JoystickHat)))
{ {
AddItem(string.Format("POV{0}U", jb), () => state.GetHat(enval).IsUp); AddItem($"POV{jb}U", () => state.GetHat(enval).IsUp);
AddItem(string.Format("POV{0}D", jb), () => state.GetHat(enval).IsDown); AddItem($"POV{jb}D", () => state.GetHat(enval).IsDown);
AddItem(string.Format("POV{0}L", jb), () => state.GetHat(enval).IsLeft); AddItem($"POV{jb}L", () => state.GetHat(enval).IsLeft);
AddItem(string.Format("POV{0}R", jb), () => state.GetHat(enval).IsRight); AddItem($"POV{jb}R", () => state.GetHat(enval).IsRight);
jb++; jb++;
} }
} }

View File

@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
dynamic ji = Activator.CreateInstance(JumpTask); dynamic ji = Activator.CreateInstance(JumpTask);
ji.ApplicationPath = exepath; ji.ApplicationPath = exepath;
ji.Arguments = '"' + fullpath + '"'; ji.Arguments = $"\"{fullpath}\"";
ji.Title = title; ji.Title = title;
// for some reason, this doesn't work // for some reason, this doesn't work
ji.WorkingDirectory = Path.GetDirectoryName(exepath); ji.WorkingDirectory = Path.GetDirectoryName(exepath);

View File

@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk
} }
string remainder = cmdLine.Substring(childCmdLine); string remainder = cmdLine.Substring(childCmdLine);
string path = cmdLine.Substring(lastSlash, lastGood - lastSlash); string path = cmdLine.Substring(lastSlash, lastGood - lastSlash);
return path + " " + remainder; return $"{path} {remainder}";
} }
static IntPtr oldOut, conOut; static IntPtr oldOut, conOut;
@ -164,7 +164,7 @@ namespace BizHawk.Client.EmuHawk
hasConsole = true; hasConsole = true;
} }
else else
System.Windows.Forms.MessageBox.Show(string.Format("Couldn't allocate win32 console: {0}", Marshal.GetLastWin32Error())); System.Windows.Forms.MessageBox.Show($"Couldn't allocate win32 console: {Marshal.GetLastWin32Error()}");
} }
if(hasConsole) if(hasConsole)

View File

@ -443,12 +443,12 @@ namespace BizHawk.Client.EmuHawk
private void SaveToCurrentSlotMenuItem_Click(object sender, EventArgs e) private void SaveToCurrentSlotMenuItem_Click(object sender, EventArgs e)
{ {
SaveQuickSave("QuickSave" + Global.Config.SaveSlot); SaveQuickSave($"QuickSave{Global.Config.SaveSlot}");
} }
private void LoadCurrentSlotMenuItem_Click(object sender, EventArgs e) private void LoadCurrentSlotMenuItem_Click(object sender, EventArgs e)
{ {
LoadQuickSave("QuickSave" + Global.Config.SaveSlot); LoadQuickSave($"QuickSave{Global.Config.SaveSlot}");
} }
private void FlushSaveRAMMenuItem_Click(object sender, EventArgs e) private void FlushSaveRAMMenuItem_Click(object sender, EventArgs e)
@ -683,7 +683,7 @@ namespace BizHawk.Client.EmuHawk
private void ScreenshotAsMenuItem_Click(object sender, EventArgs e) 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 path = $"{PathManager.ScreenshotPrefix(Global.Game)}.{DateTime.Now:yyyy-MM-dd HH.mm.ss}.png";
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
@ -1364,7 +1364,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config = ConfigService.Load<Config>(PathManager.DefaultIniPath); Global.Config = ConfigService.Load<Config>(PathManager.DefaultIniPath);
Global.Config.ResolveDefaults(); Global.Config.ResolveDefaults();
InitControls(); // rebind hotkeys InitControls(); // rebind hotkeys
GlobalWin.OSD.AddMessage("Config file loaded: " + PathManager.DefaultIniPath); GlobalWin.OSD.AddMessage($"Config file loaded: {PathManager.DefaultIniPath}");
} }
private void LoadConfigFromMenuItem_Click(object sender, EventArgs e) private void LoadConfigFromMenuItem_Click(object sender, EventArgs e)
@ -1383,7 +1383,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config = ConfigService.Load<Config>(ofd.FileName); Global.Config = ConfigService.Load<Config>(ofd.FileName);
Global.Config.ResolveDefaults(); Global.Config.ResolveDefaults();
InitControls(); // rebind hotkeys InitControls(); // rebind hotkeys
GlobalWin.OSD.AddMessage("Config file loaded: " + ofd.FileName); GlobalWin.OSD.AddMessage($"Config file loaded: {ofd.FileName}");
} }
} }
@ -1601,10 +1601,10 @@ namespace BizHawk.Client.EmuHawk
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
var str = "FDS Insert " + i; var str = $"FDS Insert {i}";
if (Emulator.ControllerDefinition.BoolButtons.Contains(str)) if (Emulator.ControllerDefinition.BoolButtons.Contains(str))
{ {
FdsInsertDiskMenuAdd("Insert Disk " + i, str, "FDS Disk " + i + " inserted."); FdsInsertDiskMenuAdd($"Insert Disk {i}", str, $"FDS Disk {i} inserted.");
} }
} }
} }
@ -2440,8 +2440,8 @@ namespace BizHawk.Client.EmuHawk
{ {
var menuItem = new ToolStripMenuItem var menuItem = new ToolStripMenuItem
{ {
Name = "Disk" + (i + 1), Name = $"Disk{i + 1}",
Text = "Disk" + (i + 1), Text = $"Disk{i + 1}",
Checked = appleII.CurrentDisk == i Checked = appleII.CurrentDisk == i
}; };
@ -2479,8 +2479,8 @@ namespace BizHawk.Client.EmuHawk
{ {
var menuItem = new ToolStripMenuItem var menuItem = new ToolStripMenuItem
{ {
Name = "Disk" + (i + 1), Name = $"Disk{i + 1}",
Text = "Disk" + (i + 1), Text = $"Disk{i + 1}",
Checked = c64.CurrentDisk == i Checked = c64.CurrentDisk == i
}; };
@ -2581,8 +2581,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem var menuItem = new ToolStripMenuItem
{ {
Name = i + "_" + name, Name = $"{i}_{name}",
Text = i + ": " + name, Text = $"{i}: {name}",
Checked = currSel == i Checked = currSel == i
}; };
@ -2616,8 +2616,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem var menuItem = new ToolStripMenuItem
{ {
Name = i + "_" + name, Name = $"{i}_{name}",
Text = i + ": " + name, Text = $"{i}: {name}",
Checked = currSel == i Checked = currSel == i
}; };
@ -2705,8 +2705,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem var menuItem = new ToolStripMenuItem
{ {
Name = i + "_" + name, Name = $"{i}_{name}",
Text = i + ": " + name, Text = $"{i}: {name}",
Checked = currSel == i Checked = currSel == i
}; };
@ -2740,8 +2740,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem var menuItem = new ToolStripMenuItem
{ {
Name = i + "_" + name, Name = $"{i}_{name}",
Text = i + ": " + name, Text = $"{i}: {name}",
Checked = currSel == i Checked = currSel == i
}; };
@ -2879,23 +2879,19 @@ namespace BizHawk.Client.EmuHawk
} }
} }
var file = new FileInfo( var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{Global.Config.SaveSlot}.State.bak");
PathManager.SaveStatePrefix(Global.Game) +
".QuickSave" +
Global.Config.SaveSlot +
".State.bak");
if (file.Exists) if (file.Exists)
{ {
UndoSavestateContextMenuItem.Enabled = true; UndoSavestateContextMenuItem.Enabled = true;
if (_stateSlots.IsRedo(Global.Config.SaveSlot)) if (_stateSlots.IsRedo(Global.Config.SaveSlot))
{ {
UndoSavestateContextMenuItem.Text = "Redo Save to slot " + Global.Config.SaveSlot; UndoSavestateContextMenuItem.Text = $"Redo Save to slot {Global.Config.SaveSlot}";
UndoSavestateContextMenuItem.Image = Properties.Resources.redo; UndoSavestateContextMenuItem.Image = Properties.Resources.redo;
} }
else else
{ {
UndoSavestateContextMenuItem.Text = "Undo Save to slot " + Global.Config.SaveSlot; UndoSavestateContextMenuItem.Text = $"Undo Save to slot {Global.Config.SaveSlot}";
UndoSavestateContextMenuItem.Image = Properties.Resources.undo; UndoSavestateContextMenuItem.Image = Properties.Resources.undo;
} }
} }
@ -3025,13 +3021,9 @@ namespace BizHawk.Client.EmuHawk
private void UndoSavestateContextMenuItem_Click(object sender, EventArgs e) private void UndoSavestateContextMenuItem_Click(object sender, EventArgs e)
{ {
_stateSlots.SwapBackupSavestate( _stateSlots.SwapBackupSavestate($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{Global.Config.SaveSlot}.State");
PathManager.SaveStatePrefix(Global.Game) +
".QuickSave" +
Global.Config.SaveSlot +
".State");
GlobalWin.OSD.AddMessage("Save slot " + Global.Config.SaveSlot + " restored."); GlobalWin.OSD.AddMessage($"Save slot {Global.Config.SaveSlot} restored.");
} }
private void ClearSramContextMenuItem_Click(object sender, EventArgs e) private void ClearSramContextMenuItem_Click(object sender, EventArgs e)
@ -3078,12 +3070,12 @@ namespace BizHawk.Client.EmuHawk
{ {
if (_stateSlots.HasSlot(slot)) if (_stateSlots.HasSlot(slot))
{ {
LoadQuickSave("QuickSave" + slot); LoadQuickSave($"QuickSave{slot}");
} }
} }
else if (e.Button == MouseButtons.Right) else if (e.Button == MouseButtons.Right)
{ {
SaveQuickSave("QuickSave" + slot); SaveQuickSave($"QuickSave{slot}");
} }
} }
@ -3138,7 +3130,7 @@ namespace BizHawk.Client.EmuHawk
{ {
GlobalWin.Sound.StopSound(); GlobalWin.Sound.StopSound();
DialogResult result = MessageBox.Show(this, DialogResult result = MessageBox.Show(this,
"Version " + Global.Config.Update_LatestVersion + " is now available. Would you like to open the BizHawk homepage?\r\n\r\nClick \"No\" to hide the update notification for this version.", $"Version {Global.Config.Update_LatestVersion} is now available. Would you like to open the BizHawk homepage?\r\n\r\nClick \"No\" to hide the update notification for this version.",
"New Version Available", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); "New Version Available", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
GlobalWin.Sound.StartSound(); GlobalWin.Sound.StartSound();
@ -3273,7 +3265,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("Exception on drag and drop:\n" + ex); MessageBox.Show($"Exception on drag and drop:\n{ex}");
} }
} }

View File

@ -30,10 +30,10 @@ namespace BizHawk.Client.EmuHawk
HardReset(); HardReset();
break; break;
case "Quick Load": case "Quick Load":
LoadQuickSave("QuickSave" + Global.Config.SaveSlot); LoadQuickSave($"QuickSave{Global.Config.SaveSlot}");
break; break;
case "Quick Save": case "Quick Save":
SaveQuickSave("QuickSave" + Global.Config.SaveSlot); SaveQuickSave($"QuickSave{Global.Config.SaveSlot}");
break; break;
case "Clear Autohold": case "Clear Autohold":
ClearAutohold(); ClearAutohold();
@ -126,7 +126,7 @@ namespace BizHawk.Client.EmuHawk
break; break;
case "Toggle Skip Lag Frame": case "Toggle Skip Lag Frame":
Global.Config.SkipLagFrame ^= true; Global.Config.SkipLagFrame ^= true;
GlobalWin.OSD.AddMessage("Skip Lag Frames toggled " + (Global.Config.SkipLagFrame ? "On" : "Off")); GlobalWin.OSD.AddMessage($"Skip Lag Frames toggled {(Global.Config.SkipLagFrame ? "On" : "Off")}");
break; break;
case "Toggle Key Priority": case "Toggle Key Priority":
ToggleKeyPriority(); ToggleKeyPriority();
@ -348,7 +348,7 @@ namespace BizHawk.Client.EmuHawk
} }
Global.CheatList.ToList().ForEach(x => x.Toggle()); Global.CheatList.ToList().ForEach(x => x.Toggle());
GlobalWin.OSD.AddMessage("Cheats toggled" + type); GlobalWin.OSD.AddMessage($"Cheats toggled{type}");
} }
break; break;
@ -642,7 +642,7 @@ namespace BizHawk.Client.EmuHawk
var s = ((Gameboy)Emulator).GetSettings(); var s = ((Gameboy)Emulator).GetSettings();
s.DisplayBG ^= true; s.DisplayBG ^= true;
((Gameboy)Emulator).PutSettings(s); ((Gameboy)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage("BG toggled " + (s.DisplayBG ? "on" : "off")); GlobalWin.OSD.AddMessage($"BG toggled {(s.DisplayBG ? "on" : "off")}");
} }
break; break;
@ -652,7 +652,7 @@ namespace BizHawk.Client.EmuHawk
var s = ((Gameboy)Emulator).GetSettings(); var s = ((Gameboy)Emulator).GetSettings();
s.DisplayOBJ ^= true; s.DisplayOBJ ^= true;
((Gameboy)Emulator).PutSettings(s); ((Gameboy)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage("OBJ toggled " + (s.DisplayBG ? "on" : "off")); GlobalWin.OSD.AddMessage($"OBJ toggled {(s.DisplayBG ? "on" : "off")}");
} }
break; break;

View File

@ -279,7 +279,7 @@ namespace BizHawk.Client.EmuHawk
LoadRom(argParser.cmdRom, new LoadRomArgs { OpenAdvanced = ioa }); LoadRom(argParser.cmdRom, new LoadRomArgs { OpenAdvanced = ioa });
if (Global.Game == null) if (Global.Game == null)
{ {
MessageBox.Show("Failed to load " + argParser.cmdRom + " specified on commandline"); MessageBox.Show($"Failed to load {argParser.cmdRom} specified on commandline");
} }
} }
else if (Global.Config.RecentRoms.AutoLoad && !Global.Config.RecentRoms.Empty) else if (Global.Config.RecentRoms.AutoLoad && !Global.Config.RecentRoms.Empty)
@ -370,11 +370,11 @@ namespace BizHawk.Client.EmuHawk
} }
else if (argParser.cmdLoadSlot != null) else if (argParser.cmdLoadSlot != null)
{ {
LoadQuickSave("QuickSave" + argParser.cmdLoadSlot); LoadQuickSave($"QuickSave{argParser.cmdLoadSlot}");
} }
else if (Global.Config.AutoLoadLastSaveSlot) else if (Global.Config.AutoLoadLastSaveSlot)
{ {
LoadQuickSave("QuickSave" + Global.Config.SaveSlot); LoadQuickSave($"QuickSave{Global.Config.SaveSlot}");
} }
} }
@ -918,34 +918,22 @@ namespace BizHawk.Client.EmuHawk
public void TakeScreenshot() public void TakeScreenshot()
{ {
string fmt = "{0}.{1:yyyy-MM-dd HH.mm.ss}{2}.png"; var basename = $"{PathManager.ScreenshotPrefix(Global.Game)}.{DateTime.Now:yyyy-MM-dd HH.mm.ss}";
string prefix = PathManager.ScreenshotPrefix(Global.Game);
var ts = DateTime.Now;
string fnameBare = string.Format(fmt, prefix, ts, ""); var fnameBare = $"{basename}.png";
string fname = string.Format(fmt, prefix, ts, " (0)"); var fname = $"{basename} (0).png";
// if the (0) filename exists, do nothing. we'll bump up the number later // if the (0) filename exists, do nothing. we'll bump up the number later
// if the bare filename exists, move it to (0) // if the bare filename exists, move it to (0)
// otherwise, no related filename exists, and we can proceed with the bare filename // otherwise, no related filename exists, and we can proceed with the bare filename
if (File.Exists(fname)) if (!File.Exists(fname))
{ {
} if (File.Exists(fnameBare)) File.Move(fnameBare, fname);
else if (File.Exists(fnameBare)) else fname = fnameBare;
{
File.Move(fnameBare, fname);
}
else
{
fname = fnameBare;
} }
int seq = 0; for (var seq = 0; File.Exists(fname); seq++)
while (File.Exists(fname)) fname = $"{basename} ({seq}).png";
{
var sequence = $" ({seq++})";
fname = string.Format(fmt, prefix, ts, sequence);
}
TakeScreenshot(fname); TakeScreenshot(fname);
} }
@ -967,10 +955,10 @@ namespace BizHawk.Client.EmuHawk
} }
/* /*
using (var fs = new FileStream(path + "_test.bmp", FileMode.OpenOrCreate, FileAccess.Write)) using (var fs = new FileStream($"{path}_test.bmp", FileMode.OpenOrCreate, FileAccess.Write))
QuickBmpFile.Save(Emulator.VideoProvider(), fs, r.Next(50, 500), r.Next(50, 500)); QuickBmpFile.Save(Emulator.VideoProvider(), fs, r.Next(50, 500), r.Next(50, 500));
*/ */
GlobalWin.OSD.AddMessage(fi.Name + " saved."); GlobalWin.OSD.AddMessage($"{fi.Name} saved.");
} }
public void FrameBufferResized() public void FrameBufferResized()
@ -996,7 +984,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
Console.WriteLine("Selecting display size " + lastComputedSize); Console.WriteLine($"Selecting display size {lastComputedSize}");
// Change size // Change size
Size = new Size(lastComputedSize.Width + borderWidth, lastComputedSize.Height + borderHeight); Size = new Size(lastComputedSize.Width + borderWidth, lastComputedSize.Height + borderHeight);
@ -1176,7 +1164,7 @@ namespace BizHawk.Client.EmuHawk
public void FrameSkipMessage() public void FrameSkipMessage()
{ {
GlobalWin.OSD.AddMessage("Frameskipping set to " + Global.Config.FrameSkip); GlobalWin.OSD.AddMessage($"Frameskipping set to {Global.Config.FrameSkip}");
} }
public void UpdateCheatStatus() public void UpdateCheatStatus()
@ -1253,7 +1241,7 @@ namespace BizHawk.Client.EmuHawk
((Snes9x)Emulator).PutSettings(s); ((Snes9x)Emulator).PutSettings(s);
} }
GlobalWin.OSD.AddMessage($"BG {layer} Layer " + (result ? "On" : "Off")); GlobalWin.OSD.AddMessage($"BG {layer} Layer {(result ? "On" : "Off")}");
} }
private void SNES_ToggleObj(int layer) private void SNES_ToggleObj(int layer)
@ -1289,7 +1277,7 @@ namespace BizHawk.Client.EmuHawk
} }
((LibsnesCore)Emulator).PutSettings(s); ((LibsnesCore)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage($"Obj {layer} Layer " + (result ? "On" : "Off")); GlobalWin.OSD.AddMessage($"Obj {layer} Layer {(result ? "On" : "Off")}");
} }
else if (Emulator is Snes9x) else if (Emulator is Snes9x)
{ {
@ -1311,7 +1299,7 @@ namespace BizHawk.Client.EmuHawk
} }
((Snes9x)Emulator).PutSettings(s); ((Snes9x)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage($"Sprite {layer} Layer " + (result ? "On" : "Off")); GlobalWin.OSD.AddMessage($"Sprite {layer} Layer {(result ? "On" : "Off")}");
} }
} }
@ -1448,7 +1436,7 @@ namespace BizHawk.Client.EmuHawk
if (!string.IsNullOrEmpty(VersionInfo.CustomBuildString)) if (!string.IsNullOrEmpty(VersionInfo.CustomBuildString))
{ {
str += VersionInfo.CustomBuildString + " "; str += $"{VersionInfo.CustomBuildString} ";
} }
str += Emulator.IsNull() ? "BizHawk" : Global.SystemInfo.DisplayName; str += Emulator.IsNull() ? "BizHawk" : Global.SystemInfo.DisplayName;
@ -1460,11 +1448,11 @@ namespace BizHawk.Client.EmuHawk
if (!Emulator.IsNull()) if (!Emulator.IsNull())
{ {
str += " - " + Global.Game.Name; str += $" - {Global.Game.Name}";
if (Global.MovieSession.Movie.IsActive) if (Global.MovieSession.Movie.IsActive)
{ {
str += " - " + Path.GetFileName(Global.MovieSession.Movie.Filename); str += $" - {Path.GetFileName(Global.MovieSession.Movie.Filename)}";
} }
} }
@ -1635,9 +1623,9 @@ namespace BizHawk.Client.EmuHawk
path = PathManager.SaveRamPath(Global.Game); path = PathManager.SaveRamPath(Global.Game);
} }
var file = new FileInfo(path); var file = new FileInfo(path);
var newPath = path + ".new"; var newPath = $"{path}.new";
var newFile = new FileInfo(newPath); var newFile = new FileInfo(newPath);
var backupPath = path + ".bak"; var backupPath = $"{path}.bak";
var backupFile = new FileInfo(backupPath); var backupFile = new FileInfo(backupPath);
if (file.Directory != null && !file.Directory.Exists) if (file.Directory != null && !file.Directory.Exists)
{ {
@ -1647,7 +1635,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch catch
{ {
GlobalWin.OSD.AddMessage("Unable to flush SaveRAM to: " + newFile.Directory); GlobalWin.OSD.AddMessage($"Unable to flush SaveRAM to: {newFile.Directory}");
return false; return false;
} }
} }
@ -1909,13 +1897,13 @@ namespace BizHawk.Client.EmuHawk
{ {
PauseStatusButton.Image = Properties.Resources.Lightning; PauseStatusButton.Image = Properties.Resources.Lightning;
PauseStatusButton.Visible = true; PauseStatusButton.Visible = true;
PauseStatusButton.ToolTipText = "Emulator is turbo seeking to frame " + PauseOnFrame.Value + " click to stop seek"; PauseStatusButton.ToolTipText = $"Emulator is turbo seeking to frame {PauseOnFrame.Value} click to stop seek";
} }
else if (PauseOnFrame.HasValue) else if (PauseOnFrame.HasValue)
{ {
PauseStatusButton.Image = Properties.Resources.YellowRight; PauseStatusButton.Image = Properties.Resources.YellowRight;
PauseStatusButton.Visible = true; PauseStatusButton.Visible = true;
PauseStatusButton.ToolTipText = "Emulator is playing to frame " + PauseOnFrame.Value + " click to stop seek"; PauseStatusButton.ToolTipText = $"Emulator is playing to frame {PauseOnFrame.Value} click to stop seek";
} }
else if (EmulatorPaused) else if (EmulatorPaused)
{ {
@ -1967,14 +1955,14 @@ namespace BizHawk.Client.EmuHawk
{ {
Global.Config.SpeedPercentAlternate = value; Global.Config.SpeedPercentAlternate = value;
SyncThrottle(); SyncThrottle();
GlobalWin.OSD.AddMessage("Alternate Speed: " + value + "%"); GlobalWin.OSD.AddMessage($"Alternate Speed: {value}%");
} }
private void SetSpeedPercent(int value) private void SetSpeedPercent(int value)
{ {
Global.Config.SpeedPercent = value; Global.Config.SpeedPercent = value;
SyncThrottle(); SyncThrottle();
GlobalWin.OSD.AddMessage("Speed: " + value + "%"); GlobalWin.OSD.AddMessage($"Speed: {value}%");
} }
private void Shutdown() private void Shutdown()
@ -2328,7 +2316,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.SoundVolume = 100; Global.Config.SoundVolume = 100;
} }
GlobalWin.OSD.AddMessage("Volume " + Global.Config.SoundVolume); GlobalWin.OSD.AddMessage($"Volume {Global.Config.SoundVolume}");
} }
private static void VolumeDown() private static void VolumeDown()
@ -2339,7 +2327,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.SoundVolume = 0; Global.Config.SoundVolume = 0;
} }
GlobalWin.OSD.AddMessage("Volume " + Global.Config.SoundVolume); GlobalWin.OSD.AddMessage($"Volume {Global.Config.SoundVolume}");
} }
private void SoftReset() private void SoftReset()
@ -2438,7 +2426,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
GlobalWin.OSD.AddMessage("Screensize set to " + Global.Config.TargetZoomFactors[Emulator.SystemId] + "x"); GlobalWin.OSD.AddMessage($"Screensize set to {Global.Config.TargetZoomFactors[Emulator.SystemId]}x");
FrameBufferResized(); FrameBufferResized();
} }
@ -2465,7 +2453,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
GlobalWin.OSD.AddMessage("Screensize set to " + Global.Config.TargetZoomFactors[Emulator.SystemId] + "x"); GlobalWin.OSD.AddMessage($"Screensize set to {Global.Config.TargetZoomFactors[Emulator.SystemId]}x");
FrameBufferResized(); FrameBufferResized();
} }
@ -2624,7 +2612,7 @@ namespace BizHawk.Client.EmuHawk
if (Global.MovieSession.Movie.IsActive) if (Global.MovieSession.Movie.IsActive)
{ {
Global.MovieSession.Movie.Save(); Global.MovieSession.Movie.Save();
GlobalWin.OSD.AddMessage(Global.MovieSession.Movie.Filename + " saved."); GlobalWin.OSD.AddMessage($"{Global.MovieSession.Movie.Filename} saved.");
} }
} }
@ -2664,9 +2652,7 @@ namespace BizHawk.Client.EmuHawk
? _linkCableOn ? _linkCableOn
: _linkCableOff; : _linkCableOff;
LinkConnectStatusBarButton.ToolTipText = Emulator.AsLinkable().LinkConnected LinkConnectStatusBarButton.ToolTipText = $"Link connection is currently {(Emulator.AsLinkable().LinkConnected ? "enabled" : "disabled")}";
? "Link connection is currently enabled"
: "Link connection is currently disabled";
} }
else else
{ {
@ -2701,21 +2687,18 @@ namespace BizHawk.Client.EmuHawk
private static void ToggleModePokeMode() private static void ToggleModePokeMode()
{ {
Global.Config.MoviePlaybackPokeMode ^= true; Global.Config.MoviePlaybackPokeMode ^= true;
GlobalWin.OSD.AddMessage(Global.Config.MoviePlaybackPokeMode ? "Movie Poke mode enabled" : "Movie Poke mode disabled"); GlobalWin.OSD.AddMessage($"Movie Poke mode {(Global.Config.MoviePlaybackPokeMode ? "enabled" : "disabled")}");
} }
private static void ToggleBackgroundInput() private static void ToggleBackgroundInput()
{ {
Global.Config.AcceptBackgroundInput ^= true; Global.Config.AcceptBackgroundInput ^= true;
GlobalWin.OSD.AddMessage(Global.Config.AcceptBackgroundInput GlobalWin.OSD.AddMessage($"Background Input {(Global.Config.AcceptBackgroundInput ? "enabled" : "disabled")}");
? "Background Input enabled"
: "Background Input disabled");
} }
private static void VsyncMessage() private static void VsyncMessage()
{ {
GlobalWin.OSD.AddMessage( GlobalWin.OSD.AddMessage($"Display Vsync set to {(Global.Config.VSync ? "on" : "off")}");
"Display Vsync set to " + (Global.Config.VSync ? "on" : "off"));
} }
private static bool StateErrorAskUser(string title, string message) private static bool StateErrorAskUser(string title, string message)
@ -3276,7 +3259,7 @@ namespace BizHawk.Client.EmuHawk
var sfd = new SaveFileDialog(); var sfd = new SaveFileDialog();
if (Global.Game != null) 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.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); sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null);
} }
else else
@ -3465,7 +3448,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception e) catch (Exception e)
{ {
MessageBox.Show("Video dumping died:\n\n" + e); MessageBox.Show($"Video dumping died:\n\n{e}");
AbortAv(); AbortAv();
} }
@ -3531,7 +3514,7 @@ namespace BizHawk.Client.EmuHawk
string title = "load error"; string title = "load error";
if (e.AttemptedCoreLoad != null) if (e.AttemptedCoreLoad != null)
{ {
title = e.AttemptedCoreLoad + " load error"; title = $"{e.AttemptedCoreLoad} load error";
} }
MessageBox.Show(this, e.Message, title, MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(this, e.Message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
@ -3682,7 +3665,7 @@ namespace BizHawk.Client.EmuHawk
if (result) if (result)
{ {
string loaderName = "*" + OpenAdvancedSerializer.Serialize(ioa); string loaderName = $"*{OpenAdvancedSerializer.Serialize(ioa)}";
Emulator = loader.LoadedEmulator; Emulator = loader.LoadedEmulator;
Global.Game = loader.Game; Global.Game = loader.Game;
CoreFileProvider.SyncCoreCommInputSignals(nextComm); CoreFileProvider.SyncCoreCommInputSignals(nextComm);
@ -3714,8 +3697,8 @@ namespace BizHawk.Client.EmuHawk
else else
{ {
xSw.WriteLine(xmlGame.Assets[xg].Key); xSw.WriteLine(xmlGame.Assets[xg].Key);
xSw.WriteLine("SHA1:" + xmlGame.Assets[xg].Value.HashSHA1()); xSw.WriteLine($"SHA1:{xmlGame.Assets[xg].Value.HashSHA1()}");
xSw.WriteLine("MD5:" + xmlGame.Assets[xg].Value.HashMD5()); xSw.WriteLine($"MD5:{xmlGame.Assets[xg].Value.HashMD5()}");
xSw.WriteLine(); xSw.WriteLine();
} }
} }
@ -3829,7 +3812,7 @@ namespace BizHawk.Client.EmuHawk
ToolFormBase.UpdateCheatRelatedTools(null, null); ToolFormBase.UpdateCheatRelatedTools(null, null);
if (Global.Config.AutoLoadLastSaveSlot && _stateSlots.HasSlot(Global.Config.SaveSlot)) if (Global.Config.AutoLoadLastSaveSlot && _stateSlots.HasSlot(Global.Config.SaveSlot))
{ {
LoadQuickSave("QuickSave" + Global.Config.SaveSlot); LoadQuickSave($"QuickSave{Global.Config.SaveSlot}");
} }
if (Global.FirmwareManager.RecentlyServed.Count > 0) if (Global.FirmwareManager.RecentlyServed.Count > 0)
@ -3971,7 +3954,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.Restart(); GlobalWin.Tools.Restart();
ApiManager.Restart(Emulator.ServiceProvider); ApiManager.Restart(Emulator.ServiceProvider);
RewireSound(); RewireSound();
Text = "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : ""); Text = $"BizHawk{(VersionInfo.DeveloperBuild ? " (interim) " : "")}";
HandlePlatformMenus(); HandlePlatformMenus();
_stateSlots.Clear(); _stateSlots.Clear();
UpdateDumpIcon(); UpdateDumpIcon();
@ -3999,7 +3982,7 @@ namespace BizHawk.Client.EmuHawk
public void EnableRewind(bool enabled) public void EnableRewind(bool enabled)
{ {
Global.Rewinder.SuspendRewind = !enabled; Global.Rewinder.SuspendRewind = !enabled;
GlobalWin.OSD.AddMessage("Rewind " + (enabled ? "enabled" : "suspended")); GlobalWin.OSD.AddMessage($"Rewind {(enabled ? "enabled" : "suspended")}");
} }
public void ClearRewindData() public void ClearRewindData()
@ -4079,7 +4062,7 @@ namespace BizHawk.Client.EmuHawk
if (!supressOSD) if (!supressOSD)
{ {
GlobalWin.OSD.AddMessage("Loaded state: " + userFriendlyStateName); GlobalWin.OSD.AddMessage($"Loaded state: {userFriendlyStateName}");
} }
} }
else else
@ -4110,10 +4093,10 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State"; var path = $"{PathManager.SaveStatePrefix(Global.Game)}.{quickSlotName}.State";
if (!File.Exists(path)) if (!File.Exists(path))
{ {
GlobalWin.OSD.AddMessage("Unable to load " + quickSlotName + ".State"); GlobalWin.OSD.AddMessage($"Unable to load {quickSlotName}.State");
return; return;
} }
@ -4140,11 +4123,11 @@ namespace BizHawk.Client.EmuHawk
ClientApi.OnStateSaved(this, userFriendlyStateName); ClientApi.OnStateSaved(this, userFriendlyStateName);
GlobalWin.OSD.AddMessage("Saved state: " + userFriendlyStateName); GlobalWin.OSD.AddMessage($"Saved state: {userFriendlyStateName}");
} }
catch (IOException) catch (IOException)
{ {
GlobalWin.OSD.AddMessage("Unable to save state " + path); GlobalWin.OSD.AddMessage($"Unable to save state {path}");
} }
if (!fromLua) if (!fromLua)
@ -4174,7 +4157,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State"; var path = $"{PathManager.SaveStatePrefix(Global.Game)}.{quickSlotName}.State";
var file = new FileInfo(path); var file = new FileInfo(path);
if (file.Directory != null && !file.Directory.Exists) if (file.Directory != null && !file.Directory.Exists)
@ -4185,7 +4168,7 @@ namespace BizHawk.Client.EmuHawk
// Make backup first // Make backup first
if (Global.Config.BackupSavestates) if (Global.Config.BackupSavestates)
{ {
Util.TryMoveBackupFile(path, path + ".bak"); Util.TryMoveBackupFile(path, $"{path}.bak");
} }
SaveState(path, quickSlotName, false); SaveState(path, quickSlotName, false);
@ -4230,7 +4213,7 @@ namespace BizHawk.Client.EmuHawk
DefaultExt = "State", DefaultExt = "State",
Filter = "Save States (*.State)|*.State|All Files|*.*", Filter = "Save States (*.State)|*.State|All Files|*.*",
InitialDirectory = path, InitialDirectory = path,
FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State" FileName = $"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave0.State"
}; };
var result = sfd.ShowHawkDialog(); var result = sfd.ShowHawkDialog();

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!bootstrap) if (!bootstrap)
{ {
MessageBox.Show("Couldn't load the selected Libretro core for analysis. It won't be available.\n\nError:\n\n" + ex.ToString()); MessageBox.Show($"Couldn't load the selected Libretro core for analysis. It won't be available.\n\nError:\n\n{ex}");
} }
} }
} }

View File

@ -37,11 +37,11 @@ namespace BizHawk.Client.EmuHawk
{ {
if (RomGame.RomData.Length > 10 * 1024 * 1024) // If 10mb, show in megabytes if (RomGame.RomData.Length > 10 * 1024 * 1024) // If 10mb, show in megabytes
{ {
RomSizeLabel.Text = string.Format("{0:n0}", (RomGame.RomData.Length / 1024 / 1024)) + "mb"; RomSizeLabel.Text = $"{RomGame.RomData.Length / 1024 / 1024:n0}mb";
} }
else else
{ {
RomSizeLabel.Text = string.Format("{0:n0}", (RomGame.RomData.Length / 1024)) + "kb"; RomSizeLabel.Text = $"{RomGame.RomData.Length / 1024:n0}kb";
} }
ExtensionLabel.Text = RomGame.Extension.ToLower(); ExtensionLabel.Text = RomGame.Extension.ToLower();

View File

@ -125,7 +125,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var result = MessageBox.Show( var result = MessageBox.Show(
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)", "EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
"Fatal error: " + e.GetType().Name, $"Fatal error: {e.GetType().Name}",
MessageBoxButtons.YesNo, MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation MessageBoxIcon.Exclamation
); );
@ -173,7 +173,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var result = MessageBox.Show( var result = MessageBox.Show(
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)", "EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
"Fatal error: " + e.GetType().Name, $"Fatal error: {e.GetType().Name}",
MessageBoxButtons.YesNo, MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation MessageBoxIcon.Exclamation
); );
@ -350,7 +350,7 @@ namespace BizHawk.Client.EmuHawk
public static void RemoveMOTW(string path) public static void RemoveMOTW(string path)
{ {
DeleteFileW(path + ":Zone.Identifier"); DeleteFileW($"{path}:Zone.Identifier");
} }
static void WhackAllMOTW(string dllDir) static void WhackAllMOTW(string dllDir)
@ -410,7 +410,7 @@ namespace BizHawk.Client.EmuHawk
return asm; return asm;
//load missing assemblies by trying to find them in the dll directory //load missing assemblies by trying to find them in the dll directory
string dllname = new AssemblyName(requested).Name + ".dll"; string dllname = $"{new AssemblyName(requested).Name}.dll";
string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll"); string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
string simpleName = new AssemblyName(requested).Name; string simpleName = new AssemblyName(requested).Name;
if (simpleName == "NLua" || simpleName == "KopiLua") directory = Path.Combine(directory, "nlua"); if (simpleName == "NLua" || simpleName == "KopiLua") directory = Path.Combine(directory, "nlua");

View File

@ -167,7 +167,7 @@ namespace BizHawk.Client.EmuHawk
if (extraSampleCount < -maxSamplesDeficit) if (extraSampleCount < -maxSamplesDeficit)
{ {
int generateSampleCount = -extraSampleCount; int generateSampleCount = -extraSampleCount;
if (LogDebug) Console.WriteLine("Generating " + generateSampleCount + " samples"); if (LogDebug) Console.WriteLine($"Generating {generateSampleCount} samples");
for (int i = 0; i < generateSampleCount * ChannelCount; i++) for (int i = 0; i < generateSampleCount * ChannelCount; i++)
{ {
_buffer.Enqueue(0); _buffer.Enqueue(0);
@ -177,7 +177,7 @@ namespace BizHawk.Client.EmuHawk
else if (extraSampleCount > maxSamplesSurplus) else if (extraSampleCount > maxSamplesSurplus)
{ {
int discardSampleCount = extraSampleCount; int discardSampleCount = extraSampleCount;
if (LogDebug) Console.WriteLine("Discarding " + discardSampleCount + " samples"); if (LogDebug) Console.WriteLine($"Discarding {discardSampleCount} samples");
for (int i = 0; i < discardSampleCount * ChannelCount; i++) for (int i = 0; i < discardSampleCount * ChannelCount; i++)
{ {
_buffer.Dequeue(); _buffer.Dequeue();

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
//notably, if we're frame-advancing, we should be paused. //notably, if we're frame-advancing, we should be paused.
if (signal_paused && !signal_continuousFrameAdvancing) if (signal_paused && !signal_continuousFrameAdvancing)
{ {
//Console.WriteLine("THE THING: {0} {1}", signal_paused ,signal_continuousFrameAdvancing); //Console.WriteLine($"THE THING: {signal_paused} {signal_continuousFrameAdvancing}");
skipNextFrame = false; skipNextFrame = false;
framesSkipped = 0; framesSkipped = 0;
framesToSkip = 0; framesToSkip = 0;
@ -198,12 +198,12 @@ namespace BizHawk.Client.EmuHawk
int pct = -1; int pct = -1;
public void SetSpeedPercent(int percent) public void SetSpeedPercent(int percent)
{ {
//Console.WriteLine("throttle set percent " + percent); //Console.WriteLine($"throttle set percent {percent}");
if (pct == percent) return; if (pct == percent) return;
pct = percent; pct = percent;
float fraction = percent / 100.0f; float fraction = percent / 100.0f;
desiredfps = (ulong)(core_desiredfps * fraction); desiredfps = (ulong)(core_desiredfps * fraction);
//Console.WriteLine("throttle set desiredfps " + desiredfps); //Console.WriteLine($"throttle set desiredfps {desiredfps}");
desiredspf = 65536.0f / desiredfps; desiredspf = 65536.0f / desiredfps;
AutoFrameSkip_IgnorePreviousDelay(); AutoFrameSkip_IgnorePreviousDelay();
} }

View File

@ -107,8 +107,8 @@ namespace BizHawk.Client.EmuHawk
private static string GetTextFromTag(string info, string tagName) private static string GetTextFromTag(string info, string tagName)
{ {
string openTag = "[" + tagName + "]"; string openTag = $"[{tagName}]";
string closeTag = "[/" + tagName + "]"; string closeTag = $"[/{tagName}]";
int start = info.IndexOf(openTag, StringComparison.OrdinalIgnoreCase); int start = info.IndexOf(openTag, StringComparison.OrdinalIgnoreCase);
if (start == -1) return null; if (start == -1) return null;
start += openTag.Length; start += openTag.Length;

View File

@ -126,7 +126,7 @@ namespace BizHawk.Client.EmuHawk
int i; int i;
for (i = MaxPlayers; i > 0; i--) for (i = MaxPlayers; i > 0; i--)
{ {
if (button.StartsWith("P" + i)) if (button.StartsWith($"P{i}"))
{ {
break; break;
} }
@ -162,7 +162,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (buckets[i].Count > 0) if (buckets[i].Count > 0)
{ {
string tabname = Global.Emulator.SystemId == "WSWAN" ? i == 1 ? "Normal" : "Rotated" : "Player " + i; // hack string tabname = Global.Emulator.SystemId != "WSWAN" ? $"Player {i}" : i == 1 ? "Normal" : "Rotated"; // hack
tt.TabPages.Add(tabname); tt.TabPages.Add(tabname);
tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[i], tt.Size)); tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[i], tt.Size));
pageidx++; pageidx++;
@ -362,7 +362,7 @@ namespace BizHawk.Client.EmuHawk
private void NewControllerConfig_Load(object sender, EventArgs e) private void NewControllerConfig_Load(object sender, EventArgs e)
{ {
Text = _theDefinition.Name + " Configuration"; Text = $"{_theDefinition.Name} Configuration";
} }
private static TabControl GetTabControl(IEnumerable controls) private static TabControl GetTabControl(IEnumerable controls)

View File

@ -66,13 +66,13 @@ namespace BizHawk.Client.EmuHawk
private void TrackBarSensitivity_ValueChanged(object sender, EventArgs e) private void TrackBarSensitivity_ValueChanged(object sender, EventArgs e)
{ {
_bind.Mult = trackBarSensitivity.Value / 10.0f; _bind.Mult = trackBarSensitivity.Value / 10.0f;
labelSensitivity.Text = $"Sensitivity: {(Bind.Mult * 100)}" + "%"; labelSensitivity.Text = $"Sensitivity: {Bind.Mult * 100}%";
} }
private void TrackBarDeadzone_ValueChanged(object sender, EventArgs e) private void TrackBarDeadzone_ValueChanged(object sender, EventArgs e)
{ {
_bind.Deadzone = trackBarDeadzone.Value / 20.0f; _bind.Deadzone = trackBarDeadzone.Value / 20.0f;
labelDeadzone.Text = $"Deadzone: {(Bind.Deadzone * 100)}" + "%"; labelDeadzone.Text = $"Deadzone: {Bind.Deadzone * 100}%";
} }
private void ButtonFlip_Click(object sender, EventArgs e) private void ButtonFlip_Click(object sender, EventArgs e)

View File

@ -270,7 +270,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.TargetScanlineFilterIntensity = tbScanlineIntensity.Value; Global.Config.TargetScanlineFilterIntensity = tbScanlineIntensity.Value;
int scanlines = Global.Config.TargetScanlineFilterIntensity; int scanlines = Global.Config.TargetScanlineFilterIntensity;
float percentage = (float) scanlines / 256 * 100; float percentage = (float) scanlines / 256 * 100;
lblScanlines.Text = String.Format("{0:F2}", percentage) + "%"; lblScanlines.Text = $"{percentage:F2}%";
} }
private void trackbarFrameSizeWindowed_ValueChanged(object sender, EventArgs e) private void trackbarFrameSizeWindowed_ValueChanged(object sender, EventArgs e)

View File

@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
tbbCloseReload.ToolTipText = "Close Firmware Manager and reload " + reloadRomPath; tbbCloseReload.ToolTipText = $"Close Firmware Manager and reload {reloadRomPath}";
} }
} }
@ -313,7 +313,7 @@ namespace BizHawk.Client.EmuHawk
lvi.SubItems[6].Text = ri.Size.ToString(); lvi.SubItems[6].Text = ri.Size.ToString();
if (ri.Hash != null) lvi.SubItems[7].Text = "sha1:" + ri.Hash; if (ri.Hash != null) lvi.SubItems[7].Text = $"sha1:{ri.Hash}";
else lvi.SubItems[7].Text = ""; else lvi.SubItems[7].Text = "";
} }
} }
@ -443,7 +443,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(this, "There was an issue copying the file. The customization has NOT been set.\n\n" + ex.StackTrace); MessageBox.Show(this, $"There was an issue copying the file. The customization has NOT been set.\n\n{ex.StackTrace}");
continue; continue;
} }
} }
@ -456,7 +456,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(this, "There was an issue during the process. The customization has NOT been set.\n\n" + ex.StackTrace); MessageBox.Show(this, $"There was an issue during the process. The customization has NOT been set.\n\n{ex.StackTrace}");
return; return;
} }
@ -526,7 +526,7 @@ namespace BizHawk.Client.EmuHawk
} }
olvi.SubItems[0].Text = ff.Size.ToString(); olvi.SubItems[0].Text = ff.Size.ToString();
olvi.SubItems[0].Font = this.Font; // why doesnt this work? olvi.SubItems[0].Font = this.Font; // why doesnt this work?
olvi.SubItems[1].Text = "sha1:" + o.Hash; olvi.SubItems[1].Text = $"sha1:{o.Hash}";
olvi.SubItems[1].Font = fixedFont; olvi.SubItems[1].Font = fixedFont;
olvi.SubItems[2].Text = ff.RecommendedName; olvi.SubItems[2].Text = ff.RecommendedName;
olvi.SubItems[2].Font = this.Font; // why doesnt this work? olvi.SubItems[2].Font = this.Font; // why doesnt this work?
@ -648,7 +648,7 @@ namespace BizHawk.Client.EmuHawk
if (hf.IsArchive) if (hf.IsArchive)
{ {
// blech. the worst extraction code in the universe. // blech. the worst extraction code in the universe.
string extractpath = Path.GetTempFileName() + ".dir"; string extractpath = $"{Path.GetTempFileName()}.dir";
DirectoryInfo di = Directory.CreateDirectory(extractpath); DirectoryInfo di = Directory.CreateDirectory(extractpath);
try try

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
FileName = PathManager.FilesystemSafeName(Global.Game) + "-Palettes", FileName = $"{PathManager.FilesystemSafeName(Global.Game)}-Palettes",
InitialDirectory = path, InitialDirectory = path,
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true RestoreDirectory = true

View File

@ -353,7 +353,7 @@ namespace BizHawk.Client.EmuHawk
using (var sfd = new SaveFileDialog()) using (var sfd = new SaveFileDialog())
{ {
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["GB", "Palettes"].Path, "GB"); sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["GB", "Palettes"].Path, "GB");
sfd.FileName = Global.Game.Name + ".pal"; sfd.FileName = $"{Global.Game.Name}.pal";
sfd.Filter = "Gambatte Palettes (*.pal)|*.pal|All Files|*.*"; sfd.Filter = "Gambatte Palettes (*.pal)|*.pal|All Files|*.*";
sfd.RestoreDirectory = true; sfd.RestoreDirectory = true;

View File

@ -38,13 +38,13 @@ namespace BizHawk.Client.EmuHawk
public void RefreshTooltip() public void RefreshTooltip()
{ {
string widgetText = "Current Binding: " + widget.Text; string widgetText = $"Current Binding: {widget.Text}";
if (_bindingTooltipText != null) if (_bindingTooltipText != null)
{ {
widgetText = widgetText + "\r\n---\r\n" + _bindingTooltipText; widgetText = $"{widgetText}\r\n---\r\n{_bindingTooltipText}";
} }
widgetText = widgetText + "\r\n---\r\n" + WidgetTooltipText; widgetText = $"{widgetText}\r\n---\r\n{WidgetTooltipText}";
_tooltip.SetToolTip(widget, widgetText); _tooltip.SetToolTip(widget, widgetText);
} }

View File

@ -411,15 +411,15 @@ namespace BizHawk.Client.EmuHawk
_dispAutoholdy = _py; _dispAutoholdy = _py;
} }
FpsPosLabel.Text = _dispFpSx + ", " + _dispFpSy; FpsPosLabel.Text = $"{_dispFpSx}, {_dispFpSy}";
FCLabel.Text = _dispFrameCx + ", " + _dispFrameCy; FCLabel.Text = $"{_dispFrameCx}, {_dispFrameCy}";
LagLabel.Text = _dispLagx + ", " + _dispLagy; LagLabel.Text = $"{_dispLagx}, {_dispLagy}";
InpLabel.Text = _dispInpx + ", " + _dispInpy; InpLabel.Text = $"{_dispInpx}, {_dispInpy}";
WatchesLabel.Text = _dispWatchesx + ", " + _dispWatchesy; WatchesLabel.Text = $"{_dispWatchesx}, {_dispWatchesy}";
RerecLabel.Text = _dispRecx + ", " + _dispRecy; RerecLabel.Text = $"{_dispRecx}, {_dispRecy}";
MultitrackLabel.Text = _dispMultix + ", " + _dispMultiy; MultitrackLabel.Text = $"{_dispMultix}, {_dispMultiy}";
MessLabel.Text = _dispMessagex + ", " + _dispMessagey; MessLabel.Text = $"{_dispMessagex}, {_dispMessagey}";
AutoholdLabel.Text = _dispAutoholdx + ", " + _dispAutoholdy; AutoholdLabel.Text = $"{_dispAutoholdx}, {_dispAutoholdy}";
} }
private void ResetDefaultsButton_Click(object sender, EventArgs e) private void ResetDefaultsButton_Click(object sender, EventArgs e)

View File

@ -16,7 +16,7 @@ namespace BizHawk.Client.EmuHawk
{ {
InitializeComponent(); InitializeComponent();
ControllerNameLabel.Text = "Controller " + ControllerNumber; ControllerNameLabel.Text = $"Controller {ControllerNumber}";
} }
public int ControllerNumber public int ControllerNumber
@ -82,7 +82,7 @@ namespace BizHawk.Client.EmuHawk
public override void Refresh() public override void Refresh()
{ {
ControllerNameLabel.Text = "Controller " + ControllerNumber; ControllerNameLabel.Text = $"Controller {ControllerNumber}";
base.Refresh(); base.Refresh();
} }

View File

@ -533,9 +533,7 @@ namespace BizHawk.Client.EmuHawk
VideoResolutionXTextBox.Text = _s.VideoSizeX.ToString(); VideoResolutionXTextBox.Text = _s.VideoSizeX.ToString();
VideoResolutionYTextBox.Text = _s.VideoSizeY.ToString(); VideoResolutionYTextBox.Text = _s.VideoSizeY.ToString();
var videoSetting = _s.VideoSizeX var videoSetting = $"{_s.VideoSizeX} x {_s.VideoSizeY}";
+ " x "
+ _s.VideoSizeY;
var index = VideoResolutionComboBox.Items.IndexOf(videoSetting); var index = VideoResolutionComboBox.Items.IndexOf(videoSetting);
if (index >= 0) if (index >= 0)
@ -605,7 +603,7 @@ namespace BizHawk.Client.EmuHawk
RiceColorQuality_Combo.SelectedIndex = _ss.RicePlugin.ColorQuality; RiceColorQuality_Combo.SelectedIndex = _ss.RicePlugin.ColorQuality;
RiceOpenGLRenderSetting_Combo.SelectedIndex = _ss.RicePlugin.OpenGLRenderSetting; RiceOpenGLRenderSetting_Combo.SelectedIndex = _ss.RicePlugin.OpenGLRenderSetting;
RiceAnisotropicFiltering_TB.Value = _ss.RicePlugin.AnisotropicFiltering; RiceAnisotropicFiltering_TB.Value = _ss.RicePlugin.AnisotropicFiltering;
AnisotropicFiltering_LB.Text = "Anisotropic Filtering: " + RiceAnisotropicFiltering_TB.Value; AnisotropicFiltering_LB.Text = $"Anisotropic Filtering: {RiceAnisotropicFiltering_TB.Value}";
RiceUseDefaultHacks_CB.Checked = _ss.RicePlugin.UseDefaultHacks; RiceUseDefaultHacks_CB.Checked = _ss.RicePlugin.UseDefaultHacks;
@ -854,7 +852,7 @@ namespace BizHawk.Client.EmuHawk
private void RiceAnisotropicFiltering_Tb_Scroll_1(object sender, EventArgs e) private void RiceAnisotropicFiltering_Tb_Scroll_1(object sender, EventArgs e)
{ {
AnisotropicFiltering_LB.Text = "Anisotropic Filtering: " + RiceAnisotropicFiltering_TB.Value; AnisotropicFiltering_LB.Text = $"Anisotropic Filtering: {RiceAnisotropicFiltering_TB.Value}";
} }
private void RiceUseDefaultHacks_Cb_CheckedChanged(object sender, EventArgs e) private void RiceUseDefaultHacks_Cb_CheckedChanged(object sender, EventArgs e)

View File

@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk
var data = Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name)); var data = Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name));
if (showmsg) if (showmsg)
{ {
GlobalWin.OSD.AddMessage("Palette file loaded: " + palette.Name); GlobalWin.OSD.AddMessage($"Palette file loaded: {palette.Name}");
} }
return data; return data;

View File

@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
lbl.Text = "P" + lc.PlayerAssignments[i]; lbl.Text = $"P{lc.PlayerAssignments[i]}";
lbl.Visible = true; lbl.Visible = true;
} }
} }

View File

@ -220,7 +220,7 @@ namespace BizHawk.Client.EmuHawk
var f = new FolderBrowserEx var f = new FolderBrowserEx
{ {
Description = "Set the directory for " + name, Description = $"Set the directory for {name}",
SelectedPath = PathManager.MakeAbsolutePath(box.Text, system) SelectedPath = PathManager.MakeAbsolutePath(box.Text, system)
}; };
var result = f.ShowDialog(); var result = f.ShowDialog();

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (Global.Rewinder.HasBuffer) if (Global.Rewinder.HasBuffer)
{ {
FullnessLabel.Text = $"{Global.Rewinder.FullnessRatio * 100:0.00}" + "%"; FullnessLabel.Text = $"{Global.Rewinder.FullnessRatio * 100:0.00}%";
RewindFramesUsedLabel.Text = Global.Rewinder.Count.ToString(); RewindFramesUsedLabel.Text = Global.Rewinder.Count.ToString();
} }
else else
@ -94,10 +94,10 @@ namespace BizHawk.Client.EmuHawk
if (num >= 1024) if (num >= 1024)
{ {
num /= 1024.0; num /= 1024.0;
return $"{num:0.00}" + " MB"; return $"{num:0.00} MB";
} }
return $"{num:0.00}" + " KB"; return $"{num:0.00} KB";
} }
private void SetStateSize() private void SetStateSize()
@ -344,8 +344,8 @@ namespace BizHawk.Client.EmuHawk
double minutes = estTotalFrames / 60 / 60; double minutes = estTotalFrames / 60 / 60;
AverageStoredStateSizeLabel.Text = FormatKB(avgStateSize); AverageStoredStateSizeLabel.Text = FormatKB(avgStateSize);
ApproxFramesLabel.Text = $"{estFrames:n0}" + " frames"; ApproxFramesLabel.Text = $"{estFrames:n0} frames";
EstTimeLabel.Text = $"{minutes:n}" + " minutes"; EstTimeLabel.Text = $"{minutes:n} minutes";
} }
private void BufferSizeUpDown_ValueChanged(object sender, EventArgs e) private void BufferSizeUpDown_ValueChanged(object sender, EventArgs e)

View File

@ -46,8 +46,8 @@ namespace BizHawk.Client.EmuHawk
private void ShowError(int row, int column) private void ShowError(int row, int column)
{ {
var c = SubGrid.Rows[row].Cells[column]; var c = SubGrid.Rows[row].Cells[column];
var error = "Unable to parse value: " + c.Value; var error = $"Unable to parse value: {c.Value}";
var caption = "Parse Error Row " + row + " Column " + column; var caption = $"Parse Error Row {row} Column {column}";
MessageBox.Show(error, caption, MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(error, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
@ -104,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
c = SubGrid.Rows[x].Cells[3]; c = SubGrid.Rows[x].Cells[3];
c.Value = s.Duration; c.Value = s.Duration;
c = SubGrid.Rows[x].Cells[4]; c = SubGrid.Rows[x].Cells[4];
c.Value = string.Format("{0:X8}", s.Color); c.Value = $"{s.Color:X8}";
c.Style.BackColor = Color.FromArgb((int)s.Color); c.Style.BackColor = Color.FromArgb((int)s.Color);
c = SubGrid.Rows[x].Cells[5]; c = SubGrid.Rows[x].Cells[5];
c.Value = s.Message; c.Value = s.Message;
@ -127,7 +127,7 @@ namespace BizHawk.Client.EmuHawk
c = SubGrid.Rows[index].Cells[3]; c = SubGrid.Rows[index].Cells[3];
c.Value = s.Duration; c.Value = s.Duration;
c = SubGrid.Rows[index].Cells[4]; c = SubGrid.Rows[index].Cells[4];
c.Value = string.Format("{0:X8}", s.Color); c.Value = $"{s.Color:X8}";
c.Style.BackColor = Color.FromArgb((int)s.Color); c.Style.BackColor = Color.FromArgb((int)s.Color);
c = SubGrid.Rows[index].Cells[5]; c = SubGrid.Rows[index].Cells[5];
c.Value = s.Message; c.Value = s.Message;
@ -229,9 +229,7 @@ namespace BizHawk.Client.EmuHawk
File.WriteAllText(fileName, str); File.WriteAllText(fileName, str);
// Display success // Display success
MessageBox.Show( MessageBox.Show($"Subtitles succesfully exported to {fileName}.", "Success");
string.Format("Subtitles succesfully exported to {0}.", fileName),
"Success");
} }
private void SubGrid_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e) private void SubGrid_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)

View File

@ -154,8 +154,7 @@ namespace BizHawk.Client.EmuHawk
private void UpdateList() private void UpdateList()
{ {
MovieView.Refresh(); MovieView.Refresh();
MovieCount.Text = _movieList.Count + " movie" MovieCount.Text = $"{_movieList.Count} {(_movieList.Count == 1 ? "movie" : "movies")}";
+ (_movieList.Count != 1 ? "s" : "");
} }
private void PreHighlightMovie() private void PreHighlightMovie()
@ -193,7 +192,7 @@ namespace BizHawk.Client.EmuHawk
{ {
foreach (var ext in MovieService.MovieExtensions) foreach (var ext in MovieService.MovieExtensions)
{ {
if (Path.GetExtension(_movieList[indices[i]].Filename).ToUpper() == "." + ext) if (Path.GetExtension(_movieList[indices[i]].Filename).ToUpper() == $".{ext}")
{ {
tas.Add(i); tas.Add(i);
} }
@ -266,8 +265,8 @@ namespace BizHawk.Client.EmuHawk
} }
// add movies // add movies
fpTodo.AddRange(Directory.GetFiles(dp, "*." + MovieService.DefaultExtension)); fpTodo.AddRange(Directory.GetFiles(dp, $"*.{MovieService.DefaultExtension}"));
fpTodo.AddRange(Directory.GetFiles(dp, "*." + TasMovie.Extension)); fpTodo.AddRange(Directory.GetFiles(dp, $"*.{TasMovie.Extension}"));
} }
// in parallel, scan each movie // in parallel, scan each movie
@ -419,7 +418,7 @@ namespace BizHawk.Client.EmuHawk
if (kvp.Value != Global.Game.Hash) if (kvp.Value != Global.Game.Hash)
{ {
item.BackColor = Color.Pink; item.BackColor = Color.Pink;
toolTip1.SetToolTip(DetailsView, "Current SHA1: " + Global.Game.Hash); toolTip1.SetToolTip(DetailsView, $"Current SHA1: {Global.Game.Hash}");
} }
break; break;
case HeaderKeys.EMULATIONVERSION: case HeaderKeys.EMULATIONVERSION:
@ -447,7 +446,7 @@ namespace BizHawk.Client.EmuHawk
} }
var FpsItem = new ListViewItem("Fps"); var FpsItem = new ListViewItem("Fps");
FpsItem.SubItems.Add(string.Format("{0:0.#######}", Fps(_movieList[firstIndex]))); FpsItem.SubItems.Add($"{Fps(_movieList[firstIndex]):0.#######}");
DetailsView.Items.Add(FpsItem); DetailsView.Items.Add(FpsItem);
var FramesItem = new ListViewItem("Frames"); var FramesItem = new ListViewItem("Frames");
@ -576,9 +575,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var ofd = new OpenFileDialog var ofd = new OpenFileDialog
{ {
Filter = "Movie Files (*." + MovieService.DefaultExtension + ")|*." + MovieService.DefaultExtension + Filter = $"Movie Files (*.{MovieService.DefaultExtension})|*.{MovieService.DefaultExtension}|TAS project Files (*.{TasMovie.Extension})|*.{TasMovie.Extension}|All Files|*.*",
"|TAS project Files (*." + TasMovie.Extension + ")|*." + TasMovie.Extension +
"|All Files|*.*",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null)
}; };

View File

@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
if (!MovieService.MovieExtensions.Contains(Path.GetExtension(path))) if (!MovieService.MovieExtensions.Contains(Path.GetExtension(path)))
{ {
// If no valid movie extension, add movie extension // If no valid movie extension, add movie extension
path += "." + MovieService.DefaultExtension; path += $".{MovieService.DefaultExtension}";
} }
} }
} }
@ -77,7 +77,7 @@ namespace BizHawk.Client.EmuHawk
var test = new FileInfo(path); var test = new FileInfo(path);
if (test.Exists) if (test.Exists)
{ {
var result = MessageBox.Show(path + " already exists, overwrite?", "Confirm overwrite", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); var result = MessageBox.Show($"{path} already exists, overwrite?", "Confirm overwrite", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
if (result == DialogResult.Cancel) if (result == DialogResult.Cancel)
{ {
return; return;
@ -180,10 +180,10 @@ namespace BizHawk.Client.EmuHawk
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
InitialDirectory = movieFolderPath, InitialDirectory = movieFolderPath,
DefaultExt = "." + Global.MovieSession.Movie.PreferredExtension, DefaultExt = $".{Global.MovieSession.Movie.PreferredExtension}",
FileName = RecordBox.Text, FileName = RecordBox.Text,
OverwritePrompt = false, OverwritePrompt = false,
Filter = "Movie Files (*." + Global.MovieSession.Movie.PreferredExtension + ")|*." + Global.MovieSession.Movie.PreferredExtension + "|All Files|*.*" Filter = $"Movie Files (*.{Global.MovieSession.Movie.PreferredExtension})|*.{Global.MovieSession.Movie.PreferredExtension}|All Files|*.*"
}; };
var result = sfd.ShowHawkDialog(); var result = sfd.ShowHawkDialog();

View File

@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
if (!string.IsNullOrWhiteSpace(_currentFileName)) if (!string.IsNullOrWhiteSpace(_currentFileName))
{ {
Text = DialogTitle + " - " + Path.GetFileNameWithoutExtension(_currentFileName); Text = $"{DialogTitle} - {Path.GetFileNameWithoutExtension(_currentFileName)}";
} }
else else
{ {
@ -125,7 +125,7 @@ namespace BizHawk.Client.EmuHawk
.ToString() .ToString()
.Last(); .Last();
return "QuickSave" + num; return $"QuickSave{num}";
} }
} }
@ -772,7 +772,7 @@ namespace BizHawk.Client.EmuHawk
CurrentFileName = path; CurrentFileName = path;
Settings.RecentBotFiles.Add(CurrentFileName); Settings.RecentBotFiles.Add(CurrentFileName);
MessageLabel.Text = Path.GetFileNameWithoutExtension(path) + " loaded"; MessageLabel.Text = $"{Path.GetFileNameWithoutExtension(path)} loaded";
AssessRunButtonStatus(); AssessRunButtonStatus();
return true; return true;
@ -814,7 +814,7 @@ namespace BizHawk.Client.EmuHawk
File.WriteAllText(path, json); File.WriteAllText(path, json);
CurrentFileName = path; CurrentFileName = path;
Settings.RecentBotFiles.Add(CurrentFileName); Settings.RecentBotFiles.Add(CurrentFileName);
MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved"; MessageLabel.Text = $"{Path.GetFileName(CurrentFileName)} saved";
} }
#endregion #endregion

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
private void SetCount() private void SetCount()
{ {
label2.Text = string.Format("Number of files: {0}", listBox1.Items.Count); label2.Text = $"Number of files: {listBox1.Items.Count}";
} }
private void listBox1_DragDrop(object sender, DragEventArgs e) private void listBox1_DragDrop(object sender, DragEventArgs e)

View File

@ -81,12 +81,12 @@ namespace BizHawk.Client.EmuHawk
void OnLoadError(object sender, RomLoader.RomErrorArgs e) void OnLoadError(object sender, RomLoader.RomErrorArgs e)
{ {
current.Status = Result.EStatus.ErrorOnLoad; current.Status = Result.EStatus.ErrorOnLoad;
current.Messages.Add(string.Format("OnLoadError: {0}, {1}, {2}", e.AttemptedCoreLoad, e.Message, e.Type.ToString())); current.Messages.Add($"OnLoadError: {e.AttemptedCoreLoad}, {e.Message}, {e.Type.ToString()}");
} }
void CommMessage(string msg) void CommMessage(string msg)
{ {
current.Messages.Add(string.Format("CommMessage: {0}", msg)); current.Messages.Add($"CommMessage: {msg}");
} }
int? ChooseArchive(HawkFile hf) int? ChooseArchive(HawkFile hf)

View File

@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk
_currentFilename = fname; _currentFilename = fname;
if (_currentFilename == null) if (_currentFilename == null)
Text = "Code Data Logger"; Text = "Code Data Logger";
else Text = string.Format("Code Data Logger - {0}", fname); else Text = $"Code Data Logger - {fname}";
} }
[RequiredService] [RequiredService]
@ -147,29 +147,29 @@ namespace BizHawk.Client.EmuHawk
long addr = bm[kvp.Key]; long addr = bm[kvp.Key];
var lvi = listContents[idx++] = new string[13]; var lvi = listContents[idx++] = new string[13];
lvi[0] = string.Format("{0:X8}", addr); lvi[0] = $"{addr:X8}";
lvi[1] = kvp.Key; lvi[1] = kvp.Key;
lvi[2] = string.Format("{0:0.00}%", total / (float)kvp.Value.Length * 100f); lvi[2] = $"{total / (float)kvp.Value.Length * 100f:0.00}%";
if (tsbViewStyle.SelectedIndex == 2) if (tsbViewStyle.SelectedIndex == 2)
lvi[3] = string.Format("{0:0.00}", total / 1024.0f); lvi[3] = $"{total / 1024.0f:0.00}";
else else
lvi[3] = string.Format("{0}", total); lvi[3] = $"{total}";
if (tsbViewStyle.SelectedIndex == 2) if (tsbViewStyle.SelectedIndex == 2)
{ {
int n = (int)(kvp.Value.Length / 1024.0f); int n = (int)(kvp.Value.Length / 1024.0f);
float ncheck = kvp.Value.Length / 1024.0f; float ncheck = kvp.Value.Length / 1024.0f;
lvi[4] = string.Format("of {0}{1} KBytes", n == ncheck ? "" : "~", n); lvi[4] = $"of {(n == ncheck ? "" : "~")}{n} KBytes";
} }
else else
lvi[4] = string.Format("of {0} Bytes", kvp.Value.Length); lvi[4] = $"of {kvp.Value.Length} Bytes";
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
if (tsbViewStyle.SelectedIndex == 0) if (tsbViewStyle.SelectedIndex == 0)
lvi[5 + i] = string.Format("{0:0.00}%", totals[i] / (float)kvp.Value.Length * 100f); lvi[5 + i] = $"{totals[i] / (float)kvp.Value.Length * 100f:0.00}%";
if (tsbViewStyle.SelectedIndex == 1) if (tsbViewStyle.SelectedIndex == 1)
lvi[5 + i] = string.Format("{0}", totals[i]); lvi[5 + i] = $"{totals[i]}";
if (tsbViewStyle.SelectedIndex == 2) if (tsbViewStyle.SelectedIndex == 2)
lvi[5 + i] = string.Format("{0:0.00}", totals[i] / 1024.0f); lvi[5 + i] = $"{totals[i] / 1024.0f:0.00}";
} }
} }
@ -498,7 +498,7 @@ namespace BizHawk.Client.EmuHawk
try try
{ {
autoloading = true; autoloading = true;
var autoresume_file = PathManager.FilesystemSafeName(Global.Game) + ".cdl"; var autoresume_file = $"{PathManager.FilesystemSafeName(Global.Game)}.cdl";
var autoresume_dir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null); var autoresume_dir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null);
var autoresume_path = Path.Combine(autoresume_dir, autoresume_file); var autoresume_path = Path.Combine(autoresume_dir, autoresume_file);
if (File.Exists(autoresume_path)) if (File.Exists(autoresume_path))

View File

@ -349,7 +349,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
MessageBox.Show(address + " is not a valid address for the domain " + domain.Name, "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show($"{address} is not a valid address for the domain {domain.Name}", "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return Cheat.Separator; return Cheat.Separator;
} }
} }

View File

@ -81,9 +81,7 @@ namespace BizHawk.Client.EmuHawk
public void UpdateDialog() public void UpdateDialog()
{ {
CheatListView.ItemCount = Global.CheatList.Count; CheatListView.ItemCount = Global.CheatList.Count;
TotalLabel.Text = Global.CheatList.CheatCount TotalLabel.Text = $"{Global.CheatList.CheatCount} {(Global.CheatList.CheatCount == 1 ? "cheat" : "cheats")} {Global.CheatList.ActiveCount} active";
+ (Global.CheatList.CheatCount == 1 ? " cheat " : " cheats ")
+ Global.CheatList.ActiveCount + " active";
} }
private void LoadFileFromRecent(string path) private void LoadFileFromRecent(string path)
@ -107,9 +105,11 @@ namespace BizHawk.Client.EmuHawk
private void UpdateMessageLabel(bool saved = false) private void UpdateMessageLabel(bool saved = false)
{ {
MessageLabel.Text = saved MessageLabel.Text = saved
? Path.GetFileName(Global.CheatList.CurrentFileName) + " saved." ? $"{Path.GetFileName(Global.CheatList.CurrentFileName)} saved."
: Path.GetFileName(Global.CheatList.CurrentFileName) + (Global.CheatList.Changes ? " *" : ""); : Global.CheatList.Changes
? $"{Path.GetFileName(Global.CheatList.CurrentFileName)} *"
: Path.GetFileName(Global.CheatList.CurrentFileName);
} }
public bool AskSaveChanges() public bool AskSaveChanges()
@ -331,7 +331,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var cheat = SelectedCheats.First(); var cheat = SelectedCheats.First();
CheatEditor.SetCheat(cheat); CheatEditor.SetCheat(cheat);
CheatGroupBox.Text = "Editing Cheat " + cheat.Name + " - " + cheat.AddressStr; CheatGroupBox.Text = $"Editing Cheat {cheat.Name} - {cheat.AddressStr}";
} }
else else
{ {

View File

@ -75,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (column == 0) if (column == 0)
{ {
text = string.Format("{0:X" + _pcRegisterSize + "}", _disassemblyLines[index].Address); text = string.Format($"{{0:X{_pcRegisterSize}}}", _disassemblyLines[index].Address);
} }
else if (column == 1) else if (column == 1)
{ {
@ -206,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
blob.AppendLine(); blob.AppendLine();
} }
blob.Append(string.Format("{0:X" + _pcRegisterSize + "}", _disassemblyLines[index].Address)) blob.Append(string.Format($"{{0:X{_pcRegisterSize}}}", _disassemblyLines[index].Address))
.Append(" ") .Append(" ")
.Append(_disassemblyLines[index].Mnemonic); .Append(_disassemblyLines[index].Mnemonic);
} }

View File

@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_spriteback = Color.FromArgb(255, value); // force fully opaque _spriteback = Color.FromArgb(255, value); // force fully opaque
panelSpriteBackColor.BackColor = _spriteback; panelSpriteBackColor.BackColor = _spriteback;
labelSpriteBackColor.Text = string.Format("({0},{1},{2})", _spriteback.R, _spriteback.G, _spriteback.B); labelSpriteBackColor.Text = $"({_spriteback.R},{_spriteback.G},{_spriteback.B})";
} }
} }
@ -634,9 +634,9 @@ namespace BizHawk.Client.EmuHawk
int* pal = (int*)(sprite ? _sppal : _bgpal) + x * 4; int* pal = (int*)(sprite ? _sppal : _bgpal) + x * 4;
int color = pal[y]; int color = pal[y];
sb.AppendLine(string.Format("Palette {0}", x)); sb.AppendLine($"Palette {x}");
sb.AppendLine(string.Format("Color {0}", y)); sb.AppendLine($"Color {y}");
sb.AppendLine(string.Format("(R,G,B) = ({0},{1},{2})", color >> 16 & 255, color >> 8 & 255, color & 255)); sb.AppendLine($"(R,G,B) = ({color >> 16 & 255},{color >> 8 & 255},{color & 255})");
var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, 10), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, 10), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
int* dest = (int*)lockdata.Scan0; int* dest = (int*)lockdata.Scan0;
@ -679,9 +679,9 @@ namespace BizHawk.Client.EmuHawk
int tileindex = y * 16 + x; int tileindex = y * 16 + x;
int tileoffs = tileindex * 16; int tileoffs = tileindex * 16;
if (_cgb) if (_cgb)
sb.AppendLine(string.Format("Tile #{0} @{2}:{1:x4}", tileindex, tileoffs + 0x8000, secondbank ? 1 : 0)); sb.AppendLine($"Tile #{tileindex} @{(secondbank ? 1 : 0)}:{tileoffs + 0x8000:x4}");
else else
sb.AppendLine(string.Format("Tile #{0} @{1:x4}", tileindex, tileoffs + 0x8000)); sb.AppendLine($"Tile #{tileindex} @{tileoffs + 0x8000:x4}");
var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
DrawTile((byte*)_vram + tileoffs + (secondbank ? 8192 : 0), (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)tilespal); DrawTile((byte*)_vram + tileoffs + (secondbank ? 8192 : 0), (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)tilespal);
@ -718,18 +718,18 @@ namespace BizHawk.Client.EmuHawk
var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
if (!_cgb) if (!_cgb)
{ {
sb.AppendLine(string.Format("{0} Map ({1},{2}) @{3:x4}", win ? "Win" : "BG", x, y, mapoffs + 0x8000)); sb.AppendLine($"{(win ? "Win" : "BG")} Map ({x},{y}) @{mapoffs + 0x8000:x4}");
sb.AppendLine(string.Format(" Tile #{0} @{1:x4}", tileindex, tileoffs + 0x8000)); sb.AppendLine($" Tile #{tileindex} @{tileoffs + 0x8000:x4}");
DrawTile((byte*)_vram + tileoffs, (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_bgpal); DrawTile((byte*)_vram + tileoffs, (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_bgpal);
} }
else else
{ {
int tileext = mapbase[8192]; int tileext = mapbase[8192];
sb.AppendLine(string.Format("{0} Map ({1},{2}) @{3:x4}", win ? "Win" : "BG", x, y, mapoffs + 0x8000)); sb.AppendLine($"{(win ? "Win" : "BG")} Map ({x},{y}) @{mapoffs + 0x8000:x4}");
sb.AppendLine(string.Format(" Tile #{0} @{2}:{1:x4}", tileindex, tileoffs + 0x8000, tileext.Bit(3) ? 1 : 0)); sb.AppendLine($" Tile #{tileindex} @{(tileext.Bit(3) ? 1 : 0)}:{tileoffs + 0x8000:x4}");
sb.AppendLine(string.Format(" Palette {0}", tileext & 7)); sb.AppendLine($" Palette {tileext & 7}");
sb.AppendLine(string.Format(" Flags {0}{1}{2}", tileext.Bit(5) ? 'H' : ' ', tileext.Bit(6) ? 'V' : ' ', tileext.Bit(7) ? 'P' : ' ')); sb.AppendLine($" Flags {(tileext.Bit(5) ? 'H' : ' ')}{(tileext.Bit(6) ? 'V' : ' ')}{(tileext.Bit(7) ? 'P' : ' ')}");
DrawTileHv((byte*)_vram + tileoffs + (tileext.Bit(3) ? 8192 : 0), (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_bgpal + 4 * (tileext & 7), tileext.Bit(5), tileext.Bit(6)); DrawTileHv((byte*)_vram + tileoffs + (tileext.Bit(3) ? 8192 : 0), (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_bgpal + 4 * (tileext & 7), tileext.Bit(5), tileext.Bit(6));
} }
bmpViewDetails.BMP.UnlockBits(lockdata); bmpViewDetails.BMP.UnlockBits(lockdata);
@ -765,26 +765,26 @@ namespace BizHawk.Client.EmuHawk
if (tall) if (tall)
tilenum = vflip ? tilenum | 1 : tilenum & ~1; tilenum = vflip ? tilenum | 1 : tilenum & ~1;
int tileoffs = tilenum * 16; int tileoffs = tilenum * 16;
sb.AppendLine(string.Format("Sprite #{0} @{1:x4}", x, 4 * x + 0xfe00)); sb.AppendLine($"Sprite #{x} @{4 * x + 0xfe00:x4}");
sb.AppendLine(string.Format(" (x,y) = ({0},{1})", sx, sy)); sb.AppendLine($" (x,y) = ({sx},{sy})");
var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, tall ? 16 : 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); var lockdata = bmpViewDetails.BMP.LockBits(new Rectangle(0, 0, 8, tall ? 16 : 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
if (_cgb) if (_cgb)
{ {
sb.AppendLine(string.Format(" Tile #{0} @{2}:{1:x4}", y == 1 ? tilenum ^ 1 : tilenum, tileoffs + 0x8000, flags.Bit(3) ? 1 : 0)); sb.AppendLine($" Tile #{(y == 1 ? tilenum ^ 1 : tilenum)} @{(flags.Bit(3) ? 1 : 0)}:{tileoffs + 0x8000:x4}");
sb.AppendLine(string.Format(" Palette {0}", flags & 7)); sb.AppendLine($" Palette {flags & 7}");
DrawTileHv((byte*)_vram + tileoffs + (flags.Bit(3) ? 8192 : 0), (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_sppal + 4 * (flags & 7), hflip, vflip); DrawTileHv((byte*)_vram + tileoffs + (flags.Bit(3) ? 8192 : 0), (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_sppal + 4 * (flags & 7), hflip, vflip);
if (tall) if (tall)
DrawTileHv((byte*)_vram + (tileoffs ^ 16) + (flags.Bit(3) ? 8192 : 0), (int*)(lockdata.Scan0 + lockdata.Stride * 8), lockdata.Stride / sizeof(int), (int*)_sppal + 4 * (flags & 7), hflip, vflip); DrawTileHv((byte*)_vram + (tileoffs ^ 16) + (flags.Bit(3) ? 8192 : 0), (int*)(lockdata.Scan0 + lockdata.Stride * 8), lockdata.Stride / sizeof(int), (int*)_sppal + 4 * (flags & 7), hflip, vflip);
} }
else else
{ {
sb.AppendLine(string.Format(" Tile #{0} @{1:x4}", y == 1 ? tilenum ^ 1 : tilenum, tileoffs + 0x8000)); sb.AppendLine($" Tile #{(y == 1 ? tilenum ^ 1 : tilenum)} @{tileoffs + 0x8000:x4}");
sb.AppendLine(string.Format(" Palette {0}", flags.Bit(4) ? 1 : 0)); sb.AppendLine($" Palette {(flags.Bit(4) ? 1 : 0)}");
DrawTileHv((byte*)_vram + tileoffs, (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_sppal + (flags.Bit(4) ? 4 : 0), hflip, vflip); DrawTileHv((byte*)_vram + tileoffs, (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)_sppal + (flags.Bit(4) ? 4 : 0), hflip, vflip);
if (tall) if (tall)
DrawTileHv((byte*)_vram + (tileoffs ^ 16), (int*)(lockdata.Scan0 + lockdata.Stride * 8), lockdata.Stride / sizeof(int), (int*)_sppal + 4 * (flags.Bit(4) ? 4 : 0), hflip, vflip); DrawTileHv((byte*)_vram + (tileoffs ^ 16), (int*)(lockdata.Scan0 + lockdata.Stride * 8), lockdata.Stride / sizeof(int), (int*)_sppal + 4 * (flags.Bit(4) ? 4 : 0), hflip, vflip);
} }
sb.AppendLine(string.Format(" Flags {0}{1}{2}", hflip ? 'H' : ' ', vflip ? 'V' : ' ', flags.Bit(7) ? 'P' : ' ')); sb.AppendLine($" Flags {(hflip ? 'H' : ' ')}{(vflip ? 'V' : ' ')}{(flags.Bit(7) ? 'P' : ' ')}");
bmpViewDetails.BMP.UnlockBits(lockdata); bmpViewDetails.BMP.UnlockBits(lockdata);
labelDetails.Text = sb.ToString(); labelDetails.Text = sb.ToString();
bmpViewDetails.Refresh(); bmpViewDetails.Refresh();
@ -946,7 +946,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var bv = found as BmpView; var bv = found as BmpView;
Clipboard.SetImage(bv.BMP); Clipboard.SetImage(bv.BMP);
labelClipboard.Text = found.Text + " copied to clipboard."; labelClipboard.Text = $"{found.Text} copied to clipboard.";
_messagetimer.Stop(); _messagetimer.Stop();
_messagetimer.Start(); _messagetimer.Start();
} }

View File

@ -458,17 +458,17 @@ namespace BizHawk.Client.EmuHawk
GBGGDecode(GGCodeMaskBox.Text, ref val, ref add, ref cmp); GBGGDecode(GGCodeMaskBox.Text, ref val, ref add, ref cmp);
if (add > -1) if (add > -1)
{ {
AddressBox.Text = string.Format("{0:X4}", add); AddressBox.Text = $"{add:X4}";
} }
if (val > -1) if (val > -1)
{ {
ValueBox.Text = string.Format("{0:X2}", val); ValueBox.Text = $"{val:X2}";
} }
if (cmp > -1) if (cmp > -1)
{ {
CompareBox.Text = string.Format("{0:X2}", cmp); CompareBox.Text = $"{cmp:X2}";
} }
else else
{ {

View File

@ -790,7 +790,7 @@ namespace BizHawk.Client.EmuHawk
private void hScrollBar1_ValueChanged(object sender, EventArgs e) private void hScrollBar1_ValueChanged(object sender, EventArgs e)
{ {
_cbscanline = (hScrollBar1.Value + 160) % 228; _cbscanline = (hScrollBar1.Value + 160) % 228;
radioButtonScanline.Text = "Scanline " + _cbscanline; radioButtonScanline.Text = $"Scanline {_cbscanline}";
} }
private void radioButtonManual_CheckedChanged(object sender, EventArgs e) private void radioButtonManual_CheckedChanged(object sender, EventArgs e)
@ -838,7 +838,7 @@ namespace BizHawk.Client.EmuHawk
if (found is BmpView) if (found is BmpView)
{ {
Clipboard.SetImage((found as BmpView).BMP); Clipboard.SetImage((found as BmpView).BMP);
labelClipboard.Text = found.Text + " copied to clipboard."; labelClipboard.Text = $"{found.Text} copied to clipboard.";
timerMessage.Stop(); timerMessage.Stop();
timerMessage.Start(); timerMessage.Start();
} }

View File

@ -311,9 +311,9 @@ namespace BizHawk.Client.EmuHawk
int cmp = 0; int cmp = 0;
parseString = SingleCheat.Replace("-", ""); parseString = SingleCheat.Replace("-", "");
GBGGDecode(parseString, ref val, ref add, ref cmp); GBGGDecode(parseString, ref val, ref add, ref cmp);
RAMAddress = string.Format("{0:X4}", add); RAMAddress = $"{add:X4}";
RAMValue = string.Format("{0:X2}", val); RAMValue = $"{val:X2}";
RAMCompare = string.Format("{0:X2}", cmp); RAMCompare = $"{cmp:X2}";
} }
//Game Genie //Game Genie
else if (SingleCheat.Contains("-") == true && SingleCheat.LastIndexOf("-") != 7 && SingleCheat.IndexOf("-") != 3) else if (SingleCheat.Contains("-") == true && SingleCheat.LastIndexOf("-") != 7 && SingleCheat.IndexOf("-") != 3)
@ -382,7 +382,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
//Provided by mGBA and endrift //Provided by mGBA and endrift
@ -457,8 +457,8 @@ namespace BizHawk.Client.EmuHawk
//op1 has the Address //op1 has the Address
//op2 has the Value //op2 has the Value
//Sum, is pointless? //Sum, is pointless?
RAMAddress = string.Format("{0:X8}", op1); RAMAddress = $"{op1:X8}";
RAMValue = string.Format("{0:X8}", op2); RAMValue = $"{op2:X8}";
GBAGameShark(); GBAGameShark();
} }
//We don't do Else If after the if here because it won't allow us to verify the second code check. //We don't do Else If after the if here because it won't allow us to verify the second code check.
@ -492,8 +492,8 @@ namespace BizHawk.Client.EmuHawk
//op1 has the Address //op1 has the Address
//op2 has the Value //op2 has the Value
//Sum, is pointless? //Sum, is pointless?
RAMAddress = string.Format("{0:X8}", op1); RAMAddress = $"{op1:X8}";
RAMValue = string.Format("{0:X8}", op2); RAMValue = $"{op2:X8}";
blnEncrypted = true; blnEncrypted = true;
GBAActionReplay(); GBAActionReplay();
} }
@ -560,9 +560,9 @@ namespace BizHawk.Client.EmuHawk
// //op1 has the Address // //op1 has the Address
// //op2 has the Value // //op2 has the Value
// //Sum, is pointless? // //Sum, is pointless?
// RAMAddress = string.Format("{0:X8}", op1); // RAMAddress = $"{op1:X8}";
// //RAMAddress = RAMAddress.Remove(0, 1); // //RAMAddress = RAMAddress.Remove(0, 1);
// RAMValue = string.Format("{0:X8}", op2); // RAMValue = $"{op2:X8}";
// // && RAMAddress[6] == '0' // // && RAMAddress[6] == '0'
//} //}
@ -2052,12 +2052,12 @@ namespace BizHawk.Client.EmuHawk
string RealAddress = null; string RealAddress = null;
string realValue = null; string realValue = null;
RealAddress = RAMValue.Remove(0, 1); RealAddress = RAMValue.Remove(0, 1);
//MessageBox.Show("Real Address: " + RealAddress); //MessageBox.Show($"Real Address: {RealAddress}");
//We need the next line //We need the next line
try try
{ {
loopValue += 1; loopValue += 1;
//MessageBox.Show("Loop Value: " + loopValue.ToString()); //MessageBox.Show($"Loop Value: {loopValue}");
SingleCheat = txtCheat.Lines[loopValue].ToUpper(); SingleCheat = txtCheat.Lines[loopValue].ToUpper();
//We need to parse now. //We need to parse now.
if (SingleCheat.Length == 17 && SingleCheat.IndexOf(" ") == 8) if (SingleCheat.Length == 17 && SingleCheat.IndexOf(" ") == 8)
@ -2087,8 +2087,8 @@ namespace BizHawk.Client.EmuHawk
//op1 has the Address //op1 has the Address
//op2 has the Value //op2 has the Value
//Sum, is pointless? //Sum, is pointless?
RAMAddress = string.Format("{0:X8}", op1); RAMAddress = $"{op1:X8}";
RAMValue = string.Format("{0:X8}", op2); RAMValue = $"{op2:X8}";
} }
else if (blnEncrypted == false) else if (blnEncrypted == false)
{ {
@ -2134,7 +2134,7 @@ namespace BizHawk.Client.EmuHawk
catch (Exception ex) catch (Exception ex)
{ {
//We should warn the user. //We should warn the user.
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
else if (RAMAddress.StartsWith("080") == true) else if (RAMAddress.StartsWith("080") == true)
@ -2563,7 +2563,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
} }
@ -2691,7 +2691,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void NES() private void NES()
@ -2734,9 +2734,9 @@ namespace BizHawk.Client.EmuHawk
_NESgameGenieTable.TryGetValue(code[5], out x); _NESgameGenieTable.TryGetValue(code[5], out x);
Address |= (x & 0x07) << 8; Address |= (x & 0x07) << 8;
Value |= x & 0x08; Value |= x & 0x08;
RAMAddress = string.Format("{0:X4}", Address); RAMAddress = $"{Address:X4}";
RAMValue = string.Format("{0:X2}", Value); RAMValue = $"{Value:X2}";
strCompare = string.Format("{0:X2}", Compare); strCompare = $"{Compare:X2}";
} }
else if (SingleCheat.Length == 8) else if (SingleCheat.Length == 8)
{ {
@ -2778,9 +2778,9 @@ namespace BizHawk.Client.EmuHawk
_NESgameGenieTable.TryGetValue(code[7], out x); _NESgameGenieTable.TryGetValue(code[7], out x);
Compare |= (x & 0x07) << 4; Compare |= (x & 0x07) << 4;
Value |= x & 0x08; Value |= x & 0x08;
RAMAddress = string.Format("{0:X4}", Address); RAMAddress = $"{Address:X4}";
RAMValue = string.Format("{0:X2}", Value); RAMValue = $"{Value:X2}";
strCompare = string.Format("{0:X2}", Compare); strCompare = $"{Compare:X2}";
} }
} }
if (SingleCheat.Length != 6 && SingleCheat.Length != 8) if (SingleCheat.Length != 6 && SingleCheat.Length != 8)
@ -2816,7 +2816,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void PSX() private void PSX()
@ -2927,7 +2927,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
@ -3003,7 +3003,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
//This also handles Game Gear due to shared hardware. Go figure. //This also handles Game Gear due to shared hardware. Go figure.
@ -3018,9 +3018,9 @@ namespace BizHawk.Client.EmuHawk
int cmp = 0; int cmp = 0;
parseString = SingleCheat.Replace("-", ""); parseString = SingleCheat.Replace("-", "");
GBGGDecode(parseString, ref val, ref add, ref cmp); GBGGDecode(parseString, ref val, ref add, ref cmp);
RAMAddress = string.Format("{0:X4}", add); RAMAddress = $"{add:X4}";
RAMValue = string.Format("{0:X2}", val); RAMValue = $"{val:X2}";
RAMCompare = string.Format("{0:X2}", cmp); RAMCompare = $"{cmp:X2}";
} }
//Action Replay //Action Replay
else if (SingleCheat.IndexOf("-") == 3 && SingleCheat.Length == 9) else if (SingleCheat.IndexOf("-") == 3 && SingleCheat.Length == 9)
@ -3063,7 +3063,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
//Original code from adelikat //Original code from adelikat
@ -3142,8 +3142,8 @@ namespace BizHawk.Client.EmuHawk
//We have to remove the - since it will cause issues later on. //We have to remove the - since it will cause issues later on.
input = SingleCheat.Replace("-", ""); input = SingleCheat.Replace("-", "");
SnesGGDecode(input, ref val, ref add); SnesGGDecode(input, ref val, ref add);
RAMAddress = string.Format("{0:X6}", add); RAMAddress = $"{add:X6}";
RAMValue = string.Format("{0:X2}", val); RAMValue = $"{val:X2}";
//We trim the first value here to make it work. //We trim the first value here to make it work.
RAMAddress = RAMAddress.Remove(0, 1); RAMAddress = RAMAddress.Remove(0, 1);
//Note, it's not actually a byte, but a Word. However, we are using this to keep from repeating code. //Note, it's not actually a byte, but a Word. However, we are using this to keep from repeating code.
@ -3203,7 +3203,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world? //Someone broke the world?
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show($"An Error occured: {ex.GetType()}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void btnClear_Click(object sender, EventArgs e) private void btnClear_Click(object sender, EventArgs e)

View File

@ -187,8 +187,8 @@ namespace BizHawk.Client.EmuHawk
int val = 0; int val = 0;
int add = 0; int add = 0;
GenGGDecode(GGCodeMaskBox.Text, ref val, ref add); GenGGDecode(GGCodeMaskBox.Text, ref val, ref add);
AddressBox.Text = string.Format("{0:X6}", add); AddressBox.Text = $"{add:X6}";
ValueBox.Text = string.Format("{0:X4}", val); ValueBox.Text = $"{val:X4}";
AddCheatButton.Enabled = true; AddCheatButton.Enabled = true;
} }
else else

View File

@ -545,7 +545,7 @@ namespace BizHawk.Client.EmuHawk
addrStr.Append(" "); addrStr.Append(" ");
} }
addrStr.AppendLine(_addr.ToHexString(_numDigits) + " |"); addrStr.AppendLine($"{_addr.ToHexString(_numDigits)} |");
} }
return addrStr.ToString(); return addrStr.ToString();
@ -700,9 +700,8 @@ namespace BizHawk.Client.EmuHawk
private void UpdateGroupBoxTitle() private void UpdateGroupBoxTitle()
{ {
var addressesString = "0x" + string.Format("{0:X8}", _domain.Size / DataSize).TrimStart('0'); var addressesString = "0x" + $"{_domain.Size / DataSize:X8}".TrimStart('0');
MemoryViewerBox.Text = Emulator.SystemId + " " + _domain + (_domain.CanPoke() ? "" : " (READ-ONLY)") + MemoryViewerBox.Text = $"{Emulator.SystemId} {_domain}{(_domain.CanPoke() ? string.Empty : " (READ-ONLY)")} - {addressesString} addresses";
" - " + addressesString + " addresses";
} }
private void ClearNibbles() private void ClearNibbles()
@ -769,8 +768,7 @@ namespace BizHawk.Client.EmuHawk
Text += " - Editing Address 0x" + string.Format(_numDigitsStr, _addressHighlighted); Text += " - Editing Address 0x" + string.Format(_numDigitsStr, _addressHighlighted);
if (_secondaryHighlightedAddresses.Any()) if (_secondaryHighlightedAddresses.Any())
{ {
Text += string.Format(" (Selected 0x{0:X})", _secondaryHighlightedAddresses.Count() + Text += $" (Selected 0x{_secondaryHighlightedAddresses.Count() + (_secondaryHighlightedAddresses.Contains(_addressHighlighted) ? 0 : 1):X})";
(_secondaryHighlightedAddresses.Contains(_addressHighlighted) ? 0 : 1));
} }
} }
} }
@ -797,7 +795,7 @@ namespace BizHawk.Client.EmuHawk
} }
_numDigits = GetNumDigits(_domain.Size); _numDigits = GetNumDigits(_domain.Size);
_numDigitsStr = "{0:X" + _numDigits + "} "; _numDigitsStr = $"{{0:X{_numDigits}}} ";
} }
private void SetDataSize(int size) private void SetDataSize(int size)
@ -805,7 +803,7 @@ namespace BizHawk.Client.EmuHawk
if (size == 1 || size == 2 || size == 4) if (size == 1 || size == 2 || size == 4)
{ {
DataSize = size; DataSize = size;
_digitFormatString = "{0:X" + (DataSize * 2) + "} "; _digitFormatString = $"{{0:X{DataSize * 2}}} ";
SetHeader(); SetHeader();
UpdateGroupBoxTitle(); UpdateGroupBoxTitle();
UpdateValues(); UpdateValues();
@ -907,7 +905,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var extension = Path.GetExtension(RomName); var extension = Path.GetExtension(RomName);
return "Binary (*" + extension + ")|*" + extension + "|All Files|*.*"; return $"Binary (*{extension})|*{extension}|All Files|*.*";
} }
return "Binary (*.bin)|*.bin|All Files|*.*"; return "Binary (*.bin)|*.bin|All Files|*.*";
@ -988,7 +986,7 @@ namespace BizHawk.Client.EmuHawk
if (_domain.Name == "File on Disk") if (_domain.Name == "File on Disk")
{ {
sfd.FileName = Path.GetFileNameWithoutExtension(RomName) + ".txt"; sfd.FileName = $"{Path.GetFileNameWithoutExtension(RomName)}.txt";
} }
else else
{ {
@ -1386,7 +1384,7 @@ namespace BizHawk.Client.EmuHawk
{ {
for (var j = 0; j < 16; j++) for (var j = 0; j < 16; j++)
{ {
sb.Append(string.Format("{0:X2} ", _domain.PeekByte((i * 16) + j))); sb.Append($"{_domain.PeekByte((i * 16) + j):X2} ");
} }
sb.AppendLine(); sb.AppendLine();
@ -1412,7 +1410,7 @@ namespace BizHawk.Client.EmuHawk
var ofd = new OpenFileDialog var ofd = new OpenFileDialog
{ {
FileName = Path.GetFileNameWithoutExtension(romName) + ".tbl", FileName = $"{Path.GetFileNameWithoutExtension(romName)}.tbl",
InitialDirectory = intialDirectory, InitialDirectory = intialDirectory,
Filter = "Text Table files (*.tbl)|*.tbl|All Files|*.*", Filter = "Text Table files (*.tbl)|*.tbl|All Files|*.*",
RestoreDirectory = false RestoreDirectory = false

View File

@ -320,7 +320,7 @@ namespace BizHawk.Client.EmuHawk
{ {
Global.Config.TargetZoomFactors[Emulator.SystemId] = size; Global.Config.TargetZoomFactors[Emulator.SystemId] = size;
GlobalWin.MainForm.FrameBufferResized(); GlobalWin.MainForm.FrameBufferResized();
GlobalWin.OSD.AddMessage("Window size set to " + size + "x"); GlobalWin.OSD.AddMessage($"Window size set to {size}x");
} }
else else
{ {

View File

@ -55,7 +55,7 @@ namespace BizHawk.Client.EmuHawk
[LuaMethod("socketServerSend", "sends a string to the Socket server")] [LuaMethod("socketServerSend", "sends a string to the Socket server")]
public string SocketServerSend(string SendString) public string SocketServerSend(string SendString)
{ {
return "Sent : " + GlobalWin.socketServer.SendString(SendString).ToString() + " bytes"; return $"Sent : {GlobalWin.socketServer.SendString(SendString)} bytes";
} }
[LuaMethod("socketServerResponse", "receives a message from the Socket server")] [LuaMethod("socketServerResponse", "receives a message from the Socket server")]
public string SocketServerResponse() public string SocketServerResponse()

View File

@ -87,7 +87,7 @@ namespace BizHawk.Client.EmuHawk
if (outputs == null) if (outputs == null)
{ {
GlobalWin.Tools.LuaConsole.WriteToOutputWindow("(no return)" + terminator); GlobalWin.Tools.LuaConsole.WriteToOutputWindow($"(no return){terminator}");
return; return;
} }

View File

@ -754,7 +754,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
ConsoleLuaLibrary.Log("File not found: " + path + "\nScript Terminated"); ConsoleLuaLibrary.Log($"File not found: {path}\nScript Terminated");
return; return;
} }
try try
@ -823,7 +823,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
ConsoleLuaLibrary.Log("File not found: " + path + "\nScript Terminated"); ConsoleLuaLibrary.Log($"File not found: {path}\nScript Terminated");
return; return;
} }
try try

View File

@ -323,7 +323,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
Log("File not found: " + path); Log($"File not found: {path}");
return; return;
} }
@ -365,7 +365,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
Log("File not found: " + path); Log($"File not found: {path}");
return; return;
} }

View File

@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (slotNum >= 0 && slotNum <= 9) if (slotNum >= 0 && slotNum <= 9)
{ {
GlobalWin.MainForm.LoadQuickSave("QuickSave" + slotNum, true); GlobalWin.MainForm.LoadQuickSave($"QuickSave{slotNum}", true);
} }
} }
@ -54,7 +54,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (slotNum >= 0 && slotNum <= 9) if (slotNum >= 0 && slotNum <= 9)
{ {
GlobalWin.MainForm.SaveQuickSave("QuickSave" + slotNum); GlobalWin.MainForm.SaveQuickSave($"QuickSave{slotNum}");
} }
} }
} }

View File

@ -186,7 +186,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
ConsoleLuaLibrary.Log("File not found: " + path + "\nScript Terminated"); ConsoleLuaLibrary.Log($"File not found: {path}\nScript Terminated");
return; return;
} }
@ -212,7 +212,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{ {
ConsoleLuaLibrary.Log("File not found: " + path + "\nScript Terminated"); ConsoleLuaLibrary.Log($"File not found: {path}\nScript Terminated");
return; return;
} }

View File

@ -194,7 +194,7 @@ namespace BizHawk.Client.EmuHawk
LuaImp.ScriptList.AddRange(currentScripts); LuaImp.ScriptList.AddRange(currentScripts);
} }
InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => a.Library + "." + a.Name).ToArray()); InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => $"{a.Library}.{a.Name}").ToArray());
foreach (var file in runningScripts) foreach (var file in runningScripts)
{ {
@ -254,7 +254,7 @@ namespace BizHawk.Client.EmuHawk
private void OnChanged(object source, FileSystemEventArgs e) private void OnChanged(object source, FileSystemEventArgs e)
{ {
string message = "File: " + e.FullPath + " " + e.ChangeType; string message = $"File: {e.FullPath} {e.ChangeType}";
Invoke(new MethodInvoker(delegate Invoke(new MethodInvoker(delegate
{ {
RefreshScriptMenuItem_Click(null, null); RefreshScriptMenuItem_Click(null, null);
@ -451,15 +451,15 @@ namespace BizHawk.Client.EmuHawk
if (total == 1) if (total == 1)
{ {
message += total + " script (" + active + " active, " + paused + " paused)"; message += $"{total} script ({active} active, {paused} paused)";
} }
else if (total == 0) else if (total == 0)
{ {
message += total + " scripts"; message += $"{total} scripts";
} }
else else
{ {
message += total + " scripts (" + active + " active, " + paused + " paused)"; message += $"{total} scripts ({active} active, {paused} paused)";
} }
NumberOfScripts.Text = message; NumberOfScripts.Text = message;
@ -636,7 +636,7 @@ namespace BizHawk.Client.EmuHawk
if (file != null) if (file != null)
{ {
LuaImp.ScriptList.SaveSession(file.FullName); LuaImp.ScriptList.SaveSession(file.FullName);
OutputMessages.Text = Path.GetFileName(LuaImp.ScriptList.Filename) + " saved."; OutputMessages.Text = $"{Path.GetFileName(LuaImp.ScriptList.Filename)} saved.";
} }
} }
@ -769,7 +769,7 @@ namespace BizHawk.Client.EmuHawk
SaveSessionAs(); SaveSessionAs();
} }
OutputMessages.Text = Path.GetFileName(LuaImp.ScriptList.Filename) + " saved."; OutputMessages.Text = $"{Path.GetFileName(LuaImp.ScriptList.Filename)} saved.";
} }
} }
@ -911,7 +911,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (IOException) catch (IOException)
{ {
ConsoleLog("Unable to access file " + item.Path); ConsoleLog($"Unable to access file {item.Path}");
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -973,7 +973,7 @@ namespace BizHawk.Client.EmuHawk
{ {
InitialDirectory = Path.GetDirectoryName(script.Path), InitialDirectory = Path.GetDirectoryName(script.Path),
DefaultExt = ".lua", DefaultExt = ".lua",
FileName = Path.GetFileNameWithoutExtension(script.Path) + " (1)", FileName = $"{Path.GetFileNameWithoutExtension(script.Path)} (1)",
OverwritePrompt = true, OverwritePrompt = true,
Filter = "Lua Scripts (*.lua)|*.lua|All Files (*.*)|*.*" Filter = "Lua Scripts (*.lua)|*.lua|All Files (*.*)|*.*"
}; };

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
if (!string.IsNullOrWhiteSpace(FilterBox.Text)) if (!string.IsNullOrWhiteSpace(FilterBox.Text))
{ {
_filteredList = FunctionList _filteredList = FunctionList
.Where(f => (f.Library + "." + f.Name).ToLowerInvariant().Contains(FilterBox.Text.ToLowerInvariant())) .Where(f => $"{f.Library}.{f.Name}".ToLowerInvariant().Contains(FilterBox.Text.ToLowerInvariant()))
.ToList(); .ToList();
} }
else else

View File

@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
for (int i = 0; i < _buttonBoxes.Length; i++) for (int i = 0; i < _buttonBoxes.Length; i++)
{ {
if (!_buttonBoxes[i].Checked) if (!_buttonBoxes[i].Checked)
key = key.Replace(_buttonBoxes[i].Text + "|", ""); key = key.Replace($"{_buttonBoxes[i].Text}|", "");
} }
key = key.Substring(0, key.Length - 1); key = key.Substring(0, key.Length - 1);

View File

@ -57,7 +57,7 @@ namespace BizHawk.Client.EmuHawk
}; };
_zones.Add(main); _zones.Add(main);
ZonesList.Items.Add(main.Name + " - length: " + main.Length); ZonesList.Items.Add($"{main.Name} - length: {main.Length}");
ZonesList.Items[0] += " [Zones don't change!]"; ZonesList.Items[0] += " [Zones don't change!]";
SetUpButtonBoxes(); SetUpButtonBoxes();
@ -150,9 +150,9 @@ namespace BizHawk.Client.EmuHawk
} }
var newZone = new MovieZone(CurrentMovie, (int)StartNum.Value, (int)(EndNum.Value - StartNum.Value + 1)); var newZone = new MovieZone(CurrentMovie, (int)StartNum.Value, (int)(EndNum.Value - StartNum.Value + 1));
newZone.Name = "Zone " + _zones.Count; newZone.Name = $"Zone {_zones.Count}";
_zones.Add(newZone); _zones.Add(newZone);
ZonesList.Items.Add(newZone.Name + " - length: " + newZone.Length); ZonesList.Items.Add($"{newZone.Name} - length: {newZone.Length}");
_unsavedZones.Add(ZonesList.Items.Count - 1); _unsavedZones.Add(ZonesList.Items.Count - 1);
} }
@ -193,7 +193,7 @@ namespace BizHawk.Client.EmuHawk
} }
selectedZone.Name = NameTextbox.Text; selectedZone.Name = NameTextbox.Text;
ZonesList.Items[ZonesList.SelectedIndex] = selectedZone.Name + " - length: " + selectedZone.Length; ZonesList.Items[ZonesList.SelectedIndex] = $"{selectedZone.Name} - length: {selectedZone.Length}";
} }
private void PlaceNum_ValueChanged(object sender, EventArgs e) private void PlaceNum_ValueChanged(object sender, EventArgs e)
@ -266,7 +266,7 @@ namespace BizHawk.Client.EmuHawk
if (loadZone != null) if (loadZone != null)
{ {
_zones.Add(loadZone); _zones.Add(loadZone);
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length); ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");
// Options only for TasMovie // Options only for TasMovie
if (!(CurrentMovie is TasMovie)) if (!(CurrentMovie is TasMovie))
@ -288,7 +288,7 @@ namespace BizHawk.Client.EmuHawk
{ {
MovieZone loadZone = new MovieZone(path); MovieZone loadZone = new MovieZone(path);
_zones.Add(loadZone); _zones.Add(loadZone);
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length); ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");
} }
private static string SuggestedFolder() private static string SuggestedFolder()

View File

@ -129,7 +129,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (movie is TasMovie) if (movie is TasMovie)
{ {
(movie as TasMovie).ChangeLog.BeginNewBatch("Place Macro at " + Start); (movie as TasMovie).ChangeLog.BeginNewBatch($"Place Macro at {Start}");
} }
if (Start > movie.InputLogLength) if (Start > movie.InputLogLength)
@ -203,7 +203,7 @@ namespace BizHawk.Client.EmuHawk
header[0] = InputKey; header[0] = InputKey;
header[1] = Global.Emulator.ControllerDefinition.Name; header[1] = Global.Emulator.ControllerDefinition.Name;
header[2] = Global.Emulator.ControllerDefinition.PlayerCount.ToString(); header[2] = Global.Emulator.ControllerDefinition.PlayerCount.ToString();
header[3] = Overlay.ToString() + "," + Replace.ToString(); header[3] = $"{Overlay},{Replace}";
File.WriteAllLines(fileName, header); File.WriteAllLines(fileName, header);
File.AppendAllLines(fileName, _log); File.AppendAllLines(fileName, _log);
@ -232,8 +232,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (!emuKeys.Contains(macroKeys[i])) if (!emuKeys.Contains(macroKeys[i]))
{ {
System.Windows.Forms.MessageBox.Show("The selected macro is not compatible with the current emulator core." + System.Windows.Forms.MessageBox.Show($"The selected macro is not compatible with the current emulator core.\nMacro controller: {readText[1]}\nMacro player count: {readText[2]}", "Error");
"\nMacro controller: " + readText[1] + "\nMacro player count: " + readText[2], "Error");
return; return;
} }
} }

View File

@ -114,7 +114,7 @@ namespace BizHawk.Client.EmuHawk
} }
var intName = hf.ArchiveItems[memIdx]; var intName = hf.ArchiveItems[memIdx];
PathBox.Text = _path + "|" + intName.Name; PathBox.Text = $"{_path}|{intName.Name}";
} }
else else
{ {

View File

@ -57,7 +57,7 @@ namespace BizHawk.Client.EmuHawk
string why; string why;
if (!DatachBarcode.ValidString(textBox1.Text, out why)) if (!DatachBarcode.ValidString(textBox1.Text, out why))
{ {
label3.Text = "Invalid: " + why; label3.Text = $"Invalid: {why}";
label3.Visible = true; label3.Visible = true;
button1.Enabled = false; button1.Enabled = false;
} }

View File

@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
{ {
int tone = note % 12; int tone = note % 12;
int octave = note / 12; int octave = note / 12;
return string.Format("{0}{1}", noteNames[tone], octave); return $"{noteNames[tone]}{octave}";
} }
//this isnt thoroughly debugged but it seems to work OK //this isnt thoroughly debugged but it seems to work OK
@ -471,7 +471,7 @@ namespace BizHawk.Client.EmuHawk
void SyncContents() void SyncContents()
{ {
lblContents.Text = string.Format("{0} Rows", Log.Count); lblContents.Text = $"{Log.Count} Rows";
} }
private void btnControl_Click(object sender, EventArgs e) private void btnControl_Click(object sender, EventArgs e)

View File

@ -312,11 +312,11 @@ namespace BizHawk.Client.EmuHawk
TileY = e.Y / 16; TileY = e.Y / 16;
} }
XYLabel.Text = TileX + " : " + TileY; XYLabel.Text = $"{TileX} : {TileY}";
int PPUAddress = 0x2000 + (NameTable * 0x400) + ((TileY % 30) * 32) + (TileX % 32); int PPUAddress = 0x2000 + (NameTable * 0x400) + ((TileY % 30) * 32) + (TileX % 32);
PPUAddressLabel.Text = string.Format("{0:X4}", PPUAddress); PPUAddressLabel.Text = $"{PPUAddress:X4}";
int TileID = _ppu.PeekPPU(PPUAddress); int TileID = _ppu.PeekPPU(PPUAddress);
TileIDLabel.Text = string.Format("{0:X2}", TileID); TileIDLabel.Text = $"{TileID:X2}";
TableLabel.Text = NameTable.ToString(); TableLabel.Text = NameTable.ToString();
int ytable = 0, yline = 0; int ytable = 0, yline = 0;

View File

@ -294,8 +294,8 @@ namespace BizHawk.Client.EmuHawk
private void UpdatePaletteSelection() private void UpdatePaletteSelection()
{ {
_forceChange = true; _forceChange = true;
Table0PaletteLabel.Text = "Palette: " + PatternView.Pal0; Table0PaletteLabel.Text = $"Palette: {PatternView.Pal0}";
Table1PaletteLabel.Text = "Palette: " + PatternView.Pal1; Table1PaletteLabel.Text = $"Palette: {PatternView.Pal1}";
} }
private static Bitmap Section(Image srcBitmap, Rectangle section, bool is8x16) private static Bitmap Section(Image srcBitmap, Rectangle section, bool is8x16)
@ -532,7 +532,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
toolStripStatusLabel1.Text = found.Text + " copied to clipboard."; toolStripStatusLabel1.Text = $"{found.Text} copied to clipboard.";
Messagetimer.Stop(); Messagetimer.Stop();
Messagetimer.Start(); Messagetimer.Start();
@ -619,11 +619,11 @@ namespace BizHawk.Client.EmuHawk
tile &= ~1; tile &= ~1;
} }
AddressLabel.Text = "Number: " + string.Format("{0:X2}", spriteNumber); AddressLabel.Text = $"Number: {spriteNumber:X2}";
ValueLabel.Text = "X: " + string.Format("{0:X2}", x); ValueLabel.Text = $"X: {x:X2}";
Value2Label.Text = "Y: " + string.Format("{0:X2}", y); Value2Label.Text = $"Y: {y:X2}";
Value3Label.Text = "Tile: " + string.Format("{0:X2}", tile); Value3Label.Text = $"Tile: {tile:X2}";
Value4Label.Text = "Color: " + color; Value4Label.Text = $"Color: {color}";
Value5Label.Text = flags; Value5Label.Text = flags;
if (is8x16) if (is8x16)
@ -668,7 +668,7 @@ namespace BizHawk.Client.EmuHawk
int column = e.X / 16; int column = e.X / 16;
int addr = column + baseAddr; int addr = column + baseAddr;
AddressLabel.Text = "Address: 0x" + string.Format("{0:X4}", addr); AddressLabel.Text = $"Address: 0x{addr:X4}";
int val; int val;
var bmp = new Bitmap(64, 64); var bmp = new Bitmap(64, 64);
@ -679,20 +679,20 @@ namespace BizHawk.Client.EmuHawk
if (baseAddr == 0x3F00) if (baseAddr == 0x3F00)
{ {
val = PALRAM[PaletteView.BgPalettes[column].Address]; val = PALRAM[PaletteView.BgPalettes[column].Address];
ValueLabel.Text = "ID: BG" + (column / 4); ValueLabel.Text = $"ID: BG{column / 4}";
g.FillRectangle(new SolidBrush(PaletteView.BgPalettes[column].Color), 0, 0, 64, 64); g.FillRectangle(new SolidBrush(PaletteView.BgPalettes[column].Color), 0, 0, 64, 64);
} }
else else
{ {
val = PALRAM[PaletteView.SpritePalettes[column].Address]; val = PALRAM[PaletteView.SpritePalettes[column].Address];
ValueLabel.Text = "ID: SPR" + (column / 4); ValueLabel.Text = $"ID: SPR{column / 4}";
g.FillRectangle(new SolidBrush(PaletteView.SpritePalettes[column].Color), 0, 0, 64, 64); g.FillRectangle(new SolidBrush(PaletteView.SpritePalettes[column].Color), 0, 0, 64, 64);
} }
g.Dispose(); g.Dispose();
Value3Label.Text = "Color: 0x" + string.Format("{0:X2}", val); Value3Label.Text = $"Color: 0x{val:X2}";
Value4Label.Text = "Offset: " + (addr & 0x03); Value4Label.Text = $"Offset: {addr & 0x03}";
ZoomBox.Image = bmp; ZoomBox.Image = bmp;
} }
@ -772,9 +772,9 @@ namespace BizHawk.Client.EmuHawk
usage += " (SPR16)"; usage += " (SPR16)";
} }
AddressLabel.Text = "Address: " + string.Format("{0:X4}", address); AddressLabel.Text = $"Address: {address:X4}";
ValueLabel.Text = "Table " + table; ValueLabel.Text = $"Table {table}";
Value3Label.Text = "Tile " + string.Format("{0:X2}", tile); Value3Label.Text = $"Tile {tile:X2}";
Value4Label.Text = usage; Value4Label.Text = usage;
ZoomBox.Image = Section(PatternView.pattern, new Rectangle(new Point((e.X / 8) * 8, (e.Y / 8) * 8), new Size(8, 8)), false); ZoomBox.Image = Section(PatternView.pattern, new Rectangle(new Point((e.X / 8) * 8, (e.Y / 8) * 8), new Size(8, 8)), false);

View File

@ -71,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
FileName = PathManager.FilesystemSafeName(Global.Game) + "-Nametables", FileName = $"{PathManager.FilesystemSafeName(Global.Game)}-Nametables",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true RestoreDirectory = true

View File

@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
FileName = PathManager.FilesystemSafeName(Global.Game) + "-Palettes", FileName = $"{PathManager.FilesystemSafeName(Global.Game)}-Palettes",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true RestoreDirectory = true

View File

@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
FileName = PathManager.FilesystemSafeName(Global.Game) + "-Patterns", FileName = $"{PathManager.FilesystemSafeName(Global.Game)}-Patterns",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true RestoreDirectory = true

View File

@ -44,7 +44,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
FileName = PathManager.FilesystemSafeName(Global.Game) + "-Sprites", FileName = $"{PathManager.FilesystemSafeName(Global.Game)}-Sprites",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*", Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true RestoreDirectory = true

View File

@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
int tileNo = vdc.VRAM[(ushort)((yTile * vdc.BatWidth) + xTile)] & 0x07FF; int tileNo = vdc.VRAM[(ushort)((yTile * vdc.BatWidth) + xTile)] & 0x07FF;
int paletteNo = vdc.VRAM[(ushort)((yTile * vdc.BatWidth) + xTile)] >> 12; int paletteNo = vdc.VRAM[(ushort)((yTile * vdc.BatWidth) + xTile)] >> 12;
TileIDLabel.Text = tileNo.ToString(); TileIDLabel.Text = tileNo.ToString();
XYLabel.Text = xTile + ":" + yTile; XYLabel.Text = $"{xTile}:{yTile}";
PaletteLabel.Text = paletteNo.ToString(); PaletteLabel.Text = paletteNo.ToString();
} }

View File

@ -190,7 +190,7 @@ namespace BizHawk.Client.EmuHawk
private void btnExport_Click(object sender, EventArgs e) private void btnExport_Click(object sender, EventArgs e)
{ {
string tmpf = Path.GetTempFileName() + ".zip"; string tmpf = $"{Path.GetTempFileName()}.zip";
using (var stream = new FileStream(tmpf, FileMode.Create, FileAccess.Write, FileShare.Read)) using (var stream = new FileStream(tmpf, FileMode.Create, FileAccess.Write, FileShare.Read))
{ {
var zip = new ZipOutputStream(stream) var zip = new ZipOutputStream(stream)
@ -201,7 +201,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var entry in PSGEntries) foreach (var entry in PSGEntries)
{ {
var ze = new ZipEntry(entry.name + ".wav") { CompressionMethod = CompressionMethod.Deflated }; var ze = new ZipEntry($"{entry.name}.wav") { CompressionMethod = CompressionMethod.Deflated };
zip.PutNextEntry(ze); zip.PutNextEntry(ze);
var ms = new MemoryStream(); var ms = new MemoryStream();
var bw = new BinaryWriter(ms); var bw = new BinaryWriter(ms);

View File

@ -318,8 +318,8 @@ namespace BizHawk.Client.EmuHawk
{ {
int val = 0, add = 0; int val = 0, add = 0;
SnesGGDecode(GGCodeMaskBox.Text, ref val, ref add); SnesGGDecode(GGCodeMaskBox.Text, ref val, ref add);
AddressBox.Text = string.Format("{0:X6}", add); AddressBox.Text = $"{add:X6}";
ValueBox.Text = string.Format("{0:X2}", val); ValueBox.Text = $"{val:X2}";
addcheatbt.Enabled = true; addcheatbt.Enabled = true;
} }
else else

View File

@ -130,8 +130,8 @@ namespace BizHawk.Client.EmuHawk
string FormatVramAddress(int address) string FormatVramAddress(int address)
{ {
int excess = address & 1023; int excess = address & 1023;
if (excess != 0) return "@" + address.ToHexString(4); if (excess != 0) return $"@{address.ToHexString(4)}";
else return string.Format("@{0} ({1}K)", address.ToHexString(4), address / 1024); else return $"@{address.ToHexString(4)} ({address / 1024}K)";
} }
public void NewUpdate(ToolFormUpdateType type) { } public void NewUpdate(ToolFormUpdateType type) { }
@ -245,7 +245,7 @@ namespace BizHawk.Client.EmuHawk
txtOBSELSizeBits.Text = si.OBSEL_Size.ToString(); txtOBSELSizeBits.Text = si.OBSEL_Size.ToString();
txtOBSELBaseBits.Text = si.OBSEL_NameBase.ToString(); txtOBSELBaseBits.Text = si.OBSEL_NameBase.ToString();
txtOBSELT1OfsBits.Text = si.OBSEL_NameSel.ToString(); txtOBSELT1OfsBits.Text = si.OBSEL_NameSel.ToString();
txtOBSELSizeDescr.Text = string.Format("{0}, {1}", SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 0], SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 1]); txtOBSELSizeDescr.Text = $"{SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 0]}, {SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 1]}";
txtOBSELBaseDescr.Text = FormatVramAddress(si.OBJTable0Addr); txtOBSELBaseDescr.Text = FormatVramAddress(si.OBJTable0Addr);
txtOBSELT1OfsDescr.Text = FormatVramAddress(si.OBJTable1Addr); txtOBSELT1OfsDescr.Text = FormatVramAddress(si.OBJTable1Addr);
@ -282,7 +282,7 @@ namespace BizHawk.Client.EmuHawk
txtBG1SizeBits.Text = bg.SCSIZE.ToString(); txtBG1SizeBits.Text = bg.SCSIZE.ToString();
txtBG1SizeInTiles.Text = bg.ScreenSizeInTiles.ToString(); txtBG1SizeInTiles.Text = bg.ScreenSizeInTiles.ToString();
int size = bg.ScreenSizeInTiles.Width * bg.ScreenSizeInTiles.Height * 2 / 1024; int size = bg.ScreenSizeInTiles.Width * bg.ScreenSizeInTiles.Height * 2 / 1024;
txtBG1MapSizeBytes.Text = string.Format("({0}K)", size); txtBG1MapSizeBytes.Text = $"({size}K)";
txtBG1SCAddrBits.Text = bg.SCADDR.ToString(); txtBG1SCAddrBits.Text = bg.SCADDR.ToString();
txtBG1SCAddrDescr.Text = FormatVramAddress(bg.ScreenAddr); txtBG1SCAddrDescr.Text = FormatVramAddress(bg.ScreenAddr);
txtBG1Colors.Text = (1 << bg.Bpp).ToString(); txtBG1Colors.Text = (1 << bg.Bpp).ToString();
@ -290,17 +290,17 @@ namespace BizHawk.Client.EmuHawk
txtBG1TDAddrBits.Text = bg.TDADDR.ToString(); txtBG1TDAddrBits.Text = bg.TDADDR.ToString();
txtBG1TDAddrDescr.Text = FormatVramAddress(bg.TiledataAddr); txtBG1TDAddrDescr.Text = FormatVramAddress(bg.TiledataAddr);
txtBG1Scroll.Text = string.Format("({0},{1})", bg.HOFS, bg.VOFS); txtBG1Scroll.Text = $"({bg.HOFS},{bg.VOFS})";
if (bg.Bpp != 0) if (bg.Bpp != 0)
{ {
var pi = bg.PaletteSelection; var pi = bg.PaletteSelection;
txtBGPaletteInfo.Text = string.Format("{0} colors from ${1:X2} - ${2:X2}", pi.size, pi.start, pi.start + pi.size - 1); txtBGPaletteInfo.Text = $"{pi.size} colors from ${pi.start:X2} - ${pi.start + pi.size - 1:X2}";
} }
else txtBGPaletteInfo.Text = ""; else txtBGPaletteInfo.Text = "";
var sizeInPixels = bg.ScreenSizeInPixels; var sizeInPixels = bg.ScreenSizeInPixels;
txtBG1SizeInPixels.Text = string.Format("{0}x{1}", sizeInPixels.Width, sizeInPixels.Height); txtBG1SizeInPixels.Text = $"{sizeInPixels.Width}x{sizeInPixels.Height}";
checkTMOBJ.Checked = si.OBJ_MainEnabled; checkTMOBJ.Checked = si.OBJ_MainEnabled;
checkTMBG1.Checked = si.BG.BG1.MainEnabled; checkTMBG1.Checked = si.BG.BG1.MainEnabled;
@ -724,7 +724,7 @@ namespace BizHawk.Client.EmuHawk
static string BGModeShortName(SNESGraphicsDecoder.BGMode mode, int bpp) static string BGModeShortName(SNESGraphicsDecoder.BGMode mode, int bpp)
{ {
if (mode == SNESGraphicsDecoder.BGMode.Unavailable) return "Unavailable"; if (mode == SNESGraphicsDecoder.BGMode.Unavailable) return "Unavailable";
if (mode == SNESGraphicsDecoder.BGMode.Text) return string.Format("Text{0}bpp", bpp); if (mode == SNESGraphicsDecoder.BGMode.Text) return $"Text{bpp}bpp";
if (mode == SNESGraphicsDecoder.BGMode.OBJ) return string.Format("OBJ", bpp); if (mode == SNESGraphicsDecoder.BGMode.OBJ) return string.Format("OBJ", bpp);
if (mode == SNESGraphicsDecoder.BGMode.Mode7) return "Mode7"; if (mode == SNESGraphicsDecoder.BGMode.Mode7) return "Mode7";
if (mode == SNESGraphicsDecoder.BGMode.Mode7Ext) return "Mode7Ext"; if (mode == SNESGraphicsDecoder.BGMode.Mode7Ext) return "Mode7Ext";
@ -736,17 +736,17 @@ namespace BizHawk.Client.EmuHawk
{ {
if (currObjDataState == null) return; if (currObjDataState == null) return;
var oam = new SNESGraphicsDecoder.OAMInfo(gd, si, currObjDataState.Number); var oam = new SNESGraphicsDecoder.OAMInfo(gd, si, currObjDataState.Number);
txtObjNumber.Text = string.Format("#${0:X2}", currObjDataState.Number); txtObjNumber.Text = $"#${currObjDataState.Number:X2}";
txtObjCoord.Text = string.Format("({0}, {1})",oam.X,oam.Y); txtObjCoord.Text = $"({oam.X}, {oam.Y})";
cbObjHFlip.Checked = oam.HFlip; cbObjHFlip.Checked = oam.HFlip;
cbObjVFlip.Checked = oam.VFlip; cbObjVFlip.Checked = oam.VFlip;
cbObjLarge.Checked = oam.Size == 1; cbObjLarge.Checked = oam.Size == 1;
txtObjSize.Text = SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, oam.Size].ToString(); txtObjSize.Text = SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, oam.Size].ToString();
txtObjPriority.Text = oam.Priority.ToString(); txtObjPriority.Text = oam.Priority.ToString();
txtObjPalette.Text = oam.Palette.ToString(); txtObjPalette.Text = oam.Palette.ToString();
txtObjPaletteMemo.Text = string.Format("${0:X2}", oam.Palette * 16 + 128); txtObjPaletteMemo.Text = $"${oam.Palette * 16 + 128:X2}";
txtObjName.Text = string.Format("#${0:X3}", oam.Tile); txtObjName.Text = $"#${oam.Tile:X3}";
txtObjNameAddr.Text = string.Format("@{0:X4}", oam.Address); txtObjNameAddr.Text = $"@{oam.Address:X4}";
} }
void UpdateTileDetails() void UpdateTileDetails()
@ -757,18 +757,18 @@ namespace BizHawk.Client.EmuHawk
txtTileMode.Text = BGModeShortName(mode, bpp); txtTileMode.Text = BGModeShortName(mode, bpp);
txtTileBpp.Text = currTileDataState.Bpp.ToString(); txtTileBpp.Text = currTileDataState.Bpp.ToString();
txtTileColors.Text = (1 << currTileDataState.Bpp).ToString(); txtTileColors.Text = (1 << currTileDataState.Bpp).ToString();
txtTileNumber.Text = string.Format("#${0:X3}", currTileDataState.Tile); txtTileNumber.Text = $"#${currTileDataState.Tile:X3}";
txtTileAddress.Text = string.Format("@{0:X4}", currTileDataState.Address); txtTileAddress.Text = $"@{currTileDataState.Address:X4}";
txtTilePalette.Text = string.Format("#{0:X2}", currTileDataState.Palette); txtTilePalette.Text = $"#{currTileDataState.Palette:X2}";
} }
void UpdateMapEntryDetails() void UpdateMapEntryDetails()
{ {
if (currMapEntryState == null) return; if (currMapEntryState == null) return;
txtMapEntryLocation.Text = string.Format("({0},{1}), @{2:X4}", currMapEntryState.Location.X, currMapEntryState.Location.Y, currMapEntryState.entry.address); txtMapEntryLocation.Text = $"({currMapEntryState.Location.X},{currMapEntryState.Location.Y}), @{currMapEntryState.entry.address:X4}";
txtMapEntryTileNum.Text = string.Format("${0:X3}", currMapEntryState.entry.tilenum); txtMapEntryTileNum.Text = $"${currMapEntryState.entry.tilenum:X3}";
txtMapEntryPrio.Text = string.Format("{0}", (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Priority)!=0?1:0); txtMapEntryPrio.Text = $"{((currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Priority) != 0 ? 1 : 0)}";
txtMapEntryPalette.Text = string.Format("{0}", currMapEntryState.entry.palette); txtMapEntryPalette.Text = $"{currMapEntryState.entry.palette}";
checkMapEntryHFlip.Checked = (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Horz) != 0; checkMapEntryHFlip.Checked = (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Horz) != 0;
checkMapEntryVFlip.Checked = (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Vert) != 0; checkMapEntryVFlip.Checked = (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Vert) != 0;
@ -786,7 +786,7 @@ namespace BizHawk.Client.EmuHawk
addr *= 2; addr *= 2;
addr &= 0xFFFF; addr &= 0xFFFF;
txtMapEntryTileAddr.Text = "@" + addr.ToHexString(4); txtMapEntryTileAddr.Text = $"@{addr.ToHexString(4)}";
} }
void UpdateColorDetails() void UpdateColorDetails()
@ -798,19 +798,19 @@ namespace BizHawk.Client.EmuHawk
int color = gd.Colorize(rgb555); int color = gd.Colorize(rgb555);
pnDetailsPaletteColor.BackColor = Color.FromArgb(color); pnDetailsPaletteColor.BackColor = Color.FromArgb(color);
txtDetailsPaletteColor.Text = string.Format("${0:X4}", rgb555); txtDetailsPaletteColor.Text = $"${rgb555:X4}";
txtDetailsPaletteColorHex.Text = string.Format("#{0:X6}", color & 0xFFFFFF); txtDetailsPaletteColorHex.Text = $"#{color & 0xFFFFFF:X6}";
txtDetailsPaletteColorRGB.Text = string.Format("({0},{1},{2})", (color >> 16) & 0xFF, (color >> 8) & 0xFF, (color & 0xFF)); txtDetailsPaletteColorRGB.Text = $"({(color >> 16) & 0xFF},{(color >> 8) & 0xFF},{(color & 0xFF)})";
txtPaletteDetailsIndexHex.Text = string.Format("${0:X2}", lastColorNum); txtPaletteDetailsIndexHex.Text = $"${lastColorNum:X2}";
txtPaletteDetailsIndex.Text = string.Format("{0}", lastColorNum); txtPaletteDetailsIndex.Text = $"{lastColorNum}";
//not being used anymore //not being used anymore
//if (lastColorNum < 128) lblDetailsOBJOrBG.Text = "(BG:)"; else lblDetailsOBJOrBG.Text = "(OBJ:)"; //if (lastColorNum < 128) lblDetailsOBJOrBG.Text = "(BG:)"; else lblDetailsOBJOrBG.Text = "(OBJ:)";
//txtPaletteDetailsIndexHexSpecific.Text = string.Format("${0:X2}", lastColorNum & 0x7F); //txtPaletteDetailsIndexHexSpecific.Text = $"${lastColorNum & 0x7F:X2}";
//txtPaletteDetailsIndexSpecific.Text = string.Format("{0}", lastColorNum & 0x7F); //txtPaletteDetailsIndexSpecific.Text = $"{lastColorNum & 0x7F}";
txtPaletteDetailsAddress.Text = string.Format("${0:X3}", lastColorNum * 2); txtPaletteDetailsAddress.Text = $"${lastColorNum * 2:X3}";
} }
@ -1313,7 +1313,7 @@ namespace BizHawk.Client.EmuHawk
label = "Map Entry"; label = "Map Entry";
if (found.Name == "paletteViewer") if (found.Name == "paletteViewer")
label = "Palette"; label = "Palette";
labelClipboard.Text = label + " copied to clipboard."; labelClipboard.Text = $"{label} copied to clipboard.";
messagetimer.Stop(); messagetimer.Stop();
messagetimer.Start(); messagetimer.Start();

View File

@ -226,7 +226,7 @@ namespace BizHawk.Client.EmuHawk
Movie.CurrentBranch = index; Movie.CurrentBranch = index;
LoadBranch(SelectedBranch); LoadBranch(SelectedBranch);
BranchView.Refresh(); BranchView.Refresh();
GlobalWin.OSD.AddMessage("Loaded branch " + Movie.CurrentBranch.ToString()); GlobalWin.OSD.AddMessage($"Loaded branch {Movie.CurrentBranch}");
} }
} }
@ -244,7 +244,7 @@ namespace BizHawk.Client.EmuHawk
{ {
Branch(); Branch();
CallSavedCallback(Movie.BranchCount - 1); CallSavedCallback(Movie.BranchCount - 1);
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString()); GlobalWin.OSD.AddMessage($"Added branch {Movie.CurrentBranch}");
} }
private void AddBranchWithTexToolStripMenuItem_Click(object sender, EventArgs e) private void AddBranchWithTexToolStripMenuItem_Click(object sender, EventArgs e)
@ -252,7 +252,7 @@ namespace BizHawk.Client.EmuHawk
Branch(); Branch();
EditBranchTextPopUp(Movie.CurrentBranch); EditBranchTextPopUp(Movie.CurrentBranch);
CallSavedCallback(Movie.BranchCount - 1); CallSavedCallback(Movie.BranchCount - 1);
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString()); GlobalWin.OSD.AddMessage($"Added branch {Movie.CurrentBranch}");
} }
private void LoadBranchToolStripMenuItem_Click(object sender, EventArgs e) private void LoadBranchToolStripMenuItem_Click(object sender, EventArgs e)
@ -292,7 +292,7 @@ namespace BizHawk.Client.EmuHawk
UpdateBranch(SelectedBranch); UpdateBranch(SelectedBranch);
CallSavedCallback(Movie.CurrentBranch); CallSavedCallback(Movie.CurrentBranch);
GlobalWin.OSD.AddMessage("Saved branch " + Movie.CurrentBranch); GlobalWin.OSD.AddMessage($"Saved branch {Movie.CurrentBranch}");
} }
} }
@ -312,7 +312,7 @@ namespace BizHawk.Client.EmuHawk
toolTip1.SetToolTip(UndoBranchButton, "Undo Branch Text Edit"); toolTip1.SetToolTip(UndoBranchButton, "Undo Branch Text Edit");
_branchUndo = BranchUndo.Text; _branchUndo = BranchUndo.Text;
GlobalWin.OSD.AddMessage("Edited branch " + index.ToString()); GlobalWin.OSD.AddMessage($"Edited branch {index}");
} }
} }
} }
@ -358,7 +358,7 @@ namespace BizHawk.Client.EmuHawk
CallRemovedCallback(index); CallRemovedCallback(index);
Tastudio.RefreshDialog(); Tastudio.RefreshDialog();
GlobalWin.OSD.AddMessage("Removed branch " + index.ToString()); GlobalWin.OSD.AddMessage($"Removed branch {index}");
} }
} }
@ -578,7 +578,7 @@ namespace BizHawk.Client.EmuHawk
var i = new InputPrompt var i = new InputPrompt
{ {
Text = "Text for branch " + index, Text = $"Text for branch {index}",
TextInputType = InputPrompt.InputType.Text, TextInputType = InputPrompt.InputType.Text,
Message = "Enter a message", Message = "Enter a message",
InitialValue = branch.UserText InitialValue = branch.UserText

View File

@ -36,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
MemStateGapDividerNumeric.Value = NumberExtensions.Clamp(_settings.MemStateGapDivider, MemStateGapDividerNumeric.Minimum, MemStateGapDividerNumeric.Maximum); MemStateGapDividerNumeric.Value = NumberExtensions.Clamp(_settings.MemStateGapDivider, MemStateGapDividerNumeric.Minimum, MemStateGapDividerNumeric.Maximum);
FileStateGapNumeric.Value = _settings.FileStateGap; FileStateGapNumeric.Value = _settings.FileStateGap;
SavestateSizeLabel.Text = Math.Round(_stateSizeMb, 2).ToString() + " MB"; SavestateSizeLabel.Text = $"{Math.Round(_stateSizeMb, 2)} MB";
CapacityNumeric_ValueChanged(null, null); CapacityNumeric_ValueChanged(null, null);
SaveCapacityNumeric_ValueChanged(null, null); SaveCapacityNumeric_ValueChanged(null, null);
} }

View File

@ -183,7 +183,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var i = new InputPrompt var i = new InputPrompt
{ {
Text = "Marker for frame " + markerFrame, Text = $"Marker for frame {markerFrame}",
TextInputType = InputPrompt.InputType.Text, TextInputType = InputPrompt.InputType.Text,
Message = "Enter a message", Message = "Enter a message",
InitialValue = InitialValue =
@ -218,7 +218,7 @@ namespace BizHawk.Client.EmuHawk
var point = default(Point); var point = default(Point);
var i = new InputPrompt var i = new InputPrompt
{ {
Text = "Marker for frame " + markerFrame, Text = $"Marker for frame {markerFrame}",
TextInputType = InputPrompt.InputType.Text, TextInputType = InputPrompt.InputType.Text,
Message = "Enter a message", Message = "Enter a message",
InitialValue = InitialValue =

View File

@ -157,7 +157,7 @@ namespace BizHawk.Client.EmuHawk
int index = 0; int index = 0;
for (int i = 0; i < _counts.Count; i++) for (int i = 0; i < _counts.Count; i++)
{ {
string str = index + ": "; string str = $"{index}: ";
if (IsBool) if (IsBool)
{ {
str += _values[i][0] == 'T' ? "On" : "Off"; str += _values[i][0] == 'T' ? "On" : "Off";
@ -167,11 +167,11 @@ namespace BizHawk.Client.EmuHawk
str += _values[i]; str += _values[i];
} }
PatternList.Items.Add(str + ("\t(x" + _counts[i] + ")")); PatternList.Items.Add($"{str}\t(x{_counts[i]})");
index += _counts[i]; index += _counts[i];
} }
PatternList.Items.Add("Loop to: " + _loopAt); PatternList.Items.Add($"Loop to: {_loopAt}");
if (oldIndex >= PatternList.Items.Count) if (oldIndex >= PatternList.Items.Count)
{ {

View File

@ -344,7 +344,7 @@ namespace BizHawk.Client.EmuHawk
catch (Exception ex) catch (Exception ex)
{ {
text = ""; text = "";
MessageBox.Show("oops\n" + ex); MessageBox.Show($"oops\n{ex}");
} }
} }
@ -643,7 +643,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame); CurrentTasMovie.ChangeLog.BeginNewBatch($"Paint Bool {buttonName} from frame {frame}");
CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName); CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName); _boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
@ -683,7 +683,7 @@ namespace BizHawk.Client.EmuHawk
if (e.Clicks != 2 && !Settings.SingleClickFloatEdit) if (e.Clicks != 2 && !Settings.SingleClickFloatEdit)
{ {
CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Float " + buttonName + " from frame " + frame); CurrentTasMovie.ChangeLog.BeginNewBatch($"Paint Float {buttonName} from frame {frame}");
_startFloatDrawColumn = buttonName; _startFloatDrawColumn = buttonName;
} }
else // Double-click enters float editing mode else // Double-click enters float editing mode
@ -694,7 +694,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
CurrentTasMovie.ChangeLog.BeginNewBatch("Float Edit: " + frame); CurrentTasMovie.ChangeLog.BeginNewBatch($"Float Edit: {frame}");
_floatEditColumn = buttonName; _floatEditColumn = buttonName;
floatEditRow = frame; floatEditRow = frame;
_floatTypedValue = ""; _floatTypedValue = "";
@ -1350,7 +1350,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
_floatTypedValue = "-" + _floatTypedValue; _floatTypedValue = $"-{_floatTypedValue}";
} }
} }
else if (e.KeyCode == Keys.Back) else if (e.KeyCode == Keys.Back)

Some files were not shown because too many files have changed in this diff Show More