mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-09-19 23:57:23 +08:00
54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace CodeWalker.GameFiles
|
|||
|
{
|
|||
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
|||
|
public class YldFile : GameFile, PackedFile
|
|||
|
{
|
|||
|
public ClothDictionary ClothDictionary { get; set; }
|
|||
|
|
|||
|
public string LoadException { get; set; }
|
|||
|
|
|||
|
|
|||
|
public YldFile() : base(null, GameFileType.Yld)
|
|||
|
{
|
|||
|
}
|
|||
|
public YldFile(RpfFileEntry entry) : base(entry, GameFileType.Yld)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public void Load(byte[] data, RpfFileEntry entry)
|
|||
|
{
|
|||
|
Name = entry.Name;
|
|||
|
RpfFileEntry = entry;
|
|||
|
//Hash = entry.ShortNameHash;
|
|||
|
|
|||
|
|
|||
|
RpfResourceFileEntry resentry = entry as RpfResourceFileEntry;
|
|||
|
if (resentry == null)
|
|||
|
{
|
|||
|
throw new Exception("File entry wasn't a resource! (is it binary data?)");
|
|||
|
}
|
|||
|
|
|||
|
ResourceDataReader rd = null;
|
|||
|
try
|
|||
|
{
|
|||
|
rd = new ResourceDataReader(resentry, data);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
//data = entry.File.DecompressBytes(data); //??
|
|||
|
LoadException = ex.ToString();
|
|||
|
}
|
|||
|
|
|||
|
ClothDictionary = rd?.ReadBlock<ClothDictionary>();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|