Unrolled loops so the debugger works
This commit is contained in:
@@ -98,16 +98,16 @@ public class Reader {
|
|||||||
blockOffset += t.GetCustomAttribute<DNAClassAttribute>()!.Size;
|
blockOffset += t.GetCustomAttribute<DNAClassAttribute>()!.Size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
objects.AsParallel().ForAll(x =>
|
foreach (var obj in objects) {
|
||||||
{
|
FieldInfo[] fieldInfo = obj.Value.GetType().GetFields();
|
||||||
FieldInfo[] fieldInfo = x.Value.GetType().GetFields();
|
var list = fieldInfo.Where(fldInfo => fldInfo.GetCustomAttribute<DNAFieldAttribute>()!.IsPointer).ToList();
|
||||||
fieldInfo.Where(fldInfo => fldInfo.GetCustomAttribute<DNAFieldAttribute>()!.IsPointer).ToList().ForEach(f =>
|
|
||||||
{
|
foreach(var f in list) {
|
||||||
var addr = GetBlockFieldDataOffset(x.Key.Item1, f.GetCustomAttribute<DNAFieldAttribute>()!.OriginalIndex, fieldInfo);
|
var addr = GetBlockFieldDataOffset(obj.Key.Item1, f.GetCustomAttribute<DNAFieldAttribute>()!.OriginalIndex, fieldInfo);
|
||||||
var obj = objects.GetValueOrDefault((addr, f.FieldType));
|
var newobj = objects.GetValueOrDefault((addr, f.FieldType));
|
||||||
if (obj != null) f.SetValue(x.Value, obj);
|
if (newobj != null) f.SetValue(obj.Value, newobj);
|
||||||
});
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -163,7 +163,6 @@ public class Reader {
|
|||||||
|
|
||||||
if(value == null){ //if the data could not be converted
|
if(value == null){ //if the data could not be converted
|
||||||
//Check if the field is a pointer to another DNA structure
|
//Check if the field is a pointer to another DNA structure
|
||||||
//if (dnaTypes.Values.FirstOrDefault(x => x.GetCustomAttribute<DNAClassAttribute>()!.OriginalName == attrib.OriginalType) != null) {
|
|
||||||
if (dnaTypesDb.ContainsKey(attrib.OriginalType)) {
|
if (dnaTypesDb.ContainsKey(attrib.OriginalType)) {
|
||||||
//Create a new instance of the DNA structure type
|
//Create a new instance of the DNA structure type
|
||||||
object? newObj = ActivateInstance(attrib.OriginalType);
|
object? newObj = ActivateInstance(attrib.OriginalType);
|
||||||
|
|||||||
Reference in New Issue
Block a user