Remove unnecessary value assignment (IDE0059)

This commit is contained in:
Matthias Mailänder
2022-09-18 10:02:00 +02:00
committed by Gustas
parent 757c4d84c7
commit 6bd631618c
19 changed files with 38 additions and 60 deletions

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
var palette = new ImmutablePalette(args[1], new[] { 0 }, Array.Empty<int>());
SequenceProvider sequences = null;
SequenceProvider sequences;
var mapPackage = new Folder(Platform.EngineDir).OpenPackage(args[2], modData.ModFiles);
if (mapPackage != null)
sequences = new Map(modData, mapPackage).Rules.Sequences;

View File

@@ -118,8 +118,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
{
var iniFormat = basicSection.GetValue("NewINIFormat", "0");
var iniFormatVersion = 0;
Exts.TryParseIntegerInvariant(iniFormat, out iniFormatVersion);
Exts.TryParseIntegerInvariant(iniFormat, out var iniFormatVersion);
return iniFormatVersion;
}

View File

@@ -18,8 +18,6 @@ using OpenRA.Mods.Common.UpdateRules;
namespace OpenRA.Mods.Common.UtilityCommands
{
using YamlFileSet = List<(IReadWritePackage, string, List<MiniYamlNode>)>;
class UpdateMapCommand : IUtilityCommand
{
string IUtilityCommand.Name => "--update-map";
@@ -102,15 +100,23 @@ namespace OpenRA.Mods.Common.UtilityCommands
var externalFilenames = new HashSet<string>();
foreach (var rule in rules)
{
Console.WriteLine("{0}: {1}", rule.GetType().Name, rule.Name);
var mapFiles = new YamlFileSet();
var manualSteps = new List<string>();
Console.WriteLine($"{rule.GetType().Name}: {rule.Name}");
Console.Write(" Updating map... ");
try
{
manualSteps = UpdateUtils.UpdateMap(modData, mapPackage, rule, out mapFiles, externalFilenames);
var manualSteps = UpdateUtils.UpdateMap(modData, mapPackage, rule, out var mapFiles, externalFilenames);
// Files are saved after each successful automated rule update
mapFiles.Save();
Console.WriteLine("COMPLETE");
if (manualSteps.Count > 0)
{
Console.WriteLine(" Manual changes are required to complete this update:");
foreach (var manualStep in manualSteps)
Console.WriteLine(" * " + manualStep.Replace("\n", "\n "));
}
}
catch (Exception ex)
{
@@ -119,24 +125,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.WriteLine();
Console.WriteLine(" The automated changes for this rule were not applied because of an error.");
Console.WriteLine(" After the issue reported below is resolved you should run the updater");
Console.WriteLine(" with SOURCE set to {0} to retry these changes", rule.GetType().Name);
Console.WriteLine($" with SOURCE set to {rule.GetType().Name} to retry these changes");
Console.WriteLine();
Console.WriteLine(" The exception reported was:");
Console.WriteLine(" " + ex.ToString().Replace("\n", "\n "));
continue;
}
// Files are saved after each successful automated rule update
mapFiles.Save();
Console.WriteLine("COMPLETE");
if (manualSteps.Count > 0)
{
Console.WriteLine(" Manual changes are required to complete this update:");
foreach (var manualStep in manualSteps)
Console.WriteLine(" * " + manualStep.Replace("\n", "\n "));
}
Console.WriteLine();
}

View File

@@ -167,9 +167,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
foreach (var rule in rules)
{
var manualSteps = new List<string>();
var allFiles = new YamlFileSet();
YamlFileSet allFiles;
LogLine(logWriter, "{0}: {1}", rule.GetType().Name, rule.Name);
LogLine(logWriter, $"{rule.GetType().Name}: {rule.Name}");
try
{