using System;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset.Editor
{
    [Serializable]
    public class AssetInfo
    {
        private string _fileExtension = null;
        /// 
        /// 资源路径
        /// 
        public string AssetPath;
        /// 
        /// 资源GUID
        /// 
        public string AssetGUID;
        /// 
        /// 资源类型
        /// 
        public System.Type AssetType;
        /// 
        /// 文件格式
        /// 
        public string FileExtension
        {
            get
            {
                if (string.IsNullOrEmpty(_fileExtension))
                    _fileExtension = System.IO.Path.GetExtension(AssetPath);
                return _fileExtension;
            }
        }
        public AssetInfo(string assetPath)
        {
            AssetPath = assetPath;
            AssetGUID = UnityEditor.AssetDatabase.AssetPathToGUID(AssetPath);
            AssetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(AssetPath);
        }
        /// 
        /// 是否为着色器资源
        /// 
        public bool IsShaderAsset()
        {
            if (AssetType == typeof(UnityEngine.Shader) || AssetType == typeof(UnityEngine.ShaderVariantCollection))
                return true;
            else
                return false;
        }
    }
}