예제 #1
0
파일: PPtr.cs 프로젝트: wyfleb/UtinyRipper
        public T GetAsset(IAssetContainer file)
        {
            if (IsNull)
            {
                throw new Exception("Can't get null PPtr");
            }
            Object asset = file.GetAsset(FileIndex, PathID);

            if (asset is T t)
            {
                return(t);
            }
            throw new Exception($"Object's type {asset.ClassID} isn't assignable from {typeof(T).Name}");
        }
        public static string GetAssetLogString(this IAssetContainer _this, long pathID)
        {
            Object asset = _this.GetAsset(pathID);
            string name  = asset.TryGetName();

            if (name == null)
            {
                return($"{asset.ClassID}_{pathID}");
            }
            else
            {
                return($"{asset.ClassID}_{pathID}({name})");
            }
        }