diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index 188894bf2c..baa4b327ae 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -260,7 +260,7 @@ namespace BizHawk.Client.Common if (abort) { - throw new Exception("Essential zip section not found: " + lump.ReadName); + throw new Exception($"Essential zip section not found: {lump.ReadName}"); } return false; diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs index d251915264..197ee0e031 100644 --- a/BizHawk.Client.Common/CoreFileProvider.cs +++ b/BizHawk.Client.Common/CoreFileProvider.cs @@ -53,7 +53,7 @@ namespace BizHawk.Client.Common { if (required) { - var fullmsg = $"Couldn't find required firmware \"{sysID}:{firmwareID}\". This is fatal{(msg != null ? ": " + msg : ".")}"; + var fullmsg = $"Couldn't find required firmware \"{sysID}:{firmwareID}\". This is fatal{(msg != null ? $": {msg}" : ".")}"; throw new MissingFirmwareException(fullmsg); } diff --git a/BizHawk.Client.Common/OpenAdvanced.cs b/BizHawk.Client.Common/OpenAdvanced.cs index b26bff967e..2e26601471 100644 --- a/BizHawk.Client.Common/OpenAdvanced.cs +++ b/BizHawk.Client.Common/OpenAdvanced.cs @@ -87,7 +87,7 @@ namespace BizHawk.Client.Common public Token token = new Token(); public string TypeName { get { return "Libretro"; } } - public string DisplayName { get { return string.Format("{0}:{1}", Path.GetFileNameWithoutExtension(token.CorePath), token.Path); } } + public string DisplayName { get { return $"{Path.GetFileNameWithoutExtension(token.CorePath)}:{token.Path}"; } } public string SimplePath { get { return token.Path; } } public void Deserialize(string str) diff --git a/BizHawk.Client.Common/PathManager.cs b/BizHawk.Client.Common/PathManager.cs index 465dacb381..14af64ccbb 100644 --- a/BizHawk.Client.Common/PathManager.cs +++ b/BizHawk.Client.Common/PathManager.cs @@ -34,7 +34,7 @@ namespace BizHawk.Client.Common /// public static string MakeProgramRelativePath(string path) { - return MakeAbsolutePath("%exe%/" + path, null); + return MakeAbsolutePath($"%exe%/{path}", null); } public static string GetDllDirectory() @@ -262,13 +262,13 @@ namespace BizHawk.Client.Common var name = FilesystemSafeName(game); if (Global.MovieSession.Movie.IsActive) { - name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); + name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}"; } var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ?? Global.Config.PathEntries[game.System, "Base"]; - return Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name) + ".SaveRAM"; + return $"{Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name)}.SaveRAM"; } public static string AutoSaveRamPath(GameInfo game) @@ -289,7 +289,7 @@ namespace BizHawk.Client.Common if (Global.MovieSession.Movie.IsActive) { - name = Path.Combine(name, "movie-" + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)); + name = Path.Combine(name, $"movie-{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}"); } var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ?? @@ -337,34 +337,34 @@ namespace BizHawk.Client.Common // Neshawk and Quicknes have incompatible savestates, store the name to keep them separate if (Global.Emulator.SystemId == "NES") { - name += "." + Global.Emulator.Attributes().CoreName; + name += $".{Global.Emulator.Attributes().CoreName}"; } // Gambatte and GBHawk have incompatible savestates, store the name to keep them separate if (Global.Emulator.SystemId == "GB") { - name += "." + Global.Emulator.Attributes().CoreName; + name += $".{Global.Emulator.Attributes().CoreName}"; } if (Global.Emulator is Snes9x) // Keep snes9x savestate away from libsnes, we want to not be too tedious so bsnes names will just have the profile name not the core name { - name += "." + Global.Emulator.Attributes().CoreName; + name += $".{Global.Emulator.Attributes().CoreName}"; } // Bsnes profiles have incompatible savestates so save the profile name if (Global.Emulator is LibsnesCore) { - name += "." + (Global.Emulator as LibsnesCore).CurrentProfile; + name += $".{((LibsnesCore)Global.Emulator).CurrentProfile}"; } if (Global.Emulator.SystemId == "GBA") { - name += "." + Global.Emulator.Attributes().CoreName; + name += $".{Global.Emulator.Attributes().CoreName}"; } if (Global.MovieSession.Movie.IsActive) { - name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); + name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}"; } var pathEntry = Global.Config.PathEntries[game.System, "Savestates"] ?? diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs index e59465c069..fe093b2532 100644 --- a/BizHawk.Client.Common/RomLoader.cs +++ b/BizHawk.Client.Common/RomLoader.cs @@ -219,7 +219,7 @@ namespace BizHawk.Client.Common else if (discMountJob.OUT_ErrorLevel) { - throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log); + throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}"); } else if (disc == null) @@ -428,7 +428,7 @@ namespace BizHawk.Client.Common if (discMountJob.OUT_ErrorLevel) { - throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log); + throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}"); } if (disc == null) @@ -496,7 +496,7 @@ namespace BizHawk.Client.Common if (discMountJob.OUT_ErrorLevel) { - throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log); + throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}"); } var disc = discMountJob.OUT_Disc; @@ -729,7 +729,7 @@ namespace BizHawk.Client.Common if (discMountJob.OUT_ErrorLevel) { - throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log); + throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}"); } if (disc == null) @@ -1171,12 +1171,12 @@ namespace BizHawk.Client.Common // handle exceptions thrown by the new detected systems that bizhawk does not have cores for else if (ex is NoAvailableCoreException) { - DoLoadErrorCallback(ex.Message + "\n\n" + ex, system); + DoLoadErrorCallback($"{ex.Message}\n\n{ex}", system); } else { - DoLoadErrorCallback("A core accepted the rom, but threw an exception while loading it:\n\n" + ex, system); + DoLoadErrorCallback($"A core accepted the rom, but threw an exception while loading it:\n\n{ex}", system); } return false; diff --git a/BizHawk.Client.Common/SaveSlotManager.cs b/BizHawk.Client.Common/SaveSlotManager.cs index 5996ac4a9c..8584312e7e 100644 --- a/BizHawk.Client.Common/SaveSlotManager.cs +++ b/BizHawk.Client.Common/SaveSlotManager.cs @@ -29,8 +29,7 @@ namespace BizHawk.Client.Common for (int i = 0; i < 10; i++) { - var file = new FileInfo( - PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave" + i + ".State"); + var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{i}.State"); if (file.Directory != null && file.Directory.Exists == false) { file.Directory.Create(); @@ -108,8 +107,8 @@ namespace BizHawk.Client.Common { // Takes the .state and .bak files and swaps them var state = new FileInfo(path); - var backup = new FileInfo(path + ".bak"); - var temp = new FileInfo(path + ".bak.tmp"); + var backup = new FileInfo($"{path}.bak"); + var temp = new FileInfo($"{path}.bak.tmp"); if (!state.Exists || !backup.Exists) { @@ -121,9 +120,9 @@ namespace BizHawk.Client.Common temp.Delete(); } - backup.CopyTo(path + ".bak.tmp"); + backup.CopyTo($"{path}.bak.tmp"); backup.Delete(); - state.CopyTo(path + ".bak"); + state.CopyTo($"{path}.bak"); state.Delete(); temp.CopyTo(path); temp.Delete(); diff --git a/BizHawk.Client.Common/XmlGame.cs b/BizHawk.Client.Common/XmlGame.cs index 27022fdc9f..af6d4d6693 100644 --- a/BizHawk.Client.Common/XmlGame.cs +++ b/BizHawk.Client.Common/XmlGame.cs @@ -69,7 +69,7 @@ namespace BizHawk.Client.Common } else { - throw new Exception("Couldn't load XMLGame Asset \"" + filename + "\""); + throw new Exception($"Couldn't load XMLGame Asset \"{filename}\""); } } else @@ -98,7 +98,7 @@ namespace BizHawk.Client.Common } catch { - throw new Exception("Couldn't load XMLGame LoadAsset \"" + filename + "\""); + throw new Exception($"Couldn't load XMLGame LoadAsset \"{filename}\""); } } diff --git a/BizHawk.Client.Common/config/PathEntry.cs b/BizHawk.Client.Common/config/PathEntry.cs index 9b6b710212..3cc3f6d04c 100644 --- a/BizHawk.Client.Common/config/PathEntry.cs +++ b/BizHawk.Client.Common/config/PathEntry.cs @@ -73,8 +73,8 @@ namespace BizHawk.Client.Common } // we don't have anything for the system in question. add a set of stock paths - var systempath = PathManager.RemoveInvalidFileSystemChars(system) + "_INTERIM"; - var systemdisp = system + " (INTERIM)"; + var systempath = $"{PathManager.RemoveInvalidFileSystemChars(system)}_INTERIM"; + var systemdisp = $"{system} (INTERIM)"; Paths.AddRange(new[] { diff --git a/BizHawk.Client.Common/inputAdapters/UDLRController.cs b/BizHawk.Client.Common/inputAdapters/UDLRController.cs index 38222679a3..6f0822d849 100644 --- a/BizHawk.Client.Common/inputAdapters/UDLRController.cs +++ b/BizHawk.Client.Common/inputAdapters/UDLRController.cs @@ -32,7 +32,7 @@ namespace BizHawk.Client.Common } prefix = button.GetPrecedingString("Down"); - string other = prefix + "Up"; + string other = $"{prefix}Up"; if (Source.IsPressed(other)) { if (_unpresses.Contains(button)) @@ -61,7 +61,7 @@ namespace BizHawk.Client.Common } prefix = button.GetPrecedingString("Up"); - string other = prefix + "Down"; + string other = $"{prefix}Down"; if (Source.IsPressed(other)) { if (_unpresses.Contains(button)) @@ -90,7 +90,7 @@ namespace BizHawk.Client.Common } prefix = button.GetPrecedingString("Right"); - string other = prefix + "Left"; + string other = $"{prefix}Left"; if (Source.IsPressed(other)) { if (_unpresses.Contains(button)) @@ -119,7 +119,7 @@ namespace BizHawk.Client.Common } prefix = button.GetPrecedingString("Left"); - string other = prefix + "Right"; + string other = $"{prefix}Right"; if (Source.IsPressed(other)) { if (_unpresses.Contains(button)) diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs index f8d94f10e8..7038915c81 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs @@ -62,10 +62,7 @@ namespace BizHawk.Client.Common } catch (Exception e) { - Log( - "error running function attached by lua function event.onsavestate" + - "\nError message: " + - e.Message); + Log($"error running function attached by lua function event.onsavestate\nError message: {e.Message}"); } } } @@ -84,10 +81,7 @@ namespace BizHawk.Client.Common } catch (Exception e) { - Log( - "error running function attached by lua function event.onloadstate" + - "\nError message: " + - e.Message); + Log($"error running function attached by lua function event.onloadstate\nError message: {e.Message}"); } } } @@ -106,10 +100,7 @@ namespace BizHawk.Client.Common } catch (Exception e) { - Log( - "error running function attached by lua function event.onframestart" + - "\nError message: " + - e.Message); + Log($"error running function attached by lua function event.onframestart\nError message: {e.Message}"); } } } @@ -128,10 +119,7 @@ namespace BizHawk.Client.Common } catch (Exception e) { - Log( - "error running function attached by lua function event.onframeend" + - "\nError message: " + - e.Message); + Log($"error running function attached by lua function event.onframeend\nError message: {e.Message}"); } } } diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs index e5bc81d9be..b80c6ac99f 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs @@ -25,9 +25,9 @@ namespace BizHawk.Client.Common { buttons[button] = adaptor.IsPressed(button); } - else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller) + else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}") { - buttons[button.Substring(3)] = adaptor.IsPressed("P" + controller + " " + button.Substring(3)); + buttons[button.Substring(3)] = adaptor.IsPressed($"P{controller} {button.Substring(3)}"); } } @@ -37,9 +37,9 @@ namespace BizHawk.Client.Common { buttons[button] = adaptor.GetFloat(button); } - else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller) + else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}") { - buttons[button.Substring(3)] = adaptor.GetFloat("P" + controller + " " + button.Substring(3)); + buttons[button.Substring(3)] = adaptor.GetFloat($"P{controller} {button.Substring(3)}"); } } @@ -85,7 +85,7 @@ namespace BizHawk.Client.Common } catch (Exception) { - Log("invalid mnemonic string: " + inputLogEntry); + Log($"invalid mnemonic string: {inputLogEntry}"); } } @@ -125,7 +125,7 @@ namespace BizHawk.Client.Common var toPress = button.ToString(); if (controller.HasValue) { - toPress = "P" + controller + " " + button; + toPress = $"P{controller} {button}"; } if (!invert) @@ -180,7 +180,7 @@ namespace BizHawk.Client.Common } else { - Global.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue); + Global.StickyXORAdapter.SetFloat($"P{controller} {name}", theValue); } } } diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs index 4131788a70..74e15136fb 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs @@ -149,7 +149,7 @@ namespace BizHawk.Client.Common if (!string.IsNullOrEmpty(filename)) { - filename += "." + Global.MovieSession.Movie.PreferredExtension; + filename += $".{Global.MovieSession.Movie.PreferredExtension}"; var test = new FileInfo(filename); if (test.Exists) { diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.SQL.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.SQL.cs index 5cbc8d2df2..ac03a3c9d4 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.SQL.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.SQL.cs @@ -105,7 +105,7 @@ namespace BizHawk.Client.Common { var table = Lua.NewTable(); m_dbConnection.Open(); - string sql = "PRAGMA read_uncommitted =1;" + query; + string sql = $"PRAGMA read_uncommitted =1;{query}"; SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); SQLiteDataReader reader = command.ExecuteReader(); bool rows = reader.HasRows; @@ -119,7 +119,7 @@ namespace BizHawk.Client.Common { for (int i = 0; i < reader.FieldCount; ++i) { - table[columns[i] + " " + rowCount.ToString()] = reader.GetValue(i); + table[$"{columns[i]} {rowCount}"] = reader.GetValue(i); } rowCount += 1; } diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs index d73936aa17..ba1afd211e 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs @@ -24,7 +24,7 @@ namespace BizHawk.Client.Common var hex = $"{num:X}"; if (hex.Length == 1) { - hex = "0" + hex; + hex = $"0{hex}"; } return hex; @@ -46,7 +46,7 @@ namespace BizHawk.Client.Common var octal = Convert.ToString(num, 8); if (octal.Length == 1) { - octal = "0" + octal; + octal = $"0{octal}"; } return octal; diff --git a/BizHawk.Client.Common/lua/LuaDocumentation.cs b/BizHawk.Client.Common/lua/LuaDocumentation.cs index 2fa7471105..8b6b40737e 100644 --- a/BizHawk.Client.Common/lua/LuaDocumentation.cs +++ b/BizHawk.Client.Common/lua/LuaDocumentation.cs @@ -102,7 +102,7 @@ __Types and notation__ { var completion = new SublimeCompletions.Completion { - Trigger = f.Library + "." + f.Name + Trigger = $"{f.Library}.{f.Name}" }; var sb = new StringBuilder(); diff --git a/BizHawk.Client.Common/lua/LuaLibraryBase.cs b/BizHawk.Client.Common/lua/LuaLibraryBase.cs index bcf0a6845e..797be96ebc 100644 --- a/BizHawk.Client.Common/lua/LuaLibraryBase.cs +++ b/BizHawk.Client.Common/lua/LuaLibraryBase.cs @@ -101,7 +101,7 @@ namespace BizHawk.Client.Common foreach (var method in methods) { var luaMethodAttr = (LuaMethodAttribute)method.GetCustomAttributes(luaAttr, false).First(); - var luaName = Name + "." + luaMethodAttr.Name; + var luaName = $"{Name}.{luaMethodAttr.Name}"; Lua.RegisterFunction(luaName, this, method); docs?.Add(new LibraryFunction(Name, callingLibrary.Description(), method)); diff --git a/BizHawk.Client.Common/lua/LuaMemoryBase.cs b/BizHawk.Client.Common/lua/LuaMemoryBase.cs index b0b814983c..1cd965d288 100644 --- a/BizHawk.Client.Common/lua/LuaMemoryBase.cs +++ b/BizHawk.Client.Common/lua/LuaMemoryBase.cs @@ -67,8 +67,7 @@ namespace BizHawk.Client.Common return d.PeekByte(addr); } - Log("Warning: attempted read of " + addr + - " outside the memory size of " + d.Size); + Log($"Warning: attempted read of {addr} outside the memory size of {d.Size}"); return 0; } @@ -83,8 +82,7 @@ namespace BizHawk.Client.Common } else { - Log("Warning: attempted write to " + addr + - " outside the memory size of " + d.Size); + Log($"Warning: attempted write to {addr} outside the memory size of {d.Size}"); } } else @@ -188,8 +186,7 @@ namespace BizHawk.Client.Common } else { - Log("Warning: Attempted read " + lastAddr + " outside memory domain size of " + - d.Size + " in readbyterange()"); + Log($"Warning: Attempted read {lastAddr} outside memory domain size of {d.Size} in readbyterange()"); } return table; @@ -209,8 +206,7 @@ namespace BizHawk.Client.Common } else { - Log("Warning: Attempted write " + addr + " outside memory domain size of " + - d.Size + " in writebyterange()"); + Log($"Warning: Attempted write {addr} outside memory domain size of {d.Size} in writebyterange()"); } } } @@ -230,8 +226,7 @@ namespace BizHawk.Client.Common return BitConverter.ToSingle(bytes, 0); } - Log("Warning: Attempted read " + addr + - " outside memory size of " + d.Size); + Log($"Warning: Attempted read {addr} outside memory size of {d.Size}"); return 0; } @@ -250,8 +245,7 @@ namespace BizHawk.Client.Common } else { - Log("Warning: Attempted write " + addr + - " outside memory size of " + d.Size); + Log($"Warning: Attempted write {addr} outside memory size of {d.Size}"); } } else diff --git a/BizHawk.Client.Common/lua/LuaSandbox.cs b/BizHawk.Client.Common/lua/LuaSandbox.cs index 7a025ebfa6..920984300d 100644 --- a/BizHawk.Client.Common/lua/LuaSandbox.cs +++ b/BizHawk.Client.Common/lua/LuaSandbox.cs @@ -27,7 +27,7 @@ namespace BizHawk.Client.Common private bool CoolSetCurrentDirectory(string path, string currDirSpeedHack = null) { - string target = _currentDirectory + "\\"; + string target = $"{_currentDirectory}\\"; // first we'll bypass it with a general hack: dont do any setting if the value's already there (even at the OS level, setting the directory can be slow) // yeah I know, not the smoothest move to compare strings here, in case path normalization is happening at some point @@ -45,7 +45,7 @@ namespace BizHawk.Client.Common // WARNING: setting the current directory is SLOW!!! security checks for some reason. // so we're bypassing it with windows hacks #if WINDOWS - fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes(target + "\0")[0]) + fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes($"{target}\0")[0]) return SetCurrentDirectoryW(pstr); #else if (System.IO.Directory.Exists(CurrentDirectory)) // race condition for great justice diff --git a/BizHawk.Client.Common/lua/NamedLuaFunction.cs b/BizHawk.Client.Common/lua/NamedLuaFunction.cs index d10d2eb0b3..828f97968a 100644 --- a/BizHawk.Client.Common/lua/NamedLuaFunction.cs +++ b/BizHawk.Client.Common/lua/NamedLuaFunction.cs @@ -23,11 +23,7 @@ namespace BizHawk.Client.Common } catch (Exception ex) { - logCallback( - "error running function attached by the event " + - Event + - "\nError message: " + - ex.Message); + logCallback($"error running function attached by the event {Event}\nError message: {ex.Message}"); } }; } diff --git a/BizHawk.Client.Common/movie/MovieSession.cs b/BizHawk.Client.Common/movie/MovieSession.cs index 1a4a5940e7..9ec8475cca 100644 --- a/BizHawk.Client.Common/movie/MovieSession.cs +++ b/BizHawk.Client.Common/movie/MovieSession.cs @@ -201,7 +201,7 @@ namespace BizHawk.Client.Common var result = Movie.Stop(saveChanges); if (result) { - Output(Path.GetFileName(Movie.Filename) + " written to disk."); + Output($"{Path.GetFileName(Movie.Filename)} written to disk."); } Output(message); @@ -225,7 +225,7 @@ namespace BizHawk.Client.Common if (Movie.IsPlaying) { Movie.ClearFrame(Global.Emulator.Frame); - Output("Scrubbed input at frame " + Global.Emulator.Frame); + Output($"Scrubbed input at frame {Global.Emulator.Frame}"); } } diff --git a/BizHawk.Client.Common/movie/MultitrackRecording.cs b/BizHawk.Client.Common/movie/MultitrackRecording.cs index 2b2de2b7aa..37ef517a90 100644 --- a/BizHawk.Client.Common/movie/MultitrackRecording.cs +++ b/BizHawk.Client.Common/movie/MultitrackRecording.cs @@ -35,7 +35,7 @@ namespace BizHawk.Client.Common return "Recording None"; } - return "Recording Player " + CurrentPlayer; + return $"Recording Player {CurrentPlayer}"; } } diff --git a/BizHawk.Client.Common/movie/Subtitle.cs b/BizHawk.Client.Common/movie/Subtitle.cs index b59be8679f..ffc3e847f7 100644 --- a/BizHawk.Client.Common/movie/Subtitle.cs +++ b/BizHawk.Client.Common/movie/Subtitle.cs @@ -59,19 +59,9 @@ namespace BizHawk.Client.Common int startTime = (int)(start * 1000 / fps); int endTime = (int)(end * 1000 / fps); - var startString = string.Format( - "{0:d2}:{1:d2}:{2:d2},{3:d3}", - startTime / 3600000, - (startTime / 60000) % 60, - (startTime / 1000) % 60, - startTime % 1000); + var startString = $"{startTime / 3600000:d2}:{(startTime / 60000) % 60:d2}:{(startTime / 1000) % 60:d2},{startTime % 1000:d3}"; - var endString = string.Format( - "{0:d2}:{1:d2}:{2:d2},{3:d3}", - endTime / 3600000, - (endTime / 60000) % 60, - (endTime / 1000) % 60, - endTime % 1000); + var endString = $"{endTime / 3600000:d2}:{(endTime / 60000) % 60:d2}:{(endTime / 1000) % 60:d2},{endTime % 1000:d3}"; sb.Append(startString); sb.Append(" --> "); diff --git a/BizHawk.Client.Common/movie/SubtitleList.cs b/BizHawk.Client.Common/movie/SubtitleList.cs index d3f5fee533..0f9fa61ee2 100644 --- a/BizHawk.Client.Common/movie/SubtitleList.cs +++ b/BizHawk.Client.Common/movie/SubtitleList.cs @@ -103,7 +103,7 @@ namespace BizHawk.Client.Common if (i > 0 && lastframe == subs[i].Frame) { - subs[i].Message = subs[i - 1].Message + " " + subs[i].Message; + subs[i].Message = $"{subs[i - 1].Message} {subs[i].Message}"; subs.Remove(subs[i - 1]); i--; } diff --git a/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs b/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs index 9d9ac17618..fafc214ad0 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs @@ -250,10 +250,7 @@ namespace BizHawk.Client.Common return true; } - errorMessage = "The savestate is from frame " - + newLog.Count - + " which is greater than the current movie length of " - + Log.Count; + errorMessage = $"The savestate is from frame {newLog.Count} which is greater than the current movie length of {Log.Count}"; return false; } @@ -262,9 +259,7 @@ namespace BizHawk.Client.Common { if (Log[i] != newLog[i]) { - errorMessage = "The savestate input does not match the movie input at frame " - + (i + 1) - + "."; + errorMessage = $"The savestate input does not match the movie input at frame {(i + 1)}."; return false; } diff --git a/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs b/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs index 5e44bdcd56..8a1ee67237 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs @@ -253,7 +253,7 @@ namespace BizHawk.Client.Common string prefix = ""; if (ControlType != "Gameboy Controller" && ControlType != "TI83 Controller") { - prefix = "P" + player + " "; + prefix = $"P{player} "; } foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys) @@ -352,7 +352,7 @@ namespace BizHawk.Client.Common int start = 3; foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys) { - Force("P" + player + " " + button, c[srcindex + start++]); + Force($"P{player} {button}", c[srcindex + start++]); } } } @@ -393,7 +393,7 @@ namespace BizHawk.Client.Common int start = 3; foreach (string button in BkmMnemonicConstants.Buttons["GPGX 3-Button Controller"].Keys) { - Force("P" + player + " " + button, c[srcindex + start++]); + Force($"P{player} {button}", c[srcindex + start++]); } } } @@ -429,7 +429,7 @@ namespace BizHawk.Client.Common int start = 3; foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys) { - Force("P" + player + " " + button, c[srcindex + start++]); + Force($"P{player} {button}", c[srcindex + start++]); } } } @@ -497,12 +497,12 @@ namespace BizHawk.Client.Common int start = 3; foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys) { - Force("P" + player + " " + button, c[srcindex + start++]); + Force($"P{player} {button}", c[srcindex + start++]); } foreach (string name in BkmMnemonicConstants.Analogs[ControlType].Keys) { - Force("P" + player + " " + name, int.Parse(mnemonic.Substring(srcindex + start, 4))); + Force($"P{player} {name}", int.Parse(mnemonic.Substring(srcindex + start, 4))); start += 5; } } @@ -539,7 +539,7 @@ namespace BizHawk.Client.Common int start = 3; foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys) { - Force("P" + player + " " + button, c[srcindex + start++]); + Force($"P{player} {button}", c[srcindex + start++]); } } } @@ -585,7 +585,7 @@ namespace BizHawk.Client.Common foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys) { - Force("P" + player + " " + button, c[srcindex + start++]); + Force($"P{player} {button}", c[srcindex + start++]); } } } @@ -635,7 +635,7 @@ namespace BizHawk.Client.Common int start = 1; foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys) { - Force("P" + player + " " + button, c[srcindex + start++]); + Force($"P{player} {button}", c[srcindex + start++]); } } diff --git a/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs b/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs index d444507047..721fdd3ae6 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs @@ -165,7 +165,7 @@ namespace BizHawk.Client.Common var prefix = ""; if (_controlType != "Gameboy Controller" && _controlType != "TI83 Controller") { - prefix = "P" + player + " "; + prefix = $"P{player} "; } foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) @@ -313,7 +313,7 @@ namespace BizHawk.Client.Common { foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); + input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); } input.Append("|"); @@ -330,7 +330,7 @@ namespace BizHawk.Client.Common { foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); + input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); } input.Append('|'); @@ -398,7 +398,7 @@ namespace BizHawk.Client.Common { foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); + input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); } input.Append('|'); @@ -448,7 +448,7 @@ namespace BizHawk.Client.Common { foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); + input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); } if (BkmMnemonicConstants.Analogs[_controlType].Keys.Count > 0) @@ -460,37 +460,37 @@ namespace BizHawk.Client.Common // Nasty hackery if (name == "Y Axis") { - if (IsBasePressed("P" + player + " A Up")) + if (IsBasePressed($"P{player} A Up")) { val = 127; } - else if (IsBasePressed("P" + player + " A Down")) + else if (IsBasePressed($"P{player} A Down")) { val = -127; } else { - val = (int)GetBaseFloat("P" + player + " " + name); + val = (int)GetBaseFloat($"P{player} {name}"); } } else if (name == "X Axis") { - if (IsBasePressed("P" + player + " A Left")) + if (IsBasePressed($"P{player} A Left")) { val = -127; } - else if (IsBasePressed("P" + player + " A Right")) + else if (IsBasePressed($"P{player} A Right")) { val = 127; } else { - val = (int)GetBaseFloat("P" + player + " " + name); + val = (int)GetBaseFloat($"P{player} {name}"); } } else { - val = (int)GetBaseFloat("P" + player + " " + name); + val = (int)GetBaseFloat($"P{player} {name}"); } if (val >= 0) @@ -532,7 +532,7 @@ namespace BizHawk.Client.Common { foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); + input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); } input.Append('|'); @@ -563,7 +563,7 @@ namespace BizHawk.Client.Common { foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); + input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); } input.Append("|"); @@ -595,7 +595,7 @@ namespace BizHawk.Client.Common { foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); + input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : "."); } input.Append("|"); diff --git a/BizHawk.Client.Common/movie/bkm/BkmMovie.IO.cs b/BizHawk.Client.Common/movie/bkm/BkmMovie.IO.cs index 28304ff050..d296be8d35 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmMovie.IO.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmMovie.IO.cs @@ -265,7 +265,7 @@ namespace BizHawk.Client.Common // TODO: clean this up if (_loopOffset.HasValue) { - sw.WriteLine("LoopOffset " + _loopOffset); + sw.WriteLine($"LoopOffset {_loopOffset}"); } foreach (var input in _log) diff --git a/BizHawk.Client.Common/movie/bkm/BkmMovie.InputLog.cs b/BizHawk.Client.Common/movie/bkm/BkmMovie.InputLog.cs index 59cc7bf267..eb5cf0d4ad 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmMovie.InputLog.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmMovie.InputLog.cs @@ -254,10 +254,7 @@ namespace BizHawk.Client.Common return true; } - errorMessage = "The savestate is from frame " - + log.Count - + " which is greater than the current movie length of " - + _log.Count; + errorMessage = $"The savestate is from frame {log.Count} which is greater than the current movie length of {_log.Count}"; return false; } @@ -266,9 +263,7 @@ namespace BizHawk.Client.Common { if (_log[i] != log[i]) { - errorMessage = "The savestate input does not match the movie input at frame " - + (i + 1) - + "."; + errorMessage = $"The savestate input does not match the movie input at frame {(i + 1)}."; return false; } diff --git a/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs b/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs index 99716f7617..ac88cba786 100644 --- a/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs +++ b/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs @@ -16,7 +16,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions { public static TasMovie ToTasMovie(this IMovie old, bool copy = false) { - string newFilename = old.Filename + "." + TasMovie.Extension; + string newFilename = $"{old.Filename}.{TasMovie.Extension}"; if (File.Exists(newFilename)) { @@ -26,7 +26,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions { if (File.Exists(newFilename)) { - newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension; + newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}"; fileNum++; } else @@ -131,11 +131,11 @@ namespace BizHawk.Client.Common.MovieConversionExtensions if (old.Filename.Contains("tasproj")) { newFilename = newFilename.Remove(newFilename.Length - 7, 7); - newFilename = newFilename + "nfn." + TasMovie.Extension; + newFilename = $"{newFilename}nfn.{TasMovie.Extension}"; } else { - newFilename = old.Filename + "." + TasMovie.Extension; + newFilename = $"{old.Filename}.{TasMovie.Extension}"; } if (File.Exists(newFilename)) @@ -146,7 +146,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions { if (File.Exists(newFilename)) { - newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension; + newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}"; fileNum++; } else @@ -216,11 +216,11 @@ namespace BizHawk.Client.Common.MovieConversionExtensions if (old.Filename.Contains("tasproj")) { newFilename = newFilename.Remove(newFilename.Length - 7, 7); - newFilename = newFilename + "nfsr." + TasMovie.Extension; + newFilename = $"{newFilename}nfsr.{TasMovie.Extension}"; } else { - newFilename = old.Filename + "." + TasMovie.Extension; + newFilename = $"{old.Filename}.{TasMovie.Extension}"; } if (File.Exists(newFilename)) @@ -231,7 +231,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions { if (File.Exists(newFilename)) { - newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension; + newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}"; fileNum++; } else @@ -323,7 +323,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions { foreach (var firmware in Global.FirmwareManager.RecentlyServed) { - var key = firmware.SystemId + "_Firmware_" + firmware.FirmwareId; + var key = $"{firmware.SystemId}_Firmware_{firmware.FirmwareId}"; if (!movie.HeaderEntries.ContainsKey(key)) { diff --git a/BizHawk.Client.Common/movie/import/Fm2Import.cs b/BizHawk.Client.Common/movie/import/Fm2Import.cs index 194f7ce244..5463a8794a 100644 --- a/BizHawk.Client.Common/movie/import/Fm2Import.cs +++ b/BizHawk.Client.Common/movie/import/Fm2Import.cs @@ -57,7 +57,7 @@ namespace BizHawk.Client.Common } else { - Result.Movie.Comments.Add(Movieorigin + " .fm2 version 3"); + Result.Movie.Comments.Add($"{Movieorigin} .fm2 version 3"); } } else if (line.ToLower().StartsWith("romfilename")) @@ -139,7 +139,7 @@ namespace BizHawk.Client.Common string length = line.Substring(first + 1, second - first - 1); string message = line.Substring(second + 1).Trim(); - return "subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message; + return $"subtitle {frame} 0 0 {length} FFFFFFFF {message}"; } return null; diff --git a/BizHawk.Client.Common/movie/import/IMovieImport.cs b/BizHawk.Client.Common/movie/import/IMovieImport.cs index 255b0e6477..91191b7342 100644 --- a/BizHawk.Client.Common/movie/import/IMovieImport.cs +++ b/BizHawk.Client.Common/movie/import/IMovieImport.cs @@ -41,7 +41,7 @@ namespace BizHawk.Client.Common return Result; } - var newFileName = SourceFile.FullName + "." + Bk2Movie.Extension; + var newFileName = $"{SourceFile.FullName}.{Bk2Movie.Extension}"; Result.Movie = new Bk2Movie(newFileName); RunImport(); diff --git a/BizHawk.Client.Common/movie/import/MovieImport.cs b/BizHawk.Client.Common/movie/import/MovieImport.cs index 9110615a37..6f16c63120 100644 --- a/BizHawk.Client.Common/movie/import/MovieImport.cs +++ b/BizHawk.Client.Common/movie/import/MovieImport.cs @@ -57,7 +57,7 @@ namespace BizHawk.Client.Common } else { - messageCallback(Path.GetFileName(fn) + " imported as " + m.Filename); + messageCallback($"{Path.GetFileName(fn)} imported as {m.Filename}"); } if (!Directory.Exists(d)) @@ -83,7 +83,7 @@ namespace BizHawk.Client.Common if (importerType == default(Type)) { - errorMsg = "No importer found for file type " + ext; + errorMsg = $"No importer found for file type {ext}"; return null; } @@ -205,7 +205,7 @@ namespace BizHawk.Client.Common if (m != null) { - m.Filename += "." + BkmMovie.Extension; + m.Filename += $".{BkmMovie.Extension}"; } else { @@ -230,7 +230,7 @@ namespace BizHawk.Client.Common { "BKM", "FCM", "FM2", "FMV", "GMV", "MCM", "MC2", "MMV", "NMV", "LSMV", "SMV", "VBM", "VMV", "YMV", "ZMV" }; - return extensions.Any(ext => extension.ToUpper() == "." + ext); + return extensions.Any(ext => extension.ToUpper() == $".{ext}"); } // Reduce all whitespace to single spaces. @@ -261,7 +261,7 @@ namespace BizHawk.Client.Common for (int section = 2; section < sections.Length - 1; section++) { int player = section - 1; // We start with 1 - string prefix = "P" + player + " "; // "P1" + string prefix = $"P{player} "; // "P1" for (int button = 0; button < buttons.Length; button++) { @@ -344,7 +344,7 @@ namespace BizHawk.Client.Common if (warningMsg != "") { - warningMsg = "Unable to import " + warningMsg + " command on line " + lineNum + "."; + warningMsg = $"Unable to import {warningMsg} command on line {lineNum}."; } } } @@ -397,7 +397,7 @@ namespace BizHawk.Client.Common { // The player number is one less than the section number for the reasons explained above. int player = section + playerOffset; - string prefix = "P" + player + " "; + string prefix = $"P{player} "; // Gameboy doesn't currently have a prefix saying which player the input is for. if (controllers.Definition.Name == "Gameboy Controller") @@ -450,7 +450,7 @@ namespace BizHawk.Client.Common } string message = line.Substring(second + 1).Trim(); - m.Subtitles.AddFromString("subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message); + m.Subtitles.AddFromString($"subtitle {frame} 0 0 {length} FFFFFFFF {message}"); } return m; @@ -507,14 +507,12 @@ namespace BizHawk.Client.Common } else if (line.ToLower().StartsWith("emuversion")) { - m.Comments.Add( - EMULATIONORIGIN + " " + emulator + " version " + ParseHeader(line, "emuVersion")); + m.Comments.Add($"{EMULATIONORIGIN} {emulator} version {ParseHeader(line, "emuVersion")}"); } else if (line.ToLower().StartsWith("version")) { string version = ParseHeader(line, "version"); - m.Comments.Add( - MOVIEORIGIN + " " + Path.GetExtension(path) + " version " + version); + m.Comments.Add($"{MOVIEORIGIN} {Path.GetExtension(path)} version {version}"); if (Path.GetExtension(path).ToUpper() == ".FM2" && version != "3") { errorMsg = ".FM2 movie version must always be 3."; @@ -683,7 +681,7 @@ namespace BizHawk.Client.Common return null; } - m.Comments.Add(MOVIEORIGIN + " .FCM version " + version); + m.Comments.Add($"{MOVIEORIGIN} .FCM version {version}"); // 008 1-byte flags byte flags = r.ReadByte(); @@ -715,7 +713,7 @@ namespace BizHawk.Client.Common // other: reserved, set to 0 bool syncHack = ((flags >> 4) & 0x1) != 0; - m.Comments.Add(SYNCHACK + " " + syncHack); + m.Comments.Add($"{SYNCHACK} {syncHack}"); // 009 1-byte flags: reserved, set to 0 r.ReadByte(); @@ -749,7 +747,7 @@ namespace BizHawk.Client.Common // 030 4-byte little-endian unsigned int: version of the emulator used uint emuVersion = r.ReadUInt32(); - m.Comments.Add(EMULATIONORIGIN + " FCEU " + emuVersion); + m.Comments.Add($"{EMULATIONORIGIN} FCEU {emuVersion}"); // 034 name of the ROM used - UTF8 encoded nul-terminated string. List gameBytes = new List(); @@ -870,7 +868,7 @@ namespace BizHawk.Client.Common if (warningMsg != "") { - warningMsg = "Unable to import " + warningMsg + " command at frame " + frame + "."; + warningMsg = $"Unable to import {warningMsg} command at frame {frame}."; } } @@ -917,7 +915,7 @@ namespace BizHawk.Client.Common The controller update toggles the affected input. Controller update data is emitted to the movie file only when the state of the controller changes. */ - controllers["P" + player + " " + buttons[button]] = !controllers["P" + player + " " + buttons[button]]; + controllers[$"P{player} {buttons[button]}"] = !controllers[$"P{player} {buttons[button]}"]; } } @@ -1012,12 +1010,12 @@ namespace BizHawk.Client.Common // 010 64-byte zero-terminated emulator identifier string string emuVersion = NullTerminated(r.ReadStringFixedAscii(64)); - m.Comments.Add(EMULATIONORIGIN + " Famtasia version " + emuVersion); - m.Comments.Add(MOVIEORIGIN + " .FMV"); + m.Comments.Add($"{EMULATIONORIGIN} Famtasia version {emuVersion}"); + m.Comments.Add($"{MOVIEORIGIN} .FMV"); // 050 64-byte zero-terminated movie title string string description = NullTerminated(r.ReadStringFixedAscii(64)); - m.Comments.Add(COMMENT + " " + description); + m.Comments.Add($"{COMMENT} {description}"); if (!controller1 && !controller2 && !fds) { warningMsg = "No input recorded."; @@ -1080,7 +1078,7 @@ namespace BizHawk.Client.Common { for (int button = 0; button < buttons.Length; button++) { - controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0; + controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; } } else @@ -1119,8 +1117,8 @@ namespace BizHawk.Client.Common // 00F ASCII-encoded GMV file format version. The most recent is 'A'. (?) string version = r.ReadStringFixedAscii(1); - m.Comments.Add(MOVIEORIGIN + " .GMV version " + version); - m.Comments.Add(EMULATIONORIGIN + " Gens"); + m.Comments.Add($"{MOVIEORIGIN} .GMV version {version}"); + m.Comments.Add($"{EMULATIONORIGIN} Gens"); // 010 4-byte little-endian unsigned int: rerecord count uint rerecordCount = r.ReadUInt32(); @@ -1169,7 +1167,7 @@ namespace BizHawk.Client.Common // 018 40-byte zero-terminated ASCII movie name string string description = NullTerminated(r.ReadStringFixedAscii(40)); - m.Comments.Add(COMMENT + " " + description); + m.Comments.Add($"{COMMENT} {description}"); /* 040 frame data @@ -1213,7 +1211,7 @@ namespace BizHawk.Client.Common { for (int button = 0; button < buttons.Length; button++) { - controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) == 0; + controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) == 0; } } else @@ -1222,12 +1220,12 @@ namespace BizHawk.Client.Common { if (player1Config == "6") { - controllers["P1 " + other[button]] = ((controllerState >> button) & 0x1) == 0; + controllers[$"P1 {other[button]}"] = ((controllerState >> button) & 0x1) == 0; } if (player2Config == "6") { - controllers["P2 " + other[button]] = ((controllerState >> (button + 4)) & 0x1) == 0; + controllers[$"P2 {other[button]}"] = ((controllerState >> (button + 4)) & 0x1) == 0; } } } @@ -1275,7 +1273,7 @@ namespace BizHawk.Client.Common { if (authorLast != "") { - authorList += authorLast + ", "; + authorList += $"{authorLast}, "; } authorLast = author; @@ -1301,7 +1299,7 @@ namespace BizHawk.Client.Common hf.BindArchiveMember(item.Index); var stream = hf.GetStream(); string coreversion = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim(); - m.Comments.Add(COREORIGIN + " " + coreversion); + m.Comments.Add($"{COREORIGIN} {coreversion}"); hf.Unbind(); } else if (item.Name == "gamename") @@ -1446,7 +1444,7 @@ namespace BizHawk.Client.Common string rom = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim(); int pos = item.Name.LastIndexOf(".sha256"); string name = item.Name.Substring(0, pos); - m.Header[SHA256 + "_" + name] = rom; + m.Header[$"{SHA256}_{name}"] = rom; hf.Unbind(); } else if (item.Name == "savestate") @@ -1491,7 +1489,7 @@ namespace BizHawk.Client.Common hf.BindArchiveMember(item.Index); var stream = hf.GetStream(); string systemid = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim(); - m.Comments.Add(EMULATIONORIGIN + " " + systemid); + m.Comments.Add($"{EMULATIONORIGIN} {systemid}"); hf.Unbind(); } } @@ -1528,11 +1526,11 @@ namespace BizHawk.Client.Common // 008 uint32 Mednafen Version (Current is 0A 08) uint emuVersion = r.ReadUInt32(); - m.Comments.Add(EMULATIONORIGIN + " Mednafen " + emuVersion); + m.Comments.Add($"{EMULATIONORIGIN} Mednafen {emuVersion}"); // 00C uint32 Movie Format Version (Current is 01) uint version = r.ReadUInt32(); - m.Comments.Add(MOVIEORIGIN + " .MCM version " + version); + m.Comments.Add($"{MOVIEORIGIN} .MCM version {version}"); // 010 32-byte MD5 of the ROM used byte[] md5 = r.ReadBytes(16); @@ -1580,7 +1578,7 @@ namespace BizHawk.Client.Common }; if (!platforms.ContainsKey(platform)) { - errorMsg = "Platform " + platform + " not supported."; + errorMsg = $"Platform {platform} not supported."; r.Close(); fs.Close(); return null; @@ -1601,7 +1599,7 @@ namespace BizHawk.Client.Common // TODO: Verify if NTSC/"PAL" mode used for the movie can be detected or not. // 100 variable Input data - SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = name + " Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = $"{name} Controller" } }; int bytes = 256; // The input stream consists of 1 byte for power-on and reset, and then X bytes per each input port per frame. @@ -1632,7 +1630,7 @@ namespace BizHawk.Client.Common ushort controllerState = r.ReadByte(); for (int button = 0; button < buttons.Length; button++) { - string prefix = platform == "lynx" ? "" : "P" + player + " "; // hack + string prefix = platform == "lynx" ? "" : $"P{player} "; // hack controllers[prefix + buttons[button]] = ((controllerState >> button) & 0x1) != 0; } } @@ -1677,8 +1675,8 @@ namespace BizHawk.Client.Common // 0004: 4-byte little endian unsigned int: dega version uint emuVersion = r.ReadUInt32(); - m.Comments.Add(EMULATIONORIGIN + " Dega version " + emuVersion); - m.Comments.Add(MOVIEORIGIN + " .MMV"); + m.Comments.Add($"{EMULATIONORIGIN} Dega version {emuVersion}"); + m.Comments.Add($"{MOVIEORIGIN} .MMV"); // 0008: 4-byte little endian unsigned int: frame count uint frameCount = r.ReadUInt32(); @@ -1771,7 +1769,7 @@ namespace BizHawk.Client.Common byte controllerState = r.ReadByte(); for (int button = 0; button < buttons.Length; button++) { - controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0; + controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; } if (player == 1) @@ -1810,8 +1808,8 @@ namespace BizHawk.Client.Common // 004 4-byte version string (example "0960") string emuVersion = r.ReadStringFixedAscii(4); - m.Comments.Add(EMULATIONORIGIN + " Nintendulator version " + emuVersion); - m.Comments.Add(MOVIEORIGIN + " .NMV"); + m.Comments.Add($"{EMULATIONORIGIN} Nintendulator version {emuVersion}"); + m.Comments.Add($"{MOVIEORIGIN} .NMV"); // 008 4-byte file size, not including the 16-byte header r.ReadUInt32(); @@ -1918,7 +1916,7 @@ namespace BizHawk.Client.Common if (warningMsg != "") { - warningMsg = warningMsg + " is not properly supported."; + warningMsg = $"{warningMsg} is not properly supported."; } } } @@ -1945,7 +1943,7 @@ namespace BizHawk.Client.Common }; if (expansion != 0 && warningMsg == "") { - warningMsg = "Expansion port is not properly supported. This movie uses " + expansions[expansion] + "."; + warningMsg = $"Expansion port is not properly supported. This movie uses {expansions[expansion]}."; } // 003 1-byte number of bytes per frame, plus flags @@ -1989,7 +1987,7 @@ namespace BizHawk.Client.Common 00C (variable) null-terminated UTF-8 text, movie description (currently not implemented) */ string movieDescription = NullTerminated(r.ReadStringFixedAscii((int)r.ReadUInt32())); - m.Comments.Add(COMMENT + " " + movieDescription); + m.Comments.Add($"{COMMENT} {movieDescription}"); // ... 4-byte little-endian unsigned int: length of controller data in bytes uint length = r.ReadUInt32(); @@ -2027,7 +2025,7 @@ namespace BizHawk.Client.Common { for (int button = 0; button < buttons.Length; button++) { - controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0; + controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; } } else if (warningMsg == "") @@ -2084,8 +2082,8 @@ namespace BizHawk.Client.Common return null; } - m.Comments.Add(EMULATIONORIGIN + " Snes9x version " + version); - m.Comments.Add(MOVIEORIGIN + " .SMV"); + m.Comments.Add($"{EMULATIONORIGIN} Snes9x version {version}"); + m.Comments.Add($"{MOVIEORIGIN} .SMV"); /* 008 4-byte little-endian integer: movie "uid" - identifies the movie-savestate relationship, also used as the recording time in Unix epoch format @@ -2302,7 +2300,7 @@ namespace BizHawk.Client.Common if (peripheral != "" && warningMsg == "") { - warningMsg = "Unable to import " + peripheral + "."; + warningMsg = $"Unable to import {peripheral}."; } } @@ -2311,13 +2309,13 @@ namespace BizHawk.Client.Common { for (int button = 0; button < buttons.Length; button++) { - controllers["P" + player + " " + buttons[button]] = + controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; } } else if (warningMsg == "") { - warningMsg = "Controller " + player + " not supported."; + warningMsg = $"Controller {player} not supported."; } } @@ -2475,7 +2473,7 @@ namespace BizHawk.Client.Common if (isSGB) { - m.Comments.Add(SUPERGAMEBOYMODE + " True"); + m.Comments.Add($"{SUPERGAMEBOYMODE} True"); } m.Header[HeaderKeys.PLATFORM] = platform; @@ -2521,8 +2519,8 @@ namespace BizHawk.Client.Common // 030 1-byte unsigned char: minor version/revision number of current VBM version, the latest is "1" byte minorVersion = r.ReadByte(); - m.Comments.Add(MOVIEORIGIN + " .VBM version " + majorVersion + "." + minorVersion); - m.Comments.Add(EMULATIONORIGIN + " Visual Boy Advance"); + m.Comments.Add($"{MOVIEORIGIN} .VBM version {majorVersion}.{minorVersion}"); + m.Comments.Add($"{EMULATIONORIGIN} Visual Boy Advance"); // 031 1-byte unsigned char: the internal CRC of the ROM used while recording r.ReadByte(); @@ -2559,7 +2557,7 @@ namespace BizHawk.Client.Common // The following 128 bytes are for a description of the movie. Both parts must be null-terminated. string movieDescription = NullTerminated(r.ReadStringFixedAscii(128)); - m.Comments.Add(COMMENT + " " + movieDescription); + m.Comments.Add($"{COMMENT} {movieDescription}"); r.BaseStream.Position = firstFrameOffset; SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() }; controllers.Definition.Name = platform != "GBA" @@ -2615,7 +2613,7 @@ namespace BizHawk.Client.Common { if (((controllerState >> (button + 10)) & 0x1) != 0) { - warningMsg = "Unable to import " + other[button] + " at frame " + frame + "."; + warningMsg = $"Unable to import {other[button]} at frame {frame}."; break; } } @@ -2660,12 +2658,12 @@ namespace BizHawk.Client.Common // 00C 2-byte little-endian integer: movie version 0x0400 ushort version = r.ReadUInt16(); - m.Comments.Add(MOVIEORIGIN + " .VMV version " + version); - m.Comments.Add(EMULATIONORIGIN + " VirtuaNES"); + m.Comments.Add($"{MOVIEORIGIN} .VMV version {version}"); + m.Comments.Add($"{EMULATIONORIGIN} VirtuaNES"); // 00E 2-byte little-endian integer: record version ushort recordVersion = r.ReadUInt16(); - m.Comments.Add(COMMENT + " Record version " + recordVersion); + m.Comments.Add($"{COMMENT} Record version {recordVersion}"); // 010 4-byte flags (control byte) uint flags = r.ReadUInt32(); @@ -2837,12 +2835,12 @@ namespace BizHawk.Client.Common } else { - commandName = "NESCMD_EXCONTROLLER, " + (command & 0xFF00); + commandName = $"NESCMD_EXCONTROLLER, {(command & 0xFF00)}"; } if (commandName != "" && warningMsg == "") { - warningMsg = "Unable to run command \"" + commandName + "\"."; + warningMsg = $"Unable to run command \"{commandName}\"."; } } else if (controllerState == 0xF3) @@ -2852,7 +2850,7 @@ namespace BizHawk.Client.Common // TODO: Make a clearer warning message. if (warningMsg == "") { - warningMsg = "Unable to run SetSyncExData(" + dwdata + ")."; + warningMsg = $"Unable to run SetSyncExData({dwdata})."; } } @@ -2861,7 +2859,7 @@ namespace BizHawk.Client.Common for (int button = 0; button < buttons.Length; button++) { - controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0; + controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; } } @@ -2901,8 +2899,8 @@ namespace BizHawk.Client.Common // 003 2-byte little-endian unsigned int: zsnes version number short version = r.ReadInt16(); - m.Comments.Add(EMULATIONORIGIN + " ZSNES version " + version); - m.Comments.Add(MOVIEORIGIN + " .ZMV"); + m.Comments.Add($"{EMULATIONORIGIN} ZSNES version {version}"); + m.Comments.Add($"{MOVIEORIGIN} .ZMV"); // 005 4-byte little-endian integer: CRC32 of the ROM int crc32 = r.ReadInt32(); @@ -2973,7 +2971,7 @@ namespace BizHawk.Client.Common if (peripheral != "") { - warningMsg = "Unable to import " + peripheral + "."; + warningMsg = $"Unable to import {peripheral}."; } // 027 1-byte flags: @@ -3182,14 +3180,14 @@ namespace BizHawk.Client.Common { for (int button = 0; button < buttons.Length; button++) { - controllers["P" + player + " " + buttons[button]] = + controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; } } } else if (warningMsg == "") { - warningMsg = "Controller " + player + " not supported."; + warningMsg = $"Controller {player} not supported."; } } } diff --git a/BizHawk.Client.Common/movie/import/PJMImport.cs b/BizHawk.Client.Common/movie/import/PJMImport.cs index 0ced2f3f15..9429f779e8 100644 --- a/BizHawk.Client.Common/movie/import/PJMImport.cs +++ b/BizHawk.Client.Common/movie/import/PJMImport.cs @@ -45,7 +45,7 @@ namespace BizHawk.Client.Common string magic = new string(br.ReadChars(4)); if (magic != expectedMagic) { - Result.Errors.Add("Not a " + expectedMagic + "file: invalid magic number in file header."); + Result.Errors.Add($"Not a {expectedMagic}file: invalid magic number in file header."); return info; } @@ -221,7 +221,7 @@ namespace BizHawk.Client.Common for (int button = 3; button < buttons.Length; button++) { - controllers["P1 " + buttons[button]] = ((controllerState >> button) & 0x1) != 0; + controllers[$"P1 {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; if (((controllerState >> button) & 0x1) != 0 && button > 15) { continue; @@ -246,7 +246,7 @@ namespace BizHawk.Client.Common ushort controllerState = br.ReadUInt16(); for (int button = 0; button < buttons.Length; button++) { - controllers["P2 " + buttons[button]] = ((controllerState >> button) & 0x1) != 0; + controllers[$"P2 {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0; if (((controllerState >> button) & 0x1) != 0 && button > 15) { continue; @@ -291,7 +291,7 @@ namespace BizHawk.Client.Common if ((controlState & 0xFC) != 0) { - Result.Warnings.Add("Ignored toggle hack flag on frame " + frame); + Result.Warnings.Add($"Ignored toggle hack flag on frame {frame}"); } movie.AppendFrame(controllers); @@ -336,7 +336,7 @@ namespace BizHawk.Client.Common for (int button = 3; button < buttons.Length; button++) { - controllers["P1 " + buttons[button]] = br.ReadChar() != '.'; + controllers[$"P1 {buttons[button]}"] = br.ReadChar() != '.'; } if (info.Player1Type == OctoshockDll.ePeripheralType.DualShock) @@ -373,7 +373,7 @@ namespace BizHawk.Client.Common for (int button = 3; button < buttons.Length; button++) { - controllers["P2 " + buttons[button]] = br.ReadChar() != '.'; + controllers[$"P2 {buttons[button]}"] = br.ReadChar() != '.'; } if (info.Player2Type == OctoshockDll.ePeripheralType.DualShock) @@ -423,7 +423,7 @@ namespace BizHawk.Client.Common if ((controlState & 0xFC) != 0) { - Result.Warnings.Add("Ignored toggle hack flag on frame " + frame); + Result.Warnings.Add($"Ignored toggle hack flag on frame {frame}"); } // Each controller is terminated with a pipeline. diff --git a/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs b/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs index e02b10a009..98ff514ec0 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs @@ -50,7 +50,7 @@ namespace BizHawk.Client.Common if (frame > _lagLog.Count) { - System.Diagnostics.Debug.Print("Lag Log error. f" + frame + ", log: " + _lagLog.Count); + System.Diagnostics.Debug.Print($"Lag Log error. f{frame}, log: {_lagLog.Count}"); return; // Can this break anything? } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs index f08d163849..41bd3de508 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs @@ -14,7 +14,7 @@ namespace BizHawk.Client.Common { if (frame != 0) { - ChangeLog.AddGeneralUndo(frame - 1, frame - 1, "Record Frame: " + frame); + ChangeLog.AddGeneralUndo(frame - 1, frame - 1, $"Record Frame: {frame}"); } base.RecordFrame(frame, source); @@ -35,7 +35,7 @@ namespace BizHawk.Client.Common public override void Truncate(int frame) { - bool endBatch = ChangeLog.BeginNewBatch("Truncate Movie: " + frame, true); + bool endBatch = ChangeLog.BeginNewBatch($"Truncate Movie: {frame}", true); ChangeLog.AddGeneralUndo(frame, InputLogLength - 1); if (frame < Log.Count - 1) @@ -58,7 +58,7 @@ namespace BizHawk.Client.Common public override void PokeFrame(int frame, IController source) { - ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame); + ChangeLog.AddGeneralUndo(frame, frame, $"Set Frame At: {frame}"); base.PokeFrame(frame, source); InvalidateAfter(frame); @@ -68,7 +68,7 @@ namespace BizHawk.Client.Common public void SetFrame(int frame, string source) { - ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame); + ChangeLog.AddGeneralUndo(frame, frame, $"Set Frame At: {frame}"); SetFrameAt(frame, source); InvalidateAfter(frame); @@ -78,7 +78,7 @@ namespace BizHawk.Client.Common public override void ClearFrame(int frame) { - ChangeLog.AddGeneralUndo(frame, frame, "Clear Frame: " + frame); + ChangeLog.AddGeneralUndo(frame, frame, $"Clear Frame: {frame}"); base.ClearFrame(frame); InvalidateAfter(frame); @@ -88,7 +88,7 @@ namespace BizHawk.Client.Common public void RemoveFrame(int frame) { - bool endBatch = ChangeLog.BeginNewBatch("Remove Frame: " + frame, true); + bool endBatch = ChangeLog.BeginNewBatch($"Remove Frame: {frame}", true); ChangeLog.AddGeneralUndo(frame, InputLogLength - 1); Log.RemoveAt(frame); @@ -181,7 +181,7 @@ namespace BizHawk.Client.Common public void RemoveFrames(int removeStart, int removeUpTo, bool fromHistory = false) { - bool endBatch = ChangeLog.BeginNewBatch("Remove Frames: " + removeStart + "-" + removeUpTo, true); + bool endBatch = ChangeLog.BeginNewBatch($"Remove Frames: {removeStart}-{removeUpTo}", true); ChangeLog.AddGeneralUndo(removeStart, InputLogLength - 1); for (int i = removeUpTo - 1; i >= removeStart; i--) @@ -225,7 +225,7 @@ namespace BizHawk.Client.Common public void InsertInput(int frame, string inputState) { - bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true); + bool endBatch = ChangeLog.BeginNewBatch($"Insert Frame: {frame}", true); ChangeLog.AddGeneralUndo(frame, InputLogLength); Log.Insert(frame, inputState); @@ -258,7 +258,7 @@ namespace BizHawk.Client.Common public void InsertInput(int frame, IEnumerable inputLog) { - bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true); + bool endBatch = ChangeLog.BeginNewBatch($"Insert Frame: {frame}", true); ChangeLog.AddGeneralUndo(frame, InputLogLength + inputLog.Count() - 1); Log.InsertRange(frame, inputLog); @@ -307,7 +307,7 @@ namespace BizHawk.Client.Common public void CopyOverInput(int frame, IEnumerable inputStates) { - ChangeLog.BeginNewBatch("Copy Over Input: " + frame); + ChangeLog.BeginNewBatch($"Copy Over Input: {frame}"); var lg = LogGeneratorInstance(); var states = inputStates.ToList(); @@ -316,7 +316,7 @@ namespace BizHawk.Client.Common ExtendMovieForEdit(states.Count + frame - Log.Count); } - ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, "Copy Over Input: " + frame); + ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, $"Copy Over Input: {frame}"); for (int i = 0; i < states.Count; i++) { @@ -338,7 +338,7 @@ namespace BizHawk.Client.Common public void InsertEmptyFrame(int frame, int count = 1, bool fromHistory = false) { - bool endBatch = ChangeLog.BeginNewBatch("Insert Empty Frame: " + frame, true); + bool endBatch = ChangeLog.BeginNewBatch($"Insert Empty Frame: {frame}", true); ChangeLog.AddGeneralUndo(frame, InputLogLength + count - 1); var lg = LogGeneratorInstance(); @@ -422,7 +422,7 @@ namespace BizHawk.Client.Common Changes = true; InvalidateAfter(frame); - ChangeLog.AddBoolToggle(frame, buttonName, !adapter.IsPressed(buttonName), "Toggle " + buttonName + ": " + frame); + ChangeLog.AddBoolToggle(frame, buttonName, !adapter.IsPressed(buttonName), $"Toggle {buttonName}: {frame}"); } public void SetBoolState(int frame, string buttonName, bool val) @@ -444,7 +444,7 @@ namespace BizHawk.Client.Common { InvalidateAfter(frame); Changes = true; - ChangeLog.AddBoolToggle(frame, buttonName, old, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame); + ChangeLog.AddBoolToggle(frame, buttonName, old, $"Set {buttonName}({(val ? "On" : "Off")}): {frame}"); } } @@ -455,7 +455,7 @@ namespace BizHawk.Client.Common ExtendMovieForEdit(frame + count - Log.Count); } - ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame + "-" + (frame + count - 1)); + ChangeLog.AddGeneralUndo(frame, frame + count - 1, $"Set {buttonName}({(val ? "On" : "Off")}): {frame}-{(frame + count - 1)}"); int changed = -1; for (int i = 0; i < count; i++) @@ -502,7 +502,7 @@ namespace BizHawk.Client.Common { InvalidateAfter(frame); Changes = true; - ChangeLog.AddFloatChange(frame, buttonName, old, val, "Set " + buttonName + "(" + val + "): " + frame); + ChangeLog.AddFloatChange(frame, buttonName, old, val, $"Set {buttonName}({val}): {frame}"); } } @@ -513,7 +513,7 @@ namespace BizHawk.Client.Common ExtendMovieForEdit(frame - Log.Count + 1); } - ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + val + "): " + frame + "-" + (frame + count - 1)); + ChangeLog.AddGeneralUndo(frame, frame + count - 1, $"Set {buttonName}({val}): {frame}-{(frame + count - 1)}"); int changed = -1; for (int i = 0; i < count; i++) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs index 30f6182037..bce2d0a106 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs @@ -273,7 +273,7 @@ namespace BizHawk.Client.Common if (name == "") { - name = "Undo step " + _totalSteps; + name = $"Undo step {_totalSteps}"; } bool ret = false; @@ -349,11 +349,11 @@ namespace BizHawk.Client.Common { if (oldPosition == -1) { - name = "Set Marker at frame " + newMarker.Frame; + name = $"Set Marker at frame {newMarker.Frame}"; } else { - name = "Remove Marker at frame " + oldPosition; + name = $"Remove Marker at frame {oldPosition}"; } AddMovieAction(name); diff --git a/BizHawk.Client.Common/tools/Watch/Watch.cs b/BizHawk.Client.Common/tools/Watch/Watch.cs index 4b4aa4ca5f..c900a9a7b0 100644 --- a/BizHawk.Client.Common/tools/Watch/Watch.cs +++ b/BizHawk.Client.Common/tools/Watch/Watch.cs @@ -573,7 +573,7 @@ namespace BizHawk.Client.Common { if (_domain != null) { - return "X" + (_domain.Size - 1).NumHexDigits(); + return $"X{(_domain.Size - 1).NumHexDigits()}"; } return "";