mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-26 13:50:21 -04:00
continue work
This commit is contained in:
parent
17bd7a210a
commit
21a8d7ef49
@ -584,7 +584,7 @@ namespace AssetStudio
|
||||
{
|
||||
int xdiff = reverseSort ? b.Text.CompareTo(a.Text) : a.Text.CompareTo(b.Text);
|
||||
if (xdiff != 0) return xdiff;
|
||||
return secondSortColumn == 1 ? a.TypeString.CompareTo(b.TypeString) : a.fullSize.CompareTo(b.fullSize);
|
||||
return secondSortColumn == 1 ? a.TypeString.CompareTo(b.TypeString) : a.FullSize.CompareTo(b.FullSize);
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
@ -592,13 +592,13 @@ namespace AssetStudio
|
||||
{
|
||||
int xdiff = reverseSort ? b.TypeString.CompareTo(a.TypeString) : a.TypeString.CompareTo(b.TypeString);
|
||||
if (xdiff != 0) return xdiff;
|
||||
return secondSortColumn == 2 ? a.fullSize.CompareTo(b.fullSize) : a.Text.CompareTo(b.Text);
|
||||
return secondSortColumn == 2 ? a.FullSize.CompareTo(b.FullSize) : a.Text.CompareTo(b.Text);
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
visibleAssets.Sort(delegate (AssetPreloadData a, AssetPreloadData b)
|
||||
{
|
||||
int xdiff = reverseSort ? b.fullSize.CompareTo(a.fullSize) : a.fullSize.CompareTo(b.fullSize);
|
||||
int xdiff = reverseSort ? b.FullSize.CompareTo(a.FullSize) : a.FullSize.CompareTo(b.FullSize);
|
||||
if (xdiff != 0) return xdiff;
|
||||
return secondSortColumn == 1 ? a.TypeString.CompareTo(b.TypeString) : a.Text.CompareTo(b.Text);
|
||||
});
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@ -6,19 +7,38 @@ namespace AssetStudio
|
||||
{
|
||||
public class AssetPreloadData : ListViewItem
|
||||
{
|
||||
public AssetsFile sourceFile;
|
||||
public long m_PathID;
|
||||
public uint Offset;
|
||||
public int Size;
|
||||
public ClassIDType Type;
|
||||
public int typeID;
|
||||
public int classID;
|
||||
public uint Size;
|
||||
public long FullSize;
|
||||
public SerializedType serializedType;
|
||||
public ClassIDType Type;
|
||||
public string TypeString;
|
||||
public int fullSize;
|
||||
public string InfoText;
|
||||
public AssetsFile sourceFile;
|
||||
public GameObject gameObject;
|
||||
public string uniqueID;
|
||||
public GameObject gameObject;
|
||||
|
||||
public AssetPreloadData(AssetsFile assetsFile, ObjectInfo objectInfo, string uniqueID)
|
||||
{
|
||||
sourceFile = assetsFile;
|
||||
m_PathID = objectInfo.m_PathID;
|
||||
Offset = objectInfo.byteStart;
|
||||
Size = objectInfo.byteSize;
|
||||
FullSize = objectInfo.byteSize;
|
||||
serializedType = objectInfo.serializedType;
|
||||
if (Enum.IsDefined(typeof(ClassIDType), objectInfo.classID))
|
||||
{
|
||||
Type = (ClassIDType)objectInfo.classID;
|
||||
TypeString = Type.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = ClassIDType.UnknownType;
|
||||
TypeString = $"UnknownType {objectInfo.classID}";
|
||||
}
|
||||
this.uniqueID = uniqueID;
|
||||
}
|
||||
|
||||
public EndianBinaryReader InitReader()
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ namespace AssetStudio
|
||||
m_Types = new List<SerializedType>(typeCount);
|
||||
for (int i = 0; i < typeCount; i++)
|
||||
{
|
||||
m_Types.Add(ReadSerializedType());;
|
||||
m_Types.Add(ReadSerializedType());
|
||||
}
|
||||
|
||||
if (header.m_Version >= 7 && header.m_Version < 14)
|
||||
@ -99,66 +99,53 @@ namespace AssetStudio
|
||||
//Read Objects
|
||||
int objectCount = reader.ReadInt32();
|
||||
|
||||
string assetIDfmt = "D" + objectCount.ToString().Length; //format for unique ID
|
||||
var assetIDfmt = "D" + objectCount.ToString().Length; //format for unique ID
|
||||
|
||||
m_Objects = new Dictionary<long, ObjectInfo>(objectCount);
|
||||
for (int i = 0; i < objectCount; i++)
|
||||
{
|
||||
AssetPreloadData asset = new AssetPreloadData();
|
||||
|
||||
var objectInfo = new ObjectInfo();
|
||||
if (header.m_Version < 14)
|
||||
{
|
||||
asset.m_PathID = reader.ReadInt32();
|
||||
objectInfo.m_PathID = reader.ReadInt32();
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.AlignStream(4);
|
||||
asset.m_PathID = reader.ReadInt64();
|
||||
objectInfo.m_PathID = reader.ReadInt64();
|
||||
}
|
||||
asset.Offset = reader.ReadUInt32();
|
||||
asset.Offset += header.m_DataOffset;
|
||||
asset.Size = reader.ReadInt32();
|
||||
asset.typeID = reader.ReadInt32();
|
||||
objectInfo.byteStart = reader.ReadUInt32();
|
||||
objectInfo.byteStart += header.m_DataOffset;
|
||||
objectInfo.byteSize = reader.ReadUInt32();
|
||||
objectInfo.typeID = reader.ReadInt32();
|
||||
if (header.m_Version < 16)
|
||||
{
|
||||
asset.classID = reader.ReadUInt16();
|
||||
asset.serializedType = m_Types.Find(x => x.classID == asset.typeID);
|
||||
reader.Position += 2;
|
||||
objectInfo.classID = reader.ReadUInt16();
|
||||
objectInfo.serializedType = m_Types.Find(x => x.classID == objectInfo.typeID);
|
||||
objectInfo.isDestroyed = reader.ReadUInt16();
|
||||
}
|
||||
else
|
||||
{
|
||||
var type = m_Types[asset.typeID];
|
||||
asset.serializedType = type;
|
||||
asset.classID = type.classID;
|
||||
var type = m_Types[objectInfo.typeID];
|
||||
objectInfo.serializedType = type;
|
||||
objectInfo.classID = type.classID;
|
||||
}
|
||||
if (header.m_Version == 15 || header.m_Version == 16)
|
||||
{
|
||||
var stripped = reader.ReadByte();
|
||||
}
|
||||
m_Objects.Add(objectInfo.m_PathID, objectInfo);
|
||||
|
||||
if (Enum.IsDefined(typeof(ClassIDType), asset.classID))
|
||||
{
|
||||
asset.Type = (ClassIDType)asset.classID;
|
||||
asset.TypeString = asset.Type.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
asset.Type = ClassIDType.UnknownType;
|
||||
asset.TypeString = $"UnknownType {asset.classID}";
|
||||
}
|
||||
|
||||
asset.uniqueID = i.ToString(assetIDfmt);
|
||||
|
||||
asset.fullSize = asset.Size;
|
||||
asset.sourceFile = this;
|
||||
|
||||
//Create AssetPreloadData
|
||||
var asset = new AssetPreloadData(this, objectInfo, i.ToString(assetIDfmt));
|
||||
preloadTable.Add(asset.m_PathID, asset);
|
||||
|
||||
#region read BuildSettings to get version for version 2.x files
|
||||
if (asset.Type == ClassIDType.BuildSettings && header.m_Version == 6)
|
||||
{
|
||||
long nextAsset = reader.Position;
|
||||
var nextAsset = reader.Position;
|
||||
|
||||
BuildSettings BSettings = new BuildSettings(asset);
|
||||
var BSettings = new BuildSettings(asset);
|
||||
unityVersion = BSettings.m_Version;
|
||||
|
||||
reader.Position = nextAsset;
|
||||
|
@ -276,7 +276,7 @@ namespace AssetStudio
|
||||
var exportFullName = exportPath + asset.Text + ".dat";
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
var bytes = asset.InitReader().ReadBytes(asset.Size);
|
||||
var bytes = asset.InitReader().ReadBytes((int)asset.Size);
|
||||
File.WriteAllBytes(exportFullName, bytes);
|
||||
return true;
|
||||
}
|
||||
|
@ -12,5 +12,9 @@ namespace AssetStudio
|
||||
public int typeID;
|
||||
public int classID;
|
||||
public ushort isDestroyed;
|
||||
|
||||
//custom
|
||||
public long m_PathID;
|
||||
public SerializedType serializedType;
|
||||
}
|
||||
}
|
||||
|
@ -201,21 +201,21 @@ namespace AssetStudio
|
||||
{
|
||||
var m_Texture2D = new Texture2D(asset, false);
|
||||
if (!string.IsNullOrEmpty(m_Texture2D.path))
|
||||
asset.fullSize = asset.Size + (int)m_Texture2D.size;
|
||||
asset.FullSize = asset.Size + m_Texture2D.size;
|
||||
goto case ClassIDType.NamedObject;
|
||||
}
|
||||
case ClassIDType.AudioClip:
|
||||
{
|
||||
var m_AudioClip = new AudioClip(asset, false);
|
||||
if (!string.IsNullOrEmpty(m_AudioClip.m_Source))
|
||||
asset.fullSize = asset.Size + (int)m_AudioClip.m_Size;
|
||||
asset.FullSize = asset.Size + m_AudioClip.m_Size;
|
||||
goto case ClassIDType.NamedObject;
|
||||
}
|
||||
case ClassIDType.VideoClip:
|
||||
{
|
||||
var m_VideoClip = new VideoClip(asset, false);
|
||||
if (!string.IsNullOrEmpty(m_VideoClip.m_OriginalPath))
|
||||
asset.fullSize = asset.Size + (int)m_VideoClip.m_Size;
|
||||
asset.FullSize = asset.Size + (long)m_VideoClip.m_Size;
|
||||
goto case ClassIDType.NamedObject;
|
||||
}
|
||||
case ClassIDType.NamedObject:
|
||||
@ -280,7 +280,7 @@ namespace AssetStudio
|
||||
{
|
||||
asset.Text = asset.TypeString + " #" + asset.uniqueID;
|
||||
}
|
||||
asset.SubItems.AddRange(new[] { asset.TypeString, asset.fullSize.ToString() });
|
||||
asset.SubItems.AddRange(new[] { asset.TypeString, asset.FullSize.ToString() });
|
||||
//处理同名文件
|
||||
if (!assetsNameHash.Add((asset.TypeString + asset.Text).ToUpper()))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user