Skip to content

Commit ec6754a

Browse files
committed
Replace tuple with record struct in color generation
1 parent bc4d0f5 commit ec6754a

File tree

1 file changed

+13
-8
lines changed
  • AssetRipper.TextureDecoder.ColorGenerator

1 file changed

+13
-8
lines changed

AssetRipper.TextureDecoder.ColorGenerator/Program.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,23 @@ internal static partial class Program
1313
private const string FormatsNamespace = "AssetRipper.TextureDecoder.Rgb.Formats";
1414
private const string FormatsFolder = "../../../../AssetRipper.TextureDecoder/Rgb/Formats/";
1515

16-
/// <summary>
17-
/// Name, Type, Red, Blue, Green, Alpha, Fully Utilized
18-
/// </summary>
19-
private static readonly List<(string, Type, bool, bool, bool, bool, bool)> CustomColors = new()
16+
private readonly record struct CustomColorDetails(string Name, Type Type, bool HasRed, bool HasGreen, bool HasBlue, bool HasAlpha, bool FullyUtilized)
2017
{
18+
public static implicit operator CustomColorDetails((string, Type, bool, bool, bool, bool, bool) details)
19+
{
20+
return new CustomColorDetails(details.Item1, details.Item2, details.Item3, details.Item4, details.Item5, details.Item6, details.Item7);
21+
}
22+
}
23+
24+
private static readonly CustomColorDetails[] CustomColors =
25+
[
2126
( "ColorARGB16", typeof(byte), true, true, true, true, false ),
2227
( "ColorRGB16", typeof(byte), true, true, true, false, false ),
2328
( "ColorRGB9e5", typeof(double), true, true, true, false, false ),
2429
( "ColorRGBA16", typeof(byte), true, true, true, true, false ),
25-
};
30+
];
2631

27-
private static readonly List<string> GenericColors =
32+
private static readonly string[] GenericColors =
2833
[
2934
"ColorR",
3035
"ColorRG",
@@ -38,7 +43,7 @@ internal static partial class Program
3843

3944
static void Main()
4045
{
41-
foreach (var customColor in CustomColors)
46+
foreach (CustomColorDetails customColor in CustomColors)
4247
{
4348
WriteCustomColor(customColor);
4449
}
@@ -54,7 +59,7 @@ static void Main()
5459
Console.WriteLine("Done!");
5560
}
5661

57-
private static void WriteCustomColor((string, Type, bool, bool, bool, bool, bool) details)
62+
private static void WriteCustomColor(CustomColorDetails details)
5863
{
5964
(string name, Type type, bool hasRed, bool hasGreen, bool hasBlue, bool hasAlpha, bool fullyUtilized) = details;
6065
Console.WriteLine(name);

0 commit comments

Comments
 (0)