public object GetValue() { return(Value switch { UObject uObject => uObject.GetJsonDict(), FAssetData fAssetData => fAssetData.GetValue(), FAssetDataTagMapSharedView fAssetDataTagMapSharedView => fAssetDataTagMapSharedView.Map, FAssetIdentifier fAssetIdentifier => fAssetIdentifier.GetValue(), FAssetPackageData fAssetPackageData => fAssetPackageData.GetValue(), FGameplayTagContainer fGameplayTagContainer => fGameplayTagContainer.GetValue(), FSoftObjectPath fSoftObjectPath => fSoftObjectPath.GetValue(), FGuid fGuid => fGuid.Hex, _ => Value });
public AssetRegistryFile(BinaryReader reader) { var Version = FAssetRegistryVersion.DeserializeVersion(reader); if (Version < FAssetRegistryVersion.Type.AddedCookedMD5Hash) { throw new FileLoadException("Cannot read states before this version"); } var nameReader = new FNameTableArchiveReader(reader); var LocalNumAssets = reader.ReadInt32(); PreallocatedAssetDataBuffer = new FAssetData[LocalNumAssets]; for (int i = 0; i < LocalNumAssets; i++) { PreallocatedAssetDataBuffer[i] = new FAssetData(nameReader); } var LocalNumDependsNodes = reader.ReadInt32(); PreallocatedDependsNodeDataBuffer = new FDependsNode[LocalNumDependsNodes]; for (int i = 0; i < LocalNumDependsNodes; i++) { PreallocatedDependsNodeDataBuffer[i] = new FDependsNode(); } SortedList <EAssetRegistryDependencyType, int> DepCounts = new SortedList <EAssetRegistryDependencyType, int>(); for (int i = 0; i < LocalNumDependsNodes; i++) { FAssetIdentifier AssetIdentifier = new FAssetIdentifier(nameReader); DepCounts[EAssetRegistryDependencyType.Hard] = reader.ReadInt32(); DepCounts[EAssetRegistryDependencyType.Soft] = reader.ReadInt32(); DepCounts[EAssetRegistryDependencyType.SearchableName] = reader.ReadInt32(); DepCounts[EAssetRegistryDependencyType.SoftManage] = reader.ReadInt32(); DepCounts[EAssetRegistryDependencyType.HardManage] = Version < FAssetRegistryVersion.Type.AddedHardManage ? 0 : reader.ReadInt32(); DepCounts[0] = reader.ReadInt32(); PreallocatedDependsNodeDataBuffer[i].Identifier = AssetIdentifier; PreallocatedDependsNodeDataBuffer[i].Reserve(DepCounts); SerializeDependencyType(EAssetRegistryDependencyType.Hard, i); SerializeDependencyType(EAssetRegistryDependencyType.Soft, i); SerializeDependencyType(EAssetRegistryDependencyType.SearchableName, i); SerializeDependencyType(EAssetRegistryDependencyType.SoftManage, i); SerializeDependencyType(EAssetRegistryDependencyType.HardManage, i); SerializeDependencyType(0, i); } void SerializeDependencyType(EAssetRegistryDependencyType InDependencyType, int AssetIndex) { for (int i = 0; i < DepCounts[InDependencyType]; ++i) { int index = reader.ReadInt32(); if (index < 0 || index >= LocalNumDependsNodes) { throw new FileLoadException("could you please serialize your assetregistry correctly"); } PreallocatedDependsNodeDataBuffer[AssetIndex].Add(index, InDependencyType); } } int LocalNumPackageData = reader.ReadInt32(); PreallocatedPackageDataBuffer = new FAssetPackageData[LocalNumPackageData]; var bSerializeHash = Version < FAssetRegistryVersion.Type.AddedCookedMD5Hash; for (int i = 0; i < LocalNumPackageData; i++) { PreallocatedPackageDataBuffer[i] = new FAssetPackageData(nameReader, bSerializeHash); } }