Skip to content

Commit

Permalink
Apply some string interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Nov 23, 2023
1 parent abae74c commit 0f5973b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Source/ROUtils/ResourceUnitInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,26 @@ public static string PrintRate(double rate, int resID, bool showFlowMode, Module
if (Math.Abs(rate) > 0.1d)
{
string massRate = density * rate > 0d ? " - " + PrintMass(rate * density) : string.Empty;
output += Localizer.Format("#autoLOC_244197", title, rate.ToString("0.0") + " " + unitRate + massRate);
output += Localizer.Format("#autoLOC_244197", title, $"{rate:0.0} {unitRate}{massRate}");
}
else if (Math.Abs(rate) > (0.1d / 60d))
{
string massRate = density * rate > 0d ? " - " + PrintMass(rate * density * 60d) : string.Empty;
output += Localizer.Format("#autoLOC_244201", title, (rate * 60d).ToString("0.0") + " " + unitRate + massRate);
output += Localizer.Format("#autoLOC_244201", title, $"{rate * 60d:0.0} {unitRate}{massRate}");
}
else
{
string massRate = density * rate > 0d ? " - " + PrintMass(rate * density * 3600d) : string.Empty;
output += Localizer.Format("#autoLOC_6002411", title, (rate * 3600d).ToString("0.0") + " " + unitRate + massRate);
output += Localizer.Format("#autoLOC_6002411", title, $"{rate * 3600d:0.0} {unitRate}{massRate}");
}
}
else
{
string massRate = density * rate > 0d ? " - " + Localizer.Format(PerSecLocString, PrintMass(rate * density)) : string.Empty;
if (useSI)
output += "- <b>" + title + ": </b>" + PrintSI(rate, unitRate, sigFigs, longPrefix) + massRate + "\n";
output += $"- <b>{title}: </b>{PrintSI(rate, unitRate, sigFigs, longPrefix)}{massRate}\n";
else
output += Localizer.Format("#autoLOC_6002412", title, rate.ToString("0.000"), " " + unitRate + massRate);
output += Localizer.Format("#autoLOC_6002412", title, rate.ToString("0.000"), $" {unitRate}{massRate}");
}
if (showFlowMode && (p != null || definition != null))
{
Expand All @@ -241,7 +241,7 @@ public static string PrintAmount(double amount, int resID, int sigFigs = 3, stri
return PrintSIAmount(amount, rui, sigFigs, longPrefix);
}

return amount.ToString(precision) + " " + unit;
return $"{amount.ToString(precision)} {unit}";
}

public static string PrintSIRate(double rate, string unit, int sigFigs = 3, bool longPrefix = false)
Expand Down
2 changes: 1 addition & 1 deletion Source/ROUtils/SingletonHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void Awake()
HostedSingleton s = (HostedSingleton)Activator.CreateInstance(t, new System.Object[] { this });
_singletons.Add(s);
}
string logstr = "Found and added " + _singletons.Count + " singletons:";
string logstr = $"Found and added {_singletons.Count} singletons:";
foreach (var s in singletonTypes)
logstr += "\n" + s.FullName;
Debug.Log(logstr);
Expand Down

0 comments on commit 0f5973b

Please sign in to comment.