public static List <Property> getPropList(UDKFile udk, UDKFile.ExportEntry export) { Application.DoEvents(); int start = detectStart(udk, export.Data, export.ObjectFlags); return(ReadProp(udk, export.Data, start)); }
public static Property getPropOrNull(UDKFile udk, UDKFile.ExportEntry export, string propName) { List <Property> props = getPropList(udk, export); foreach (Property prop in props) { if (udk.getName(prop.Name) == propName) { return(prop); } } return(null); }
private bool importExport(UDKFile importudk, int n, int link) { UDKFile.ExportEntry ex = importudk.Exports[n]; UDKFile.ExportEntry nex = new UDKFile.ExportEntry(); byte[] idata = ex.Data; List<PropertyReader.Property> Props = PropertyReader.getPropList(importudk, ex); int start = PropertyReader.detectStart(importudk, idata, importudk.Exports[n].ObjectFlags); int end = start; if (Props.Count != 0) { end = Props[Props.Count - 1].offend; } MemoryStream res = new MemoryStream(); if ((importudk.Exports[n].ObjectFlags & (ulong)UnrealFlags.EObjectFlags.HasStack) != 0) { byte[] stackdummy = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //Lets hope for the best :D 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,}; res.Write(stackdummy, 0, stackdummy.Length); } else { res.Write(new byte[start], 0, start); } //store copy of names list in case something goes wrong List<UDKFile.NameEntry> names = udk.Names.ToList(); try { foreach (PropertyReader.Property p in Props) { PropertyReader.ImportProperty(udk, importudk, p, importudk.getObjectName(ex.idxClass), res); } } catch (Exception exception) { //restore namelist udk.Names = names; MessageBox.Show("Error occured while trying to import " + ex.ObjectName + " : " + exception.Message); return false; } for (int i = end; i < idata.Length; i++) res.WriteByte(idata[i]); nex.header = (byte[])ex.header.Clone(); nex.Data = res.ToArray(); nex.DataSize = nex.Data.Length; nex.idxObjectName = udk.FindNameOrAdd(importudk.getName(ex.idxObjectName)); nex.idxLink = link; nex.idxArchtype = nex.idxClass = nex.idxClassParent = 0; nex.udkRef = udk; udk.addExport(nex); return true; }