Fix RCS1257, RCS1258, RCS1261, RCS1262, RCS1265, RCS1266, RCS1267

This commit is contained in:
RoosterDragon
2024-11-25 22:19:51 +00:00
committed by Gustas Kažukauskas
parent a324af1afd
commit 1b2c119b58
23 changed files with 59 additions and 40 deletions

View File

@@ -12,7 +12,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.Primitives;
namespace OpenRA.Mods.Cnc.AudioLoaders
@@ -186,7 +185,7 @@ namespace OpenRA.Mods.Cnc.AudioLoaders
// See if last block contained additional information
if (blockList.Count > 0)
{
var b = blockList.Last();
var b = blockList[^1];
if (b.Code == 8)
{
block.SampleBlock.Rate = b.SampleBlock.Rate;

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.FileFormats
if (pos != 0)
name = name[..pos];
Filename = string.Concat(name, ".wav");
Filename = $"{name}.wav";
Offset = s.ReadUInt32();
Length = s.ReadUInt32();
SampleRate = s.ReadUInt32();

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
[Desc("PNGFILE [PNGFILE ...]", "Combine a list of PNG images into a SHP")]
void IUtilityCommand.Run(Utility utility, string[] args)
{
var inputFiles = GlobArgs(args).OrderBy(a => a).ToList();
var inputFiles = GlobArgs(args).Order().ToList();
var dest = inputFiles[0].Split('-').First() + ".shp";
var frames = inputFiles.ConvertAll(a => new Png(File.OpenRead(a)));

View File

@@ -139,7 +139,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
if (!string.IsNullOrEmpty(foundation))
{
var dimensions = foundation.Split('x');
if (dimensions[0] == "0" || dimensions.Last() == "0")
if (dimensions[0] == "0" || dimensions[^1] == "0")
Console.WriteLine("\tImmobile:\n \t\tOccupiesSpace: False");
else
{
@@ -149,11 +149,11 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
if (!string.IsNullOrEmpty(adjacent))
Console.WriteLine("\t\tAdjacent: " + adjacent);
Console.WriteLine("\t\tDimensions: " + dimensions[0] + "," + dimensions.Last());
Console.WriteLine("\t\tDimensions: " + dimensions[0] + "," + dimensions[^1]);
Console.Write("\t\tFootprint:");
int.TryParse(dimensions[0], out var width);
int.TryParse(dimensions.Last(), out var height);
int.TryParse(dimensions[^1], out var height);
for (var y = 0; y < height; y++)
{
Console.Write(" ");

View File

@@ -10,7 +10,6 @@
#endregion
using System.IO;
using System.Linq;
using OpenRA.Mods.Cnc.FileFormats;
using OpenRA.Video;
@@ -65,7 +64,7 @@ namespace OpenRA.Mods.Cnc.VideoLoaders
s.Position = start;
return s.Length == offsets.Last();
return s.Length == offsets[^1];
}
}
}