Formatting (again)

This commit is contained in:
Samuele Lorefice
2025-05-02 16:25:03 +02:00
parent a7337dd1d6
commit f03d907441

View File

@@ -49,9 +49,7 @@ public class Reader {
/// </summary>
/// <param name="memAddr">memory address in current system endianness</param>
/// <returns>A <see cref="Kaitai.BlendFile.FileBlock"/> object</returns>
public FileBlock? GetBlock(long memAddr)
{
public FileBlock? GetBlock(long memAddr) {
var blocks = OrderedBlocks.Where(x =>
memAddr >= x.MemAddr.ToPointer() && memAddr < x.MemAddr.ToPointer() + x.LenBody);
@@ -299,8 +297,7 @@ public class Reader {
return null;
}
private static int[] CalculateArrayIndices(List<int> sizes, int index)
{
private static int[] CalculateArrayIndices(List<int> sizes, int index) {
int[] indexArray = new int[sizes.Count];
for (int k = 0; k < sizes.Count; k++) {
indexArray[k] = index / sizes[(k + 1) ..].Aggregate(1, (a, b) => a * b) % sizes[k];
@@ -310,8 +307,7 @@ public class Reader {
}
private Array FillPointersArray(DNAArrayAttribute arrayAttribute, byte[] data,
Type type, List<int> sizes)
{
Type type, List<int> sizes) {
//Create the array
var array = Array.CreateInstance(type, sizes.ToArray());
@@ -330,8 +326,8 @@ public class Reader {
return array;
}
private Array FillNormalTypeArray(DNAArrayAttribute arrayAttribute, byte[] data, FileBlock block, Type type, List<int> sizes, int itemLenght, int offset)
{
private Array FillNormalTypeArray(DNAArrayAttribute arrayAttribute, byte[] data, FileBlock block, Type type,
List<int> sizes, int itemLenght, int offset) {
var array = Array.CreateInstance(type, sizes.ToArray());
for (int i = 0; i < arrayAttribute.Size; i += itemLenght) {
@@ -347,8 +343,8 @@ public class Reader {
return array;
}
private Array FillCustomTypeArray(DNAArrayAttribute arrayAttribute, byte[] data, FileBlock block, Type type, List<int> sizes, int itemLenght, int offset)
{
private Array FillCustomTypeArray(DNAArrayAttribute arrayAttribute, byte[] data, FileBlock block, Type type,
List<int> sizes, int itemLenght, int offset) {
var array = Array.CreateInstance(type, sizes.ToArray());
for (int i = 0; i < arrayAttribute.Size; i += itemLenght) {
@@ -385,14 +381,13 @@ public class Reader {
}
if (!dnaTypesDb.ContainsKey(arrayAttribute.OriginalType)) {
return FillNormalTypeArray(arrayAttribute, data, block, type, sizes, arrayAttribute.OriginalType.ParseFSize()!.Value, offset.ToInt32());
return FillNormalTypeArray(arrayAttribute, data, block, type, sizes,
arrayAttribute.OriginalType.ParseFSize()!.Value, offset.ToInt32());
}
int itemLenght = type.GetCustomAttribute<DNAFieldAttribute>()?.Size ??
type.GetCustomAttribute<DNAClassAttribute>()!.Size;
return FillCustomTypeArray(arrayAttribute, data, block, type, sizes, itemLenght, offset.ToInt32());
}
private object? ConvertListField(FileBlock block, FieldInfo field, DNAListAttribute attrib, IntPtr startOffset) {