/// <summary> /// Creates an ImportEntry that references the listed ExportEntry. Ensure the item will be in memory or this will crash the game! /// </summary> /// <param name="sourceExport"></param> /// <param name="targetPackage"></param> /// <returns></returns> public static ImportEntry CreateImportForClass(ExportEntry sourceExport, IMEPackage targetPackage, IEntry parentObject = null) { if (sourceExport.ClassName != "Class") { throw new Exception("Cannot reliably create import for non-class object!"); } var existingImport = targetPackage.FindImport(sourceExport.InstancedFullPath); if (existingImport != null) { return(existingImport); } ImportEntry imp = new ImportEntry(targetPackage) { ObjectName = sourceExport.ObjectName, PackageFile = "Core", //Risky... ClassName = sourceExport.ClassName, idxLink = parentObject?.UIndex ?? 0, }; targetPackage.AddImport(imp); return(imp); }