Removed redundant statements

This commit is contained in:
Samuele Lorefice
2025-03-12 00:55:23 +01:00
parent 5b8158ea1a
commit c0bc1f0a0f
4 changed files with 19 additions and 24 deletions

View File

@@ -30,7 +30,7 @@ public class Reader {
public List<object> GetObjects() => objects.Values.ToList();
public List<T> GetObjects<T>() => objects.Values.OfType<T>().ToList();
private SortedDictionary<long, Kaitai.BlendFile.FileBlock> memBlocks = new();
private SortedDictionary<long, FileBlock> memBlocks = new();
/// <summary>
/// Gets the block at the specified memory address
@@ -73,7 +73,7 @@ public class Reader {
Console.WriteLine($"Start offset: 0x{blend.Blocks[0].MemAddr.ToPointer():X}");
bool isLe = blend.Hdr.Endian == Kaitai.BlendFile.Endian.Le;
bool isLe = blend.Hdr.Endian == Endian.Le;
//TODO: two blocks somehow have the same mem address... this sounds wrong.
blend.Blocks.ForEach(block => memBlocks.TryAdd(block.MemAddr.ToMemAddr(isLe), block));
@@ -242,12 +242,11 @@ public class Reader {
array[i / itemLenght] = ConvertFieldData(itemData, attrib.OriginalType);
}
return array;
} else {
//Convert the data to the correct type if it's a base type
object? value = ConvertFieldData(data, attrib.OriginalType);
if (value != null) return value;
}
//Convert the data to the correct type if it's a base type
object? value = ConvertFieldData(data, attrib.OriginalType);
if (value != null) return value;
//Check if the field is a pointer to another DNA structure
if (dnaTypesDb.ContainsKey(attrib.OriginalType)) {
if (!attrib.IsPointer) { //It's a structure