using System; using System.ComponentModel; using UnityEngine.ResourceManagement.Util; namespace UnityEngine.ResourceManagement.ResourceProviders { /// /// Converts ray binary data into the requested object. /// [DisplayName("Binary Asset Provider")] internal class BinaryAssetProvider : BinaryDataProvider where TAdapter : BinaryStorageBuffer.ISerializationAdapter, new() { /// /// Converts raw bytes into requested object type via BinaryStorageBuffer.ISerializationAdapter /// /// The object type the text is converted to. /// The data to convert. /// Returns the converted object. public override object Convert(Type type, byte[] data) { return new BinaryStorageBuffer.Reader(data, 512, new TAdapter()).ReadObject(type, 0, false); } } }