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;
for (;;)
{
yield return Path.Combine(dir, baseName) + "_" + counter + ext;
yield return Path.Combine(dir, $"{baseName}_{counter}{ext}");
counter++;
}
}
@ -97,7 +97,7 @@ namespace BizHawk.Client.EmuHawk
}
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;
if (a_bits == 16) bytes = 2;
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) { }
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.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)))
{
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
@ -991,7 +991,7 @@ namespace BizHawk.Client.EmuHawk
// using (Font f = new Font(FontFamily.GenericMonospace, 10))
// 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 x = 0; x < 256; x++)
// 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
#endif
string filename = _baseName + (_segment > 0 ? $"_{_segment}" : "") + _ext;
_ffmpeg.StartInfo.Arguments = string.Format("-y -f nut -i - {1} \"{0}\"", filename, _token.Commandline);
_ffmpeg.StartInfo.Arguments = $"-y -f nut -i - {_token.Commandline} \"{_baseName}{(_segment == 0 ? string.Empty : $"_{_segment}")}{_ext}\"";
_ffmpeg.StartInfo.CreateNoWindow = true;
// ffmpeg sends informative display to stderr, and nothing to stdout
@ -100,7 +99,7 @@ namespace BizHawk.Client.EmuHawk
_ffmpeg.StartInfo.RedirectStandardInput = true;
_ffmpeg.StartInfo.UseShellExecute = false;
_commandline = "ffmpeg " + _ffmpeg.StartInfo.Arguments;
_commandline = $"ffmpeg {_ffmpeg.StartInfo.Arguments}";
_ffmpeg.ErrorDataReceived += new DataReceivedEventHandler(StderrHandler);
@ -132,7 +131,7 @@ namespace BizHawk.Client.EmuHawk
_stderr.Dequeue();
}
_stderr.Enqueue(line.Data + "\n");
_stderr.Enqueue($"{line.Data}\n");
}
}
@ -193,7 +192,7 @@ namespace BizHawk.Client.EmuHawk
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();
@ -203,7 +202,7 @@ namespace BizHawk.Client.EmuHawk
}
catch
{
MessageBox.Show("Exception! ffmpeg history:\n" + ffmpeg_geterror());
MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
throw;
}
@ -274,7 +273,7 @@ namespace BizHawk.Client.EmuHawk
{
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)
@ -289,7 +288,7 @@ namespace BizHawk.Client.EmuHawk
}
catch
{
MessageBox.Show("Exception! ffmpeg history:\n" + ffmpeg_geterror());
MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
throw;
}
}

View File

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

View File

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

View File

@ -671,7 +671,7 @@ namespace BizHawk.Client.EmuHawk
}
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;
}
}

View File

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

View File

@ -21,8 +21,8 @@ namespace BizHawk.Client.EmuHawk
string subpath = SynclessRecorder.GetPathFragmentForFrameNum(index);
string path = mFramesDirectory;
path = Path.Combine(path, subpath);
png = path + ".png";
wav = path + ".wav";
png = $"{path}.png";
wav = $"{path}.wav";
}
private string mSynclessConfigFile;
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
{
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)
};

View File

@ -265,7 +265,7 @@ namespace BizHawk.Client.EmuHawk
int counter = 1;
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++;
}
}

View File

@ -163,9 +163,9 @@ namespace BizHawk.Client.EmuHawk
private void AboutBox_Load(object sender, EventArgs e)
{
#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
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
if (DateTime.Now.Month == 12)
if (DateTime.Now.Day > 17 && DateTime.Now.Day <= 25)

View File

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

View File

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

View File

@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
{
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)
{
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);
// 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)";
if (VersionInfo.DeveloperBuild)
{
Text = " BizHawk (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")";
Text = $" BizHawk (GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH})";
}
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;
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)
{
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)

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
// Convenience hack
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)
{
System.Diagnostics.Trace.WriteLine("VirtualListView.SetItemState error=" + ex.Message);
System.Diagnostics.Trace.WriteLine($"VirtualListView.SetItemState error={ex.Message}");
// TODO: should this eat any exceptions?
throw;
@ -551,7 +551,7 @@ namespace BizHawk.Client.EmuHawk
}
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)
{
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)
{
throw new ArgumentException("cannot find item " + idx + " via QueryItem event");
throw new ArgumentException($"cannot find item {idx} via QueryItem event");
}
return item;

View File

@ -146,7 +146,7 @@ namespace BizHawk.Client.EmuHawk
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()

View File

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

View File

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

View File

@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk.Filters
Shaders[i] = shader;
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;
}
}
@ -141,25 +141,25 @@ namespace BizHawk.Client.EmuHawk.Filters
sp.Index = i;
Passes.Add(sp);
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.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.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.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?
//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.
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);
ScaleType st = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, "scale_type" + i, "NotSet"), 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);
ScaleType st = (ScaleType)Enum.Parse(typeof(ScaleType), FetchString(dict, $"scale_type{i}", "NotSet"), true);
if (st != ScaleType.NotSet)
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.
sp.Scale.X = FetchFloat(dict, "scale_x" + i, 1);
sp.Scale.Y = FetchFloat(dict, "scale_y" + i, 1);
float scale = FetchFloat(dict, "scale" + i, -999);
sp.Scale.X = FetchFloat(dict, $"scale_x{i}", 1);
sp.Scale.Y = FetchFloat(dict, $"scale_y{i}", 1);
float scale = FetchFloat(dict, $"scale{i}", -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
}
@ -251,7 +251,7 @@ namespace BizHawk.Client.EmuHawk.Filters
public override string ToString()
{
return string.Format("RetroShaderPass[#{0}]", RSI);
return $"RetroShaderPass[#{RSI}]";
}
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
var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" };
string explorePath = "\"" + hf.FullPathWithoutMember + "\"";
tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + explorePath); };
string explorePath = $"\"{hf.FullPathWithoutMember}\"";
tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", $"/select, {explorePath}"); };
tsdd.Items.Add(tsmiExplore);
var tsmiCopyFile = new ToolStripMenuItem { Text = "Copy &File" };
@ -217,12 +217,12 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
GlobalWin.Sound.StopSound();
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
{
// 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 (encodedPath != null)

View File

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

View File

@ -25,7 +25,7 @@ namespace BizHawk.Client.EmuHawk
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 (; ; )

View File

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

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
JoystickState jss = Joystick.GetState(i);
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);
Devices.Add(ogp);
@ -77,7 +77,7 @@ namespace BizHawk.Client.EmuHawk
return state;
}
public string Name { get { return "Joystick " + _stickIdx; } }
public string Name { get { return $"Joystick {_stickIdx}"; } }
public Guid Guid { get { return _guid; } }
@ -122,17 +122,17 @@ namespace BizHawk.Client.EmuHawk
int jb = 1;
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 = 1;
foreach (JoystickHat enval in Enum.GetValues(typeof(JoystickHat)))
{
AddItem(string.Format("POV{0}U", jb), () => state.GetHat(enval).IsUp);
AddItem(string.Format("POV{0}D", jb), () => state.GetHat(enval).IsDown);
AddItem(string.Format("POV{0}L", jb), () => state.GetHat(enval).IsLeft);
AddItem(string.Format("POV{0}R", jb), () => state.GetHat(enval).IsRight);
AddItem($"POV{jb}U", () => state.GetHat(enval).IsUp);
AddItem($"POV{jb}D", () => state.GetHat(enval).IsDown);
AddItem($"POV{jb}L", () => state.GetHat(enval).IsLeft);
AddItem($"POV{jb}R", () => state.GetHat(enval).IsRight);
jb++;
}
}

View File

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

View File

@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk
}
string remainder = cmdLine.Substring(childCmdLine);
string path = cmdLine.Substring(lastSlash, lastGood - lastSlash);
return path + " " + remainder;
return $"{path} {remainder}";
}
static IntPtr oldOut, conOut;
@ -164,7 +164,7 @@ namespace BizHawk.Client.EmuHawk
hasConsole = true;
}
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)

View File

@ -443,12 +443,12 @@ namespace BizHawk.Client.EmuHawk
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)
{
LoadQuickSave("QuickSave" + Global.Config.SaveSlot);
LoadQuickSave($"QuickSave{Global.Config.SaveSlot}");
}
private void FlushSaveRAMMenuItem_Click(object sender, EventArgs e)
@ -683,7 +683,7 @@ namespace BizHawk.Client.EmuHawk
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
{
@ -1364,7 +1364,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config = ConfigService.Load<Config>(PathManager.DefaultIniPath);
Global.Config.ResolveDefaults();
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)
@ -1383,7 +1383,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config = ConfigService.Load<Config>(ofd.FileName);
Global.Config.ResolveDefaults();
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++)
{
var str = "FDS Insert " + i;
var str = $"FDS Insert {i}";
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
{
Name = "Disk" + (i + 1),
Text = "Disk" + (i + 1),
Name = $"Disk{i + 1}",
Text = $"Disk{i + 1}",
Checked = appleII.CurrentDisk == i
};
@ -2479,8 +2479,8 @@ namespace BizHawk.Client.EmuHawk
{
var menuItem = new ToolStripMenuItem
{
Name = "Disk" + (i + 1),
Text = "Disk" + (i + 1),
Name = $"Disk{i + 1}",
Text = $"Disk{i + 1}",
Checked = c64.CurrentDisk == i
};
@ -2581,8 +2581,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem
{
Name = i + "_" + name,
Text = i + ": " + name,
Name = $"{i}_{name}",
Text = $"{i}: {name}",
Checked = currSel == i
};
@ -2616,8 +2616,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem
{
Name = i + "_" + name,
Text = i + ": " + name,
Name = $"{i}_{name}",
Text = $"{i}: {name}",
Checked = currSel == i
};
@ -2705,8 +2705,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem
{
Name = i + "_" + name,
Text = i + ": " + name,
Name = $"{i}_{name}",
Text = $"{i}: {name}",
Checked = currSel == i
};
@ -2740,8 +2740,8 @@ namespace BizHawk.Client.EmuHawk
var menuItem = new ToolStripMenuItem
{
Name = i + "_" + name,
Text = i + ": " + name,
Name = $"{i}_{name}",
Text = $"{i}: {name}",
Checked = currSel == i
};
@ -2879,23 +2879,19 @@ namespace BizHawk.Client.EmuHawk
}
}
var file = new FileInfo(
PathManager.SaveStatePrefix(Global.Game) +
".QuickSave" +
Global.Config.SaveSlot +
".State.bak");
var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{Global.Config.SaveSlot}.State.bak");
if (file.Exists)
{
UndoSavestateContextMenuItem.Enabled = true;
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;
}
else
{
UndoSavestateContextMenuItem.Text = "Undo Save to slot " + Global.Config.SaveSlot;
UndoSavestateContextMenuItem.Text = $"Undo Save to slot {Global.Config.SaveSlot}";
UndoSavestateContextMenuItem.Image = Properties.Resources.undo;
}
}
@ -3025,13 +3021,9 @@ namespace BizHawk.Client.EmuHawk
private void UndoSavestateContextMenuItem_Click(object sender, EventArgs e)
{
_stateSlots.SwapBackupSavestate(
PathManager.SaveStatePrefix(Global.Game) +
".QuickSave" +
Global.Config.SaveSlot +
".State");
_stateSlots.SwapBackupSavestate($"{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)
@ -3078,12 +3070,12 @@ namespace BizHawk.Client.EmuHawk
{
if (_stateSlots.HasSlot(slot))
{
LoadQuickSave("QuickSave" + slot);
LoadQuickSave($"QuickSave{slot}");
}
}
else if (e.Button == MouseButtons.Right)
{
SaveQuickSave("QuickSave" + slot);
SaveQuickSave($"QuickSave{slot}");
}
}
@ -3138,7 +3130,7 @@ namespace BizHawk.Client.EmuHawk
{
GlobalWin.Sound.StopSound();
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);
GlobalWin.Sound.StartSound();
@ -3273,7 +3265,7 @@ namespace BizHawk.Client.EmuHawk
}
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();
break;
case "Quick Load":
LoadQuickSave("QuickSave" + Global.Config.SaveSlot);
LoadQuickSave($"QuickSave{Global.Config.SaveSlot}");
break;
case "Quick Save":
SaveQuickSave("QuickSave" + Global.Config.SaveSlot);
SaveQuickSave($"QuickSave{Global.Config.SaveSlot}");
break;
case "Clear Autohold":
ClearAutohold();
@ -126,7 +126,7 @@ namespace BizHawk.Client.EmuHawk
break;
case "Toggle Skip Lag Frame":
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;
case "Toggle Key Priority":
ToggleKeyPriority();
@ -348,7 +348,7 @@ namespace BizHawk.Client.EmuHawk
}
Global.CheatList.ToList().ForEach(x => x.Toggle());
GlobalWin.OSD.AddMessage("Cheats toggled" + type);
GlobalWin.OSD.AddMessage($"Cheats toggled{type}");
}
break;
@ -642,7 +642,7 @@ namespace BizHawk.Client.EmuHawk
var s = ((Gameboy)Emulator).GetSettings();
s.DisplayBG ^= true;
((Gameboy)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage("BG toggled " + (s.DisplayBG ? "on" : "off"));
GlobalWin.OSD.AddMessage($"BG toggled {(s.DisplayBG ? "on" : "off")}");
}
break;
@ -652,7 +652,7 @@ namespace BizHawk.Client.EmuHawk
var s = ((Gameboy)Emulator).GetSettings();
s.DisplayOBJ ^= true;
((Gameboy)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage("OBJ toggled " + (s.DisplayBG ? "on" : "off"));
GlobalWin.OSD.AddMessage($"OBJ toggled {(s.DisplayBG ? "on" : "off")}");
}
break;

View File

@ -279,7 +279,7 @@ namespace BizHawk.Client.EmuHawk
LoadRom(argParser.cmdRom, new LoadRomArgs { OpenAdvanced = ioa });
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)
@ -370,11 +370,11 @@ namespace BizHawk.Client.EmuHawk
}
else if (argParser.cmdLoadSlot != null)
{
LoadQuickSave("QuickSave" + argParser.cmdLoadSlot);
LoadQuickSave($"QuickSave{argParser.cmdLoadSlot}");
}
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()
{
string fmt = "{0}.{1:yyyy-MM-dd HH.mm.ss}{2}.png";
string prefix = PathManager.ScreenshotPrefix(Global.Game);
var ts = DateTime.Now;
var basename = $"{PathManager.ScreenshotPrefix(Global.Game)}.{DateTime.Now:yyyy-MM-dd HH.mm.ss}";
string fnameBare = string.Format(fmt, prefix, ts, "");
string fname = string.Format(fmt, prefix, ts, " (0)");
var fnameBare = $"{basename}.png";
var fname = $"{basename} (0).png";
// if the (0) filename exists, do nothing. we'll bump up the number later
// if the bare filename exists, move it to (0)
// otherwise, no related filename exists, and we can proceed with the bare filename
if (File.Exists(fname))
if (!File.Exists(fname))
{
}
else if (File.Exists(fnameBare))
{
File.Move(fnameBare, fname);
}
else
{
fname = fnameBare;
if (File.Exists(fnameBare)) File.Move(fnameBare, fname);
else fname = fnameBare;
}
int seq = 0;
while (File.Exists(fname))
{
var sequence = $" ({seq++})";
fname = string.Format(fmt, prefix, ts, sequence);
}
for (var seq = 0; File.Exists(fname); seq++)
fname = $"{basename} ({seq}).png";
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));
*/
GlobalWin.OSD.AddMessage(fi.Name + " saved.");
GlobalWin.OSD.AddMessage($"{fi.Name} saved.");
}
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
Size = new Size(lastComputedSize.Width + borderWidth, lastComputedSize.Height + borderHeight);
@ -1176,7 +1164,7 @@ namespace BizHawk.Client.EmuHawk
public void FrameSkipMessage()
{
GlobalWin.OSD.AddMessage("Frameskipping set to " + Global.Config.FrameSkip);
GlobalWin.OSD.AddMessage($"Frameskipping set to {Global.Config.FrameSkip}");
}
public void UpdateCheatStatus()
@ -1253,7 +1241,7 @@ namespace BizHawk.Client.EmuHawk
((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)
@ -1289,7 +1277,7 @@ namespace BizHawk.Client.EmuHawk
}
((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)
{
@ -1311,7 +1299,7 @@ namespace BizHawk.Client.EmuHawk
}
((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))
{
str += VersionInfo.CustomBuildString + " ";
str += $"{VersionInfo.CustomBuildString} ";
}
str += Emulator.IsNull() ? "BizHawk" : Global.SystemInfo.DisplayName;
@ -1460,11 +1448,11 @@ namespace BizHawk.Client.EmuHawk
if (!Emulator.IsNull())
{
str += " - " + Global.Game.Name;
str += $" - {Global.Game.Name}";
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);
}
var file = new FileInfo(path);
var newPath = path + ".new";
var newPath = $"{path}.new";
var newFile = new FileInfo(newPath);
var backupPath = path + ".bak";
var backupPath = $"{path}.bak";
var backupFile = new FileInfo(backupPath);
if (file.Directory != null && !file.Directory.Exists)
{
@ -1647,7 +1635,7 @@ namespace BizHawk.Client.EmuHawk
}
catch
{
GlobalWin.OSD.AddMessage("Unable to flush SaveRAM to: " + newFile.Directory);
GlobalWin.OSD.AddMessage($"Unable to flush SaveRAM to: {newFile.Directory}");
return false;
}
}
@ -1909,13 +1897,13 @@ namespace BizHawk.Client.EmuHawk
{
PauseStatusButton.Image = Properties.Resources.Lightning;
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)
{
PauseStatusButton.Image = Properties.Resources.YellowRight;
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)
{
@ -1967,14 +1955,14 @@ namespace BizHawk.Client.EmuHawk
{
Global.Config.SpeedPercentAlternate = value;
SyncThrottle();
GlobalWin.OSD.AddMessage("Alternate Speed: " + value + "%");
GlobalWin.OSD.AddMessage($"Alternate Speed: {value}%");
}
private void SetSpeedPercent(int value)
{
Global.Config.SpeedPercent = value;
SyncThrottle();
GlobalWin.OSD.AddMessage("Speed: " + value + "%");
GlobalWin.OSD.AddMessage($"Speed: {value}%");
}
private void Shutdown()
@ -2328,7 +2316,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.SoundVolume = 100;
}
GlobalWin.OSD.AddMessage("Volume " + Global.Config.SoundVolume);
GlobalWin.OSD.AddMessage($"Volume {Global.Config.SoundVolume}");
}
private static void VolumeDown()
@ -2339,7 +2327,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.SoundVolume = 0;
}
GlobalWin.OSD.AddMessage("Volume " + Global.Config.SoundVolume);
GlobalWin.OSD.AddMessage($"Volume {Global.Config.SoundVolume}");
}
private void SoftReset()
@ -2438,7 +2426,7 @@ namespace BizHawk.Client.EmuHawk
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();
}
@ -2465,7 +2453,7 @@ namespace BizHawk.Client.EmuHawk
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();
}
@ -2624,7 +2612,7 @@ namespace BizHawk.Client.EmuHawk
if (Global.MovieSession.Movie.IsActive)
{
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
: _linkCableOff;
LinkConnectStatusBarButton.ToolTipText = Emulator.AsLinkable().LinkConnected
? "Link connection is currently enabled"
: "Link connection is currently disabled";
LinkConnectStatusBarButton.ToolTipText = $"Link connection is currently {(Emulator.AsLinkable().LinkConnected ? "enabled" : "disabled")}";
}
else
{
@ -2701,21 +2687,18 @@ namespace BizHawk.Client.EmuHawk
private static void ToggleModePokeMode()
{
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()
{
Global.Config.AcceptBackgroundInput ^= true;
GlobalWin.OSD.AddMessage(Global.Config.AcceptBackgroundInput
? "Background Input enabled"
: "Background Input disabled");
GlobalWin.OSD.AddMessage($"Background Input {(Global.Config.AcceptBackgroundInput ? "enabled" : "disabled")}");
}
private static void VsyncMessage()
{
GlobalWin.OSD.AddMessage(
"Display Vsync set to " + (Global.Config.VSync ? "on" : "off"));
GlobalWin.OSD.AddMessage($"Display Vsync set to {(Global.Config.VSync ? "on" : "off")}");
}
private static bool StateErrorAskUser(string title, string message)
@ -3276,7 +3259,7 @@ namespace BizHawk.Client.EmuHawk
var sfd = new SaveFileDialog();
if (Global.Game != null)
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + "." + ext; // dont use Path.ChangeExtension, it might wreck game names with dots in them
sfd.FileName = $"{PathManager.FilesystemSafeName(Global.Game)}.{ext}"; // dont use Path.ChangeExtension, it might wreck game names with dots in them
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null);
}
else
@ -3465,7 +3448,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception e)
{
MessageBox.Show("Video dumping died:\n\n" + e);
MessageBox.Show($"Video dumping died:\n\n{e}");
AbortAv();
}
@ -3531,7 +3514,7 @@ namespace BizHawk.Client.EmuHawk
string title = "load error";
if (e.AttemptedCoreLoad != null)
{
title = e.AttemptedCoreLoad + " load error";
title = $"{e.AttemptedCoreLoad} load error";
}
MessageBox.Show(this, e.Message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
@ -3682,7 +3665,7 @@ namespace BizHawk.Client.EmuHawk
if (result)
{
string loaderName = "*" + OpenAdvancedSerializer.Serialize(ioa);
string loaderName = $"*{OpenAdvancedSerializer.Serialize(ioa)}";
Emulator = loader.LoadedEmulator;
Global.Game = loader.Game;
CoreFileProvider.SyncCoreCommInputSignals(nextComm);
@ -3714,8 +3697,8 @@ namespace BizHawk.Client.EmuHawk
else
{
xSw.WriteLine(xmlGame.Assets[xg].Key);
xSw.WriteLine("SHA1:" + xmlGame.Assets[xg].Value.HashSHA1());
xSw.WriteLine("MD5:" + xmlGame.Assets[xg].Value.HashMD5());
xSw.WriteLine($"SHA1:{xmlGame.Assets[xg].Value.HashSHA1()}");
xSw.WriteLine($"MD5:{xmlGame.Assets[xg].Value.HashMD5()}");
xSw.WriteLine();
}
}
@ -3829,7 +3812,7 @@ namespace BizHawk.Client.EmuHawk
ToolFormBase.UpdateCheatRelatedTools(null, null);
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)
@ -3971,7 +3954,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.Restart();
ApiManager.Restart(Emulator.ServiceProvider);
RewireSound();
Text = "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : "");
Text = $"BizHawk{(VersionInfo.DeveloperBuild ? " (interim) " : "")}";
HandlePlatformMenus();
_stateSlots.Clear();
UpdateDumpIcon();
@ -3999,7 +3982,7 @@ namespace BizHawk.Client.EmuHawk
public void EnableRewind(bool enabled)
{
Global.Rewinder.SuspendRewind = !enabled;
GlobalWin.OSD.AddMessage("Rewind " + (enabled ? "enabled" : "suspended"));
GlobalWin.OSD.AddMessage($"Rewind {(enabled ? "enabled" : "suspended")}");
}
public void ClearRewindData()
@ -4079,7 +4062,7 @@ namespace BizHawk.Client.EmuHawk
if (!supressOSD)
{
GlobalWin.OSD.AddMessage("Loaded state: " + userFriendlyStateName);
GlobalWin.OSD.AddMessage($"Loaded state: {userFriendlyStateName}");
}
}
else
@ -4110,10 +4093,10 @@ namespace BizHawk.Client.EmuHawk
return;
}
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State";
var path = $"{PathManager.SaveStatePrefix(Global.Game)}.{quickSlotName}.State";
if (!File.Exists(path))
{
GlobalWin.OSD.AddMessage("Unable to load " + quickSlotName + ".State");
GlobalWin.OSD.AddMessage($"Unable to load {quickSlotName}.State");
return;
}
@ -4140,11 +4123,11 @@ namespace BizHawk.Client.EmuHawk
ClientApi.OnStateSaved(this, userFriendlyStateName);
GlobalWin.OSD.AddMessage("Saved state: " + userFriendlyStateName);
GlobalWin.OSD.AddMessage($"Saved state: {userFriendlyStateName}");
}
catch (IOException)
{
GlobalWin.OSD.AddMessage("Unable to save state " + path);
GlobalWin.OSD.AddMessage($"Unable to save state {path}");
}
if (!fromLua)
@ -4174,7 +4157,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
var path = PathManager.SaveStatePrefix(Global.Game) + "." + quickSlotName + ".State";
var path = $"{PathManager.SaveStatePrefix(Global.Game)}.{quickSlotName}.State";
var file = new FileInfo(path);
if (file.Directory != null && !file.Directory.Exists)
@ -4185,7 +4168,7 @@ namespace BizHawk.Client.EmuHawk
// Make backup first
if (Global.Config.BackupSavestates)
{
Util.TryMoveBackupFile(path, path + ".bak");
Util.TryMoveBackupFile(path, $"{path}.bak");
}
SaveState(path, quickSlotName, false);
@ -4230,7 +4213,7 @@ namespace BizHawk.Client.EmuHawk
DefaultExt = "State",
Filter = "Save States (*.State)|*.State|All Files|*.*",
InitialDirectory = path,
FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State"
FileName = $"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave0.State"
};
var result = sfd.ShowHawkDialog();

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
{
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
{
RomSizeLabel.Text = string.Format("{0:n0}", (RomGame.RomData.Length / 1024 / 1024)) + "mb";
RomSizeLabel.Text = $"{RomGame.RomData.Length / 1024 / 1024:n0}mb";
}
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();

View File

@ -125,7 +125,7 @@ namespace BizHawk.Client.EmuHawk
{
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)",
"Fatal error: " + e.GetType().Name,
$"Fatal error: {e.GetType().Name}",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation
);
@ -173,7 +173,7 @@ namespace BizHawk.Client.EmuHawk
{
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)",
"Fatal error: " + e.GetType().Name,
$"Fatal error: {e.GetType().Name}",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation
);
@ -350,7 +350,7 @@ namespace BizHawk.Client.EmuHawk
public static void RemoveMOTW(string path)
{
DeleteFileW(path + ":Zone.Identifier");
DeleteFileW($"{path}:Zone.Identifier");
}
static void WhackAllMOTW(string dllDir)
@ -410,7 +410,7 @@ namespace BizHawk.Client.EmuHawk
return asm;
//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 simpleName = new AssemblyName(requested).Name;
if (simpleName == "NLua" || simpleName == "KopiLua") directory = Path.Combine(directory, "nlua");

View File

@ -167,7 +167,7 @@ namespace BizHawk.Client.EmuHawk
if (extraSampleCount < -maxSamplesDeficit)
{
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++)
{
_buffer.Enqueue(0);
@ -177,7 +177,7 @@ namespace BizHawk.Client.EmuHawk
else if (extraSampleCount > maxSamplesSurplus)
{
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++)
{
_buffer.Dequeue();

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
//notably, if we're frame-advancing, we should be paused.
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;
framesSkipped = 0;
framesToSkip = 0;
@ -198,12 +198,12 @@ namespace BizHawk.Client.EmuHawk
int pct = -1;
public void SetSpeedPercent(int percent)
{
//Console.WriteLine("throttle set percent " + percent);
//Console.WriteLine($"throttle set percent {percent}");
if (pct == percent) return;
pct = percent;
float fraction = percent / 100.0f;
desiredfps = (ulong)(core_desiredfps * fraction);
//Console.WriteLine("throttle set desiredfps " + desiredfps);
//Console.WriteLine($"throttle set desiredfps {desiredfps}");
desiredspf = 65536.0f / desiredfps;
AutoFrameSkip_IgnorePreviousDelay();
}

View File

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

View File

@ -126,7 +126,7 @@ namespace BizHawk.Client.EmuHawk
int i;
for (i = MaxPlayers; i > 0; i--)
{
if (button.StartsWith("P" + i))
if (button.StartsWith($"P{i}"))
{
break;
}
@ -162,7 +162,7 @@ namespace BizHawk.Client.EmuHawk
{
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[pageidx].Controls.Add(createpanel(settings, buckets[i], tt.Size));
pageidx++;
@ -362,7 +362,7 @@ namespace BizHawk.Client.EmuHawk
private void NewControllerConfig_Load(object sender, EventArgs e)
{
Text = _theDefinition.Name + " Configuration";
Text = $"{_theDefinition.Name} Configuration";
}
private static TabControl GetTabControl(IEnumerable controls)

View File

@ -66,13 +66,13 @@ namespace BizHawk.Client.EmuHawk
private void TrackBarSensitivity_ValueChanged(object sender, EventArgs e)
{
_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)
{
_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)

View File

@ -270,7 +270,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.TargetScanlineFilterIntensity = tbScanlineIntensity.Value;
int scanlines = Global.Config.TargetScanlineFilterIntensity;
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)

View File

@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
}
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();
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 = "";
}
}
@ -443,7 +443,7 @@ namespace BizHawk.Client.EmuHawk
}
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;
}
}
@ -456,7 +456,7 @@ namespace BizHawk.Client.EmuHawk
}
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;
}
@ -526,7 +526,7 @@ namespace BizHawk.Client.EmuHawk
}
olvi.SubItems[0].Text = ff.Size.ToString();
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[2].Text = ff.RecommendedName;
olvi.SubItems[2].Font = this.Font; // why doesnt this work?
@ -648,7 +648,7 @@ namespace BizHawk.Client.EmuHawk
if (hf.IsArchive)
{
// blech. the worst extraction code in the universe.
string extractpath = Path.GetTempFileName() + ".dir";
string extractpath = $"{Path.GetTempFileName()}.dir";
DirectoryInfo di = Directory.CreateDirectory(extractpath);
try

View File

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

View File

@ -353,7 +353,7 @@ namespace BizHawk.Client.EmuHawk
using (var sfd = new SaveFileDialog())
{
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.RestoreDirectory = true;

View File

@ -38,13 +38,13 @@ namespace BizHawk.Client.EmuHawk
public void RefreshTooltip()
{
string widgetText = "Current Binding: " + widget.Text;
string widgetText = $"Current Binding: {widget.Text}";
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);
}

View File

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

View File

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

View File

@ -533,9 +533,7 @@ namespace BizHawk.Client.EmuHawk
VideoResolutionXTextBox.Text = _s.VideoSizeX.ToString();
VideoResolutionYTextBox.Text = _s.VideoSizeY.ToString();
var videoSetting = _s.VideoSizeX
+ " x "
+ _s.VideoSizeY;
var videoSetting = $"{_s.VideoSizeX} x {_s.VideoSizeY}";
var index = VideoResolutionComboBox.Items.IndexOf(videoSetting);
if (index >= 0)
@ -605,7 +603,7 @@ namespace BizHawk.Client.EmuHawk
RiceColorQuality_Combo.SelectedIndex = _ss.RicePlugin.ColorQuality;
RiceOpenGLRenderSetting_Combo.SelectedIndex = _ss.RicePlugin.OpenGLRenderSetting;
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;
@ -854,7 +852,7 @@ namespace BizHawk.Client.EmuHawk
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)

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
{
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();
}
else
@ -94,10 +94,10 @@ namespace BizHawk.Client.EmuHawk
if (num >= 1024)
{
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()
@ -344,8 +344,8 @@ namespace BizHawk.Client.EmuHawk
double minutes = estTotalFrames / 60 / 60;
AverageStoredStateSizeLabel.Text = FormatKB(avgStateSize);
ApproxFramesLabel.Text = $"{estFrames:n0}" + " frames";
EstTimeLabel.Text = $"{minutes:n}" + " minutes";
ApproxFramesLabel.Text = $"{estFrames:n0} frames";
EstTimeLabel.Text = $"{minutes:n} minutes";
}
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)
{
var c = SubGrid.Rows[row].Cells[column];
var error = "Unable to parse value: " + c.Value;
var caption = "Parse Error Row " + row + " Column " + column;
var error = $"Unable to parse value: {c.Value}";
var caption = $"Parse Error Row {row} Column {column}";
MessageBox.Show(error, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
@ -104,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
c = SubGrid.Rows[x].Cells[3];
c.Value = s.Duration;
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 = SubGrid.Rows[x].Cells[5];
c.Value = s.Message;
@ -127,7 +127,7 @@ namespace BizHawk.Client.EmuHawk
c = SubGrid.Rows[index].Cells[3];
c.Value = s.Duration;
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 = SubGrid.Rows[index].Cells[5];
c.Value = s.Message;
@ -229,9 +229,7 @@ namespace BizHawk.Client.EmuHawk
File.WriteAllText(fileName, str);
// Display success
MessageBox.Show(
string.Format("Subtitles succesfully exported to {0}.", fileName),
"Success");
MessageBox.Show($"Subtitles succesfully exported to {fileName}.", "Success");
}
private void SubGrid_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)

View File

@ -154,8 +154,7 @@ namespace BizHawk.Client.EmuHawk
private void UpdateList()
{
MovieView.Refresh();
MovieCount.Text = _movieList.Count + " movie"
+ (_movieList.Count != 1 ? "s" : "");
MovieCount.Text = $"{_movieList.Count} {(_movieList.Count == 1 ? "movie" : "movies")}";
}
private void PreHighlightMovie()
@ -193,7 +192,7 @@ namespace BizHawk.Client.EmuHawk
{
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);
}
@ -266,8 +265,8 @@ namespace BizHawk.Client.EmuHawk
}
// add movies
fpTodo.AddRange(Directory.GetFiles(dp, "*." + MovieService.DefaultExtension));
fpTodo.AddRange(Directory.GetFiles(dp, "*." + TasMovie.Extension));
fpTodo.AddRange(Directory.GetFiles(dp, $"*.{MovieService.DefaultExtension}"));
fpTodo.AddRange(Directory.GetFiles(dp, $"*.{TasMovie.Extension}"));
}
// in parallel, scan each movie
@ -419,7 +418,7 @@ namespace BizHawk.Client.EmuHawk
if (kvp.Value != Global.Game.Hash)
{
item.BackColor = Color.Pink;
toolTip1.SetToolTip(DetailsView, "Current SHA1: " + Global.Game.Hash);
toolTip1.SetToolTip(DetailsView, $"Current SHA1: {Global.Game.Hash}");
}
break;
case HeaderKeys.EMULATIONVERSION:
@ -447,7 +446,7 @@ namespace BizHawk.Client.EmuHawk
}
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);
var FramesItem = new ListViewItem("Frames");
@ -576,9 +575,7 @@ namespace BizHawk.Client.EmuHawk
{
var ofd = new OpenFileDialog
{
Filter = "Movie Files (*." + MovieService.DefaultExtension + ")|*." + MovieService.DefaultExtension +
"|TAS project Files (*." + TasMovie.Extension + ")|*." + TasMovie.Extension +
"|All Files|*.*",
Filter = $"Movie Files (*.{MovieService.DefaultExtension})|*.{MovieService.DefaultExtension}|TAS project Files (*.{TasMovie.Extension})|*.{TasMovie.Extension}|All Files|*.*",
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 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);
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)
{
return;
@ -180,10 +180,10 @@ namespace BizHawk.Client.EmuHawk
var sfd = new SaveFileDialog
{
InitialDirectory = movieFolderPath,
DefaultExt = "." + Global.MovieSession.Movie.PreferredExtension,
DefaultExt = $".{Global.MovieSession.Movie.PreferredExtension}",
FileName = RecordBox.Text,
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();

View File

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

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
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)

View File

@ -81,12 +81,12 @@ namespace BizHawk.Client.EmuHawk
void OnLoadError(object sender, RomLoader.RomErrorArgs e)
{
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)
{
current.Messages.Add(string.Format("CommMessage: {0}", msg));
current.Messages.Add($"CommMessage: {msg}");
}
int? ChooseArchive(HawkFile hf)

View File

@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk
_currentFilename = fname;
if (_currentFilename == null)
Text = "Code Data Logger";
else Text = string.Format("Code Data Logger - {0}", fname);
else Text = $"Code Data Logger - {fname}";
}
[RequiredService]
@ -147,29 +147,29 @@ namespace BizHawk.Client.EmuHawk
long addr = bm[kvp.Key];
var lvi = listContents[idx++] = new string[13];
lvi[0] = string.Format("{0:X8}", addr);
lvi[0] = $"{addr:X8}";
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)
lvi[3] = string.Format("{0:0.00}", total / 1024.0f);
lvi[3] = $"{total / 1024.0f:0.00}";
else
lvi[3] = string.Format("{0}", total);
lvi[3] = $"{total}";
if (tsbViewStyle.SelectedIndex == 2)
{
int n = (int)(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
lvi[4] = string.Format("of {0} Bytes", kvp.Value.Length);
lvi[4] = $"of {kvp.Value.Length} Bytes";
for (int i = 0; i < 8; i++)
{
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)
lvi[5 + i] = string.Format("{0}", totals[i]);
lvi[5 + i] = $"{totals[i]}";
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
{
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_path = Path.Combine(autoresume_dir, autoresume_file);
if (File.Exists(autoresume_path))

View File

@ -349,7 +349,7 @@ namespace BizHawk.Client.EmuHawk
}
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;
}
}

View File

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

View File

@ -75,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
{
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)
{
@ -206,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
blob.AppendLine();
}
blob.Append(string.Format("{0:X" + _pcRegisterSize + "}", _disassemblyLines[index].Address))
blob.Append(string.Format($"{{0:X{_pcRegisterSize}}}", _disassemblyLines[index].Address))
.Append(" ")
.Append(_disassemblyLines[index].Mnemonic);
}

View File

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

View File

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

View File

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

View File

@ -311,9 +311,9 @@ namespace BizHawk.Client.EmuHawk
int cmp = 0;
parseString = SingleCheat.Replace("-", "");
GBGGDecode(parseString, ref val, ref add, ref cmp);
RAMAddress = string.Format("{0:X4}", add);
RAMValue = string.Format("{0:X2}", val);
RAMCompare = string.Format("{0:X2}", cmp);
RAMAddress = $"{add:X4}";
RAMValue = $"{val:X2}";
RAMCompare = $"{cmp:X2}";
}
//Game Genie
else if (SingleCheat.Contains("-") == true && SingleCheat.LastIndexOf("-") != 7 && SingleCheat.IndexOf("-") != 3)
@ -382,7 +382,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world?
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
@ -457,8 +457,8 @@ namespace BizHawk.Client.EmuHawk
//op1 has the Address
//op2 has the Value
//Sum, is pointless?
RAMAddress = string.Format("{0:X8}", op1);
RAMValue = string.Format("{0:X8}", op2);
RAMAddress = $"{op1:X8}";
RAMValue = $"{op2:X8}";
GBAGameShark();
}
//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
//op2 has the Value
//Sum, is pointless?
RAMAddress = string.Format("{0:X8}", op1);
RAMValue = string.Format("{0:X8}", op2);
RAMAddress = $"{op1:X8}";
RAMValue = $"{op2:X8}";
blnEncrypted = true;
GBAActionReplay();
}
@ -560,9 +560,9 @@ namespace BizHawk.Client.EmuHawk
// //op1 has the Address
// //op2 has the Value
// //Sum, is pointless?
// RAMAddress = string.Format("{0:X8}", op1);
// RAMAddress = $"{op1:X8}";
// //RAMAddress = RAMAddress.Remove(0, 1);
// RAMValue = string.Format("{0:X8}", op2);
// RAMValue = $"{op2:X8}";
// // && RAMAddress[6] == '0'
//}
@ -2052,12 +2052,12 @@ namespace BizHawk.Client.EmuHawk
string RealAddress = null;
string realValue = null;
RealAddress = RAMValue.Remove(0, 1);
//MessageBox.Show("Real Address: " + RealAddress);
//MessageBox.Show($"Real Address: {RealAddress}");
//We need the next line
try
{
loopValue += 1;
//MessageBox.Show("Loop Value: " + loopValue.ToString());
//MessageBox.Show($"Loop Value: {loopValue}");
SingleCheat = txtCheat.Lines[loopValue].ToUpper();
//We need to parse now.
if (SingleCheat.Length == 17 && SingleCheat.IndexOf(" ") == 8)
@ -2087,8 +2087,8 @@ namespace BizHawk.Client.EmuHawk
//op1 has the Address
//op2 has the Value
//Sum, is pointless?
RAMAddress = string.Format("{0:X8}", op1);
RAMValue = string.Format("{0:X8}", op2);
RAMAddress = $"{op1:X8}";
RAMValue = $"{op2:X8}";
}
else if (blnEncrypted == false)
{
@ -2134,7 +2134,7 @@ namespace BizHawk.Client.EmuHawk
catch (Exception ex)
{
//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)
@ -2563,7 +2563,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world?
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?
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()
@ -2734,9 +2734,9 @@ namespace BizHawk.Client.EmuHawk
_NESgameGenieTable.TryGetValue(code[5], out x);
Address |= (x & 0x07) << 8;
Value |= x & 0x08;
RAMAddress = string.Format("{0:X4}", Address);
RAMValue = string.Format("{0:X2}", Value);
strCompare = string.Format("{0:X2}", Compare);
RAMAddress = $"{Address:X4}";
RAMValue = $"{Value:X2}";
strCompare = $"{Compare:X2}";
}
else if (SingleCheat.Length == 8)
{
@ -2778,9 +2778,9 @@ namespace BizHawk.Client.EmuHawk
_NESgameGenieTable.TryGetValue(code[7], out x);
Compare |= (x & 0x07) << 4;
Value |= x & 0x08;
RAMAddress = string.Format("{0:X4}", Address);
RAMValue = string.Format("{0:X2}", Value);
strCompare = string.Format("{0:X2}", Compare);
RAMAddress = $"{Address:X4}";
RAMValue = $"{Value:X2}";
strCompare = $"{Compare:X2}";
}
}
if (SingleCheat.Length != 6 && SingleCheat.Length != 8)
@ -2816,7 +2816,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world?
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()
@ -2927,7 +2927,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world?
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?
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.
@ -3018,9 +3018,9 @@ namespace BizHawk.Client.EmuHawk
int cmp = 0;
parseString = SingleCheat.Replace("-", "");
GBGGDecode(parseString, ref val, ref add, ref cmp);
RAMAddress = string.Format("{0:X4}", add);
RAMValue = string.Format("{0:X2}", val);
RAMCompare = string.Format("{0:X2}", cmp);
RAMAddress = $"{add:X4}";
RAMValue = $"{val:X2}";
RAMCompare = $"{cmp:X2}";
}
//Action Replay
else if (SingleCheat.IndexOf("-") == 3 && SingleCheat.Length == 9)
@ -3063,7 +3063,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world?
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
@ -3142,8 +3142,8 @@ namespace BizHawk.Client.EmuHawk
//We have to remove the - since it will cause issues later on.
input = SingleCheat.Replace("-", "");
SnesGGDecode(input, ref val, ref add);
RAMAddress = string.Format("{0:X6}", add);
RAMValue = string.Format("{0:X2}", val);
RAMAddress = $"{add:X6}";
RAMValue = $"{val:X2}";
//We trim the first value here to make it work.
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.
@ -3203,7 +3203,7 @@ namespace BizHawk.Client.EmuHawk
//Someone broke the world?
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)

View File

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

View File

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

View File

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

View File

@ -55,7 +55,7 @@ namespace BizHawk.Client.EmuHawk
[LuaMethod("socketServerSend", "sends a string to the Socket server")]
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")]
public string SocketServerResponse()

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
{
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)
{
GlobalWin.MainForm.SaveQuickSave("QuickSave" + slotNum);
GlobalWin.MainForm.SaveQuickSave($"QuickSave{slotNum}");
}
}
}

View File

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

View File

@ -194,7 +194,7 @@ namespace BizHawk.Client.EmuHawk
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)
{
@ -254,7 +254,7 @@ namespace BizHawk.Client.EmuHawk
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
{
RefreshScriptMenuItem_Click(null, null);
@ -451,15 +451,15 @@ namespace BizHawk.Client.EmuHawk
if (total == 1)
{
message += total + " script (" + active + " active, " + paused + " paused)";
message += $"{total} script ({active} active, {paused} paused)";
}
else if (total == 0)
{
message += total + " scripts";
message += $"{total} scripts";
}
else
{
message += total + " scripts (" + active + " active, " + paused + " paused)";
message += $"{total} scripts ({active} active, {paused} paused)";
}
NumberOfScripts.Text = message;
@ -636,7 +636,7 @@ namespace BizHawk.Client.EmuHawk
if (file != null)
{
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();
}
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)
{
ConsoleLog("Unable to access file " + item.Path);
ConsoleLog($"Unable to access file {item.Path}");
}
catch (Exception ex)
{
@ -973,7 +973,7 @@ namespace BizHawk.Client.EmuHawk
{
InitialDirectory = Path.GetDirectoryName(script.Path),
DefaultExt = ".lua",
FileName = Path.GetFileNameWithoutExtension(script.Path) + " (1)",
FileName = $"{Path.GetFileNameWithoutExtension(script.Path)} (1)",
OverwritePrompt = true,
Filter = "Lua Scripts (*.lua)|*.lua|All Files (*.*)|*.*"
};

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
if (!string.IsNullOrWhiteSpace(FilterBox.Text))
{
_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();
}
else

View File

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

View File

@ -57,7 +57,7 @@ namespace BizHawk.Client.EmuHawk
};
_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!]";
SetUpButtonBoxes();
@ -150,9 +150,9 @@ namespace BizHawk.Client.EmuHawk
}
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);
ZonesList.Items.Add(newZone.Name + " - length: " + newZone.Length);
ZonesList.Items.Add($"{newZone.Name} - length: {newZone.Length}");
_unsavedZones.Add(ZonesList.Items.Count - 1);
}
@ -193,7 +193,7 @@ namespace BizHawk.Client.EmuHawk
}
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)
@ -266,7 +266,7 @@ namespace BizHawk.Client.EmuHawk
if (loadZone != null)
{
_zones.Add(loadZone);
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");
// Options only for TasMovie
if (!(CurrentMovie is TasMovie))
@ -288,7 +288,7 @@ namespace BizHawk.Client.EmuHawk
{
MovieZone loadZone = new MovieZone(path);
_zones.Add(loadZone);
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");
}
private static string SuggestedFolder()

View File

@ -129,7 +129,7 @@ namespace BizHawk.Client.EmuHawk
{
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)
@ -203,7 +203,7 @@ namespace BizHawk.Client.EmuHawk
header[0] = InputKey;
header[1] = Global.Emulator.ControllerDefinition.Name;
header[2] = Global.Emulator.ControllerDefinition.PlayerCount.ToString();
header[3] = Overlay.ToString() + "," + Replace.ToString();
header[3] = $"{Overlay},{Replace}";
File.WriteAllLines(fileName, header);
File.AppendAllLines(fileName, _log);
@ -232,8 +232,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!emuKeys.Contains(macroKeys[i]))
{
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");
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");
return;
}
}

View File

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

View File

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

View File

@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
{
int tone = 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
@ -471,7 +471,7 @@ namespace BizHawk.Client.EmuHawk
void SyncContents()
{
lblContents.Text = string.Format("{0} Rows", Log.Count);
lblContents.Text = $"{Log.Count} Rows";
}
private void btnControl_Click(object sender, EventArgs e)

View File

@ -312,11 +312,11 @@ namespace BizHawk.Client.EmuHawk
TileY = e.Y / 16;
}
XYLabel.Text = TileX + " : " + TileY;
XYLabel.Text = $"{TileX} : {TileY}";
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);
TileIDLabel.Text = string.Format("{0:X2}", TileID);
TileIDLabel.Text = $"{TileID:X2}";
TableLabel.Text = NameTable.ToString();
int ytable = 0, yline = 0;

View File

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

View File

@ -71,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
{
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"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true

View File

@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
{
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"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true

View File

@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
{
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"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true

View File

@ -44,7 +44,7 @@ namespace BizHawk.Client.EmuHawk
{
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"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true

View File

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

View File

@ -190,7 +190,7 @@ namespace BizHawk.Client.EmuHawk
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))
{
var zip = new ZipOutputStream(stream)
@ -201,7 +201,7 @@ namespace BizHawk.Client.EmuHawk
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);
var ms = new MemoryStream();
var bw = new BinaryWriter(ms);

View File

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

View File

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

View File

@ -226,7 +226,7 @@ namespace BizHawk.Client.EmuHawk
Movie.CurrentBranch = index;
LoadBranch(SelectedBranch);
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();
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)
@ -252,7 +252,7 @@ namespace BizHawk.Client.EmuHawk
Branch();
EditBranchTextPopUp(Movie.CurrentBranch);
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)
@ -292,7 +292,7 @@ namespace BizHawk.Client.EmuHawk
UpdateBranch(SelectedBranch);
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");
_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);
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
{
Text = "Text for branch " + index,
Text = $"Text for branch {index}",
TextInputType = InputPrompt.InputType.Text,
Message = "Enter a message",
InitialValue = branch.UserText

View File

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

View File

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

View File

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

View File

@ -344,7 +344,7 @@ namespace BizHawk.Client.EmuHawk
catch (Exception ex)
{
text = "";
MessageBox.Show("oops\n" + ex);
MessageBox.Show($"oops\n{ex}");
}
}
@ -643,7 +643,7 @@ namespace BizHawk.Client.EmuHawk
}
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);
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
@ -683,7 +683,7 @@ namespace BizHawk.Client.EmuHawk
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;
}
else // Double-click enters float editing mode
@ -694,7 +694,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
CurrentTasMovie.ChangeLog.BeginNewBatch("Float Edit: " + frame);
CurrentTasMovie.ChangeLog.BeginNewBatch($"Float Edit: {frame}");
_floatEditColumn = buttonName;
floatEditRow = frame;
_floatTypedValue = "";
@ -1350,7 +1350,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
_floatTypedValue = "-" + _floatTypedValue;
_floatTypedValue = $"-{_floatTypedValue}";
}
}
else if (e.KeyCode == Keys.Back)

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