mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
* Pull up release and editor methods * Change universal methods into extensions * Remove Version, Platform, and Flags from AssetReader and AssetWriter
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using AssetRipper.Assets.Export;
|
|
using AssetRipper.Assets.Export.Yaml;
|
|
using AssetRipper.IO.Files;
|
|
using AssetRipper.Yaml;
|
|
|
|
namespace AssetRipper.Assets.Metadata
|
|
{
|
|
public readonly record struct MetaPtr(long FileID, UnityGUID GUID, AssetType AssetType) : IYamlExportable
|
|
{
|
|
public MetaPtr(long fileID) : this(fileID, UnityGUID.Zero, AssetType.Serialized)
|
|
{
|
|
}
|
|
|
|
public YamlNode ExportYaml()
|
|
{
|
|
YamlMappingNode node = new();
|
|
node.Style = MappingStyle.Flow;
|
|
node.Add(FileIDName, FileID);
|
|
if (!GUID.IsZero)
|
|
{
|
|
node.Add(GuidName, GUID.ToString());
|
|
node.Add(TypeName, (int)AssetType);
|
|
}
|
|
return node;
|
|
}
|
|
|
|
public static MetaPtr NullPtr { get; } = new MetaPtr(0);
|
|
|
|
public static MetaPtr CreateMissingReference(int classID, AssetType assetType)
|
|
{
|
|
return new MetaPtr(ExportIdHandler.GetMainExportID((uint)classID), UnityGUID.MissingReference, assetType);
|
|
}
|
|
|
|
YamlNode IYamlExportable.ExportYamlEditor(IExportContainer container) => ExportYaml();
|
|
|
|
YamlNode IYamlExportable.ExportYamlRelease(IExportContainer container) => ExportYaml();
|
|
|
|
private const string FileIDName = "fileID";
|
|
private const string GuidName = "guid";
|
|
private const string TypeName = "type";
|
|
}
|
|
}
|