public override bool ResolveLinks() { var result = base.ResolveLinks(); OuterClass = PCC.GetExportObject(_OuterClassIndex) as ME3Class; ImplementedInterfaces = new List <ME3Class>(); Components = new List <ME3Object>(); FunctionRefs = new List <ME3Function>(); foreach (var interfaceRef in _ImplInterfaces) // TODO: overhaul to objectableentry, or provide native object support. { var obj = PCC.GetExportObject(interfaceRef.ClassIndex); if (obj != null) { ImplementedInterfaces.Add(obj as ME3Class); } } foreach (var component in _Components) // TODO: overhaul to objectableentry, or provide native object support. { var obj = PCC.GetExportObject(component.ComponentObjectIndex); if (obj != null) { Components.Add(obj); } } foreach (var funcRef in _FunctionRefs) // TODO: overhaul { var entry = PCC.GetObjectEntry(funcRef); if (entry != null) // TODO: this shoud probably never happen. { ME3Function func = entry.Object as ME3Function; FunctionRefs.Add(func); } } States = new List <ME3State>(); foreach (var state in Members.Where(s => typeof(ME3State) == s.GetType())) { States.Add(state as ME3State); } return(result); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); OuterClass = PCC.GetExportObject(_OuterClassIndex) as ME3Class; ImplementedInterfaces = new List<ME3Class>(); Components = new List<ME3Object>(); FunctionRefs = new List<ME3Function>(); foreach (var interfaceRef in _ImplInterfaces) // TODO: overhaul to objectableentry, or provide native object support. { var obj = PCC.GetExportObject(interfaceRef.ClassIndex); if (obj != null) ImplementedInterfaces.Add(obj as ME3Class); } foreach (var component in _Components) // TODO: overhaul to objectableentry, or provide native object support. { var obj = PCC.GetExportObject(component.ComponentObjectIndex); if (obj != null) Components.Add(obj); } foreach (var funcRef in _FunctionRefs) // TODO: overhaul { var entry = PCC.GetObjectEntry(funcRef); if (entry != null) // TODO: this shoud probably never happen. { ME3Function func = entry.Object as ME3Function; FunctionRefs.Add(func); } } States = new List<ME3State>(); foreach (var state in Members.Where(s => typeof(ME3State) == s.GetType())) States.Add(state as ME3State); return result; }
public ME3ObjectConverter(ME3Class classObject) { Object = classObject; }
private bool DeserializeExportObject(ExportTableEntry entry) { switch (entry.ClassName) { case "Class": var classObj = new ME3Class(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = classObj; return classObj.Deserialize(); case "Function": var funcObj = new ME3Function(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = funcObj; return funcObj.Deserialize(); case "Struct": var structObj = new ME3Struct(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = structObj; return structObj.Deserialize(); case "ScriptStruct": var scriptstructObj = new ME3ScriptStruct(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = scriptstructObj; return scriptstructObj.Deserialize(); case "Enum": var enumObj = new ME3Enum(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = enumObj; return enumObj.Deserialize(); case "Const": var constObj = new ME3Const(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = constObj; return constObj.Deserialize(); case "State": var stateObj = new ME3State(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = stateObj; return stateObj.Deserialize(); case "ArrayProperty": var arrayProp = new ME3ArrayProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = arrayProp; return arrayProp.Deserialize(); case "IntProperty": var intProp = new ME3IntProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = intProp; return intProp.Deserialize(); case "BoolProperty": var boolProp = new ME3BoolProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = boolProp; return boolProp.Deserialize(); case "ByteProperty": var byteProp = new ME3ByteProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = byteProp; return byteProp.Deserialize(); case "ObjectProperty": var objectProp = new ME3ObjectProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = objectProp; return objectProp.Deserialize(); case "ClassProperty": var classProp = new ME3ClassProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = classProp; return classProp.Deserialize(); case "ComponentProperty": var compProp = new ME3ComponentProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = compProp; return compProp.Deserialize(); case "DelegateProperty": var deleProp = new ME3DelegateProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = deleProp; return deleProp.Deserialize(); case "FixedArrayProperty": var fixedProp = new ME3FixedArrayProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = fixedProp; return fixedProp.Deserialize(); case "FloatProperty": var floatProp = new ME3FloatProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = floatProp; return floatProp.Deserialize(); case "InterfaceProperty": var interfaceProp = new ME3InterfaceProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = interfaceProp; return interfaceProp.Deserialize(); case "NameProperty": var nameProp = new ME3NameProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = nameProp; return nameProp.Deserialize(); case "StrProperty": var strProp = new ME3StrProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = strProp; return strProp.Deserialize(); case "StructProperty": var structProp = new ME3StructProperty(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = structProp; return structProp.Deserialize(); default : var obj = new ME3Object(Data.GetReader(entry.FileOffset, entry.Size), entry, this); entry.Object = obj; return obj.Deserialize(); } }