public override void Read(AssetReader reader) { base.Read(reader); if (HasInternalIDToNameTable(reader.Version)) { if (IncludesIDToName) { InternalIDToNameTable = new Dictionary <Tuple <ClassIDType, long>, string>(); InternalIDToNameTable.Read(reader, (t) => (ClassIDType)t); } } else if (FileIDToRecycleNameRelevant(reader.Version)) { if (!IsFileIDToRecycleNameConditional(reader.Version) || IncludesIDToName) { if (PPtr <Object> .IsLongID(reader.Version)) { FileIDToRecycleName = new Dictionary <long, string>(); FileIDToRecycleName.Read(reader); } else { Dictionary <int, string> fileIDToRecycleName = new Dictionary <int, string>(); fileIDToRecycleName.Read(reader); FileIDToRecycleNameInt = fileIDToRecycleName; } } } if (HasPreview(reader.Version)) { Preview.Read(reader); } if (HasHash(reader.Version)) { OldHashIdentity.Read(reader); NewHashIdentity.Read(reader); } if (HasExternalObjects(reader.Version)) { ExternalObjects = new Dictionary <SourceAssetIdentifier, PPtr <Object> >(); ExternalObjects.Read(reader); if (IsAlignExternalObjects(reader.Version)) { reader.AlignStream(); } } if (HasUsedFileIDs(reader.Version)) { UsedFileIDs = reader.ReadInt64Array(); reader.AlignStream(); } }
public override void Write(AssetWriter writer) { base.Write(writer); if (HasInternalIDToNameTable(writer.Version)) { if (IncludesIDToName) { InternalIDToNameTable.Write(writer, (t) => (int)t); } } else if (FileIDToRecycleNameRelevant(writer.Version)) { if (!IsFileIDToRecycleNameConditional(writer.Version) || IncludesIDToName) { if (PPtr <Object> .IsLongID(writer.Version)) { FileIDToRecycleName.Write(writer); } else { FileIDToRecycleNameInt.Write(writer); } } } if (HasPreview(writer.Version)) { Preview.Write(writer); } if (HasHash(writer.Version)) { OldHashIdentity.Write(writer); NewHashIdentity.Write(writer); } if (HasExternalObjects(writer.Version)) { ExternalObjects.Write(writer); if (IsAlignExternalObjects(writer.Version)) { writer.AlignStream(); } } if (HasUsedFileIDs(writer.Version)) { UsedFileIDs.Write(writer); writer.AlignStream(); } }
protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = new YAMLMappingNode(); if (HasInternalIDToNameTable(container.ExportVersion)) { if (IncludesIDToName) { node.Add(InternalIDToNameTableName, InternalIDToNameTable.ExportYAML((t) => (int)t)); } } else if (FileIDToRecycleNameRelevant(container.ExportVersion)) { if (!IsFileIDToRecycleNameConditional(container.ExportVersion) || IncludesIDToName) { node.Add(FileIDToRecycleNameName, FileIDToRecycleName.ExportYAML()); } } if (HasExternalObjects(container.ExportVersion)) { node.Add(ExternalObjectsName, ExternalObjects.ExportYAML(container)); } if (HasUsedFileIDs(container.ExportVersion)) { node.Add(UsedFileIDsName, UsedFileIDs.ExportYAML(false)); } if (HasPreview(container.ExportVersion)) { node.Add(PreviewName, Preview.ExportYAML(container)); } if (HasHash(container.ExportVersion)) { node.Add(OldHashIdentityName, OldHashIdentity.ExportYAML(container)); node.Add(NewHashIdentityName, NewHashIdentity.ExportYAML(container)); } return(node); }