예제 #1
0
        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();
            }
        }
예제 #2
0
        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);
        }