Use string interpolation
This commit is contained in:
parent
a1ef3153b6
commit
2699ced133
|
@ -112,7 +112,7 @@ namespace BizHawk.Client.DBMan
|
|||
{
|
||||
if (s.ToString().Trim() == "")
|
||||
{
|
||||
MessageBox.Show("The selected file: " + s.ToString() + "Cannot be found.\n\nSort this out and try again");
|
||||
MessageBox.Show($"The selected file: {s}Cannot be found.\n\nSort this out and try again");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -132,9 +132,7 @@ namespace BizHawk.Client.DBMan
|
|||
res = dp.ParseDAT(files.ToArray());
|
||||
}
|
||||
|
||||
string fName = "gamedb_" +
|
||||
GameDB.GetSystemCode((SystemType)Enum.Parse(typeof(SystemType), comboBoxSystemSelect.SelectedValue.ToString())) +
|
||||
"_DevExport_" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH_mm_ss") + ".txt";
|
||||
string fName = $"gamedb_{GameDB.GetSystemCode((SystemType)Enum.Parse(typeof(SystemType), comboBoxSystemSelect.SelectedValue.ToString()))}_DevExport_{DateTime.UtcNow:yyyy-MM-dd_HH_mm_ss}.txt";
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -142,7 +140,7 @@ namespace BizHawk.Client.DBMan
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error writing file: " + fName + "\n\n" + ex.Message);
|
||||
MessageBox.Show($"Error writing file: {fName}\n\n{ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ namespace BizHawk.Client.DBMan
|
|||
// start comment block
|
||||
List<string> comments = new List<string>
|
||||
{
|
||||
"Type:\t" + "NO-INTRO",
|
||||
"Source:\t" + description,
|
||||
"FileGen:\t" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " (UTC)",
|
||||
"Type:\tNO-INTRO",
|
||||
$"Source:\t{description}",
|
||||
$"FileGen:\t{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} (UTC)",
|
||||
};
|
||||
|
||||
AddCommentBlock(comments.ToArray());
|
||||
|
|
|
@ -59,9 +59,9 @@ namespace BizHawk.Client.DBMan
|
|||
// start comment block
|
||||
List<string> comments = new List<string>
|
||||
{
|
||||
"Type:\t" + category,
|
||||
"Source:\t" + description,
|
||||
"FileGen:\t" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " (UTC)",
|
||||
$"Type:\t{category}",
|
||||
$"Source:\t{description}",
|
||||
$"FileGen:\t{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} (UTC)",
|
||||
};
|
||||
|
||||
AddCommentBlock(comments.ToArray());
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace BizHawk.Client.DBMan
|
|||
}
|
||||
}
|
||||
|
||||
public string SizeFriendly { get { return string.Format("{0} bytes ({1}k)", Size, Size / 1024); } }
|
||||
public string SizeFriendly => $"{Size} bytes ({Size >> 10}k)";
|
||||
public bool New { get { return (Created > Modified); } }
|
||||
|
||||
public string NameWithTheFlipped
|
||||
|
|
|
@ -190,10 +190,7 @@ namespace BizHawk.Client.DBMan
|
|||
}
|
||||
}
|
||||
|
||||
static string Hash_CRC32(byte[] data)
|
||||
{
|
||||
return string.Format("{0:X8}", CRC32.Calculate(data));
|
||||
}
|
||||
static string Hash_CRC32(byte[] data) => $"{CRC32.Calculate(data):X8}";
|
||||
|
||||
static string Hash_SHA1(byte[] data)
|
||||
{
|
||||
|
|
|
@ -192,19 +192,19 @@ namespace BizHawk.Client.MultiHawk
|
|||
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; });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,10 +183,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
{
|
||||
public LogicalButton LogicalButton;
|
||||
public InputEventType EventType;
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}:{1}", EventType.ToString(), LogicalButton.ToString());
|
||||
}
|
||||
public override string ToString() => $"{EventType.ToString()}:{LogicalButton.ToString()}";
|
||||
}
|
||||
|
||||
private readonly WorkingDictionary<string, object> ModifierState = new WorkingDictionary<string, object>();
|
||||
|
|
|
@ -1083,11 +1083,11 @@ namespace BizHawk.Client.MultiHawk
|
|||
{
|
||||
if (Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
frame += string.Format(" / {0} (finished)", Global.MovieSession.Movie.FrameCount);
|
||||
frame += $" / {Global.MovieSession.Movie.FrameCount} (finished)";
|
||||
}
|
||||
else if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
frame += string.Format(" / {0}", Global.MovieSession.Movie.FrameCount);
|
||||
frame += $" / {Global.MovieSession.Movie.FrameCount}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -435,7 +435,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
}
|
||||
|
||||
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");
|
||||
|
|
Loading…
Reference in New Issue