Skip to content

Commit

Permalink
String interpolation sanitation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesterKing committed May 10, 2016
1 parent 0ed0f2b commit 81f0e24
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Commands/ChangeSamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode)
if (get_rc == GetResult.Number)
{
var nr = get_number.Number();
RhinoApp.WriteLine(string.Format("User changes samples to {0}", nr));
RhinoApp.WriteLine($"User changes samples to {nr}");
rvp.ChangeSamples(nr);
return Result.Success;
}
Expand Down
8 changes: 3 additions & 5 deletions Commands/ListDevices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode)
Plugin.InitialiseCSycles();

var num_devices = Device.Count;
RhinoApp.WriteLine(String.Format("We have {0} device{1}", num_devices, num_devices != 1 ? "s" : ""));
var end_s = num_devices != 1 ? "s" : "";
RhinoApp.WriteLine($"We have {num_devices} device{end_s}");
RhinoApp.WriteLine("----------");
foreach (var dev in Device.Devices)
{
RhinoApp.WriteLine(String.Format(" Device {0}: {1} > {2} > {3} | {4} | {5} | {6} | {7}", dev.Id,
dev.Name, dev.Description, dev.Num,
dev.DisplayDevice, dev.AdvancedShading,
dev.PackImages, dev.Type));
RhinoApp.WriteLine($" Device {dev.Id}: {dev.Name} > {dev.Description} > {dev.Num} | {dev.DisplayDevice} | {dev.AdvancedShading} | {dev.PackImages} | {dev.Type}");
}
RhinoApp.WriteLine("----------");
return Result.Success;
Expand Down
2 changes: 1 addition & 1 deletion Commands/SetRenderOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode)
switch (get_rc)
{
case GetResult.Number:
RhinoApp.WriteLine(String.Format("We got: {0}, {1}, {2}", get_number.Number(), min_bounce.CurrentValue, max_bounce.CurrentValue));
RhinoApp.WriteLine($"We got: {get_number.Number()}, {min_bounce.CurrentValue}, {max_bounce.CurrentValue}");
RcCore.It.EngineSettings.Samples = (int)get_number.Number();
RcCore.It.EngineSettings.UseCustomQualitySettings = use_custom_settings.CurrentValue;
RcCore.It.EngineSettings.Seed = seed.CurrentValue;
Expand Down
5 changes: 3 additions & 2 deletions Commands/SetThreads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode)
get_number.SetLowerLimit(0, false);
get_number.SetUpperLimit(Environment.ProcessorCount, false);
get_number.SetDefaultInteger(RcCore.It.EngineSettings.Threads);
get_number.SetCommandPrompt(String.Format("Set CPU render threads (max {0}, 0 for automatic)", Environment.ProcessorCount));
get_number.SetCommandPrompt($"Set CPU render threads (max {Environment.ProcessorCount}, 0 for automatic)");
var get_rc = get_number.Get();
if (get_number.CommandResult() != Result.Success) return get_number.CommandResult();
if (get_rc == GetResult.Number)
{
var nr = get_number.Number();
RhinoApp.WriteLine(String.Format("User wants {0} CPU thread{1}", nr, nr > 0 ? "s" : ""));
var end_s = nr != 1 ? "s" : "";
RhinoApp.WriteLine($"User wants {nr} CPU thread{end_s}");
RcCore.It.EngineSettings.Threads = nr;
return Result.Success;
}
Expand Down
2 changes: 1 addition & 1 deletion Commands/ShowDeviceCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override string EnglishName
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
var capabilities = Device.Capabilities;
RhinoApp.WriteLine(String.Format("The following capabilities have been found by Cycles:\n----------\n{0}\n\n----------", capabilities));
RhinoApp.WriteLine($"The following capabilities have been found by Cycles:\n----------\n{capabilities}\n\n----------");
return Result.Success;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Commands/ShowInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode)
var csycles_fvi = FileVersionInfo.GetVersionInfo(csycles_ass.Location);

RhinoApp.WriteLine("----------");
RhinoApp.WriteLine("RhinoCycles {0} @ {1}", RhinoBuildConstants.VERSION_STRING, rhcycles_ass.Location);
RhinoApp.WriteLine("CCSycles {0} @ {1}", csycles_fvi.FileVersion, csycles_ass.Location);
RhinoApp.WriteLine($"RhinoCycles {RhinoBuildConstants.VERSION_STRING} @ {rhcycles_ass.Location}");
RhinoApp.WriteLine($"CCSycles {csycles_fvi.FileVersion} @ {csycles_ass.Location}");
RhinoApp.WriteLine("----------");
return Result.Success;
}
Expand Down
10 changes: 5 additions & 5 deletions Commands/ShowPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode)
Plugin.InitialiseCSycles();

RhinoApp.WriteLine("----------");
RhinoApp.WriteLine("Absolute path {0}", RcCore.It.KernelPath);
RhinoApp.WriteLine("Relative path {0}", RcCore.It.KernelPathRelative);
RhinoApp.WriteLine("Plug-in path {0}", RcCore.It.PluginPath);
RhinoApp.WriteLine("App path {0}", RcCore.It.AppPath);
RhinoApp.WriteLine("User data path {0}", RcCore.It.DataUserPath);
RhinoApp.WriteLine($"Absolute path {RcCore.It.KernelPath}");
RhinoApp.WriteLine($"Relative path {RcCore.It.KernelPathRelative}");
RhinoApp.WriteLine($"Plug-in path {RcCore.It.PluginPath}");
RhinoApp.WriteLine($"App path {RcCore.It.AppPath}");
RhinoApp.WriteLine($"User data path {RcCore.It.DataUserPath}");
RhinoApp.WriteLine("----------");
return Result.Success;
}
Expand Down
2 changes: 1 addition & 1 deletion Commands/ToggleShaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override string EnglishName
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
RcCore.It.EngineSettings.UseSimpleShaders = !RcCore.It.EngineSettings.UseSimpleShaders;
RhinoApp.WriteLine("UseSimpleShaders set to {0}", RcCore.It.EngineSettings.UseSimpleShaders);
RhinoApp.WriteLine($"UseSimpleShaders set to {RcCore.It.EngineSettings.UseSimpleShaders}");
return Result.Success;
}
}
Expand Down

0 comments on commit 81f0e24

Please sign in to comment.