This commit is contained in:
Perfare 2018-07-26 10:00:32 +08:00
parent 9d1fd2f945
commit 9ad063bd0a

View File

@ -16,7 +16,7 @@ namespace AssetStudio
public static Dictionary<string, int> sharedFileIndex = new Dictionary<string, int>(); //to improve the loading speed public static Dictionary<string, int> sharedFileIndex = new Dictionary<string, int>(); //to improve the loading speed
public static Dictionary<string, EndianBinaryReader> resourceFileReaders = new Dictionary<string, EndianBinaryReader>(); //use for read res files public static Dictionary<string, EndianBinaryReader> resourceFileReaders = new Dictionary<string, EndianBinaryReader>(); //use for read res files
public static List<AssetPreloadData> exportableAssets = new List<AssetPreloadData>(); //used to hold all assets while the ListView is filtered public static List<AssetPreloadData> exportableAssets = new List<AssetPreloadData>(); //used to hold all assets while the ListView is filtered
private static HashSet<string> exportableAssetsHash = new HashSet<string>(); //avoid the same name asset private static HashSet<string> assetsNameHash = new HashSet<string>(); //avoid the same name asset
public static List<AssetPreloadData> visibleAssets = new List<AssetPreloadData>(); //used to build the ListView from all or filtered assets public static List<AssetPreloadData> visibleAssets = new List<AssetPreloadData>(); //used to build the ListView from all or filtered assets
public static Dictionary<string, SortedDictionary<int, ClassStruct>> AllClassStructures = new Dictionary<string, SortedDictionary<int, ClassStruct>>(); public static Dictionary<string, SortedDictionary<int, ClassStruct>> AllClassStructures = new Dictionary<string, SortedDictionary<int, ClassStruct>>();
public static string mainPath; public static string mainPath;
@ -178,7 +178,6 @@ namespace AssetStudio
{ {
GameObject m_GameObject = new GameObject(asset); GameObject m_GameObject = new GameObject(asset);
assetsFile.GameObjectList.Add(asset.m_PathID, m_GameObject); assetsFile.GameObjectList.Add(asset.m_PathID, m_GameObject);
//totalTreeNodes++;
break; break;
} }
case ClassIDReference.Transform: case ClassIDReference.Transform:
@ -279,24 +278,24 @@ namespace AssetStudio
break; break;
} }
} }
if (asset.Text == "")
{
asset.Text = asset.TypeString + " #" + asset.uniqueID;
}
asset.SubItems.AddRange(new[] { asset.TypeString, asset.fullSize.ToString() });
//处理同名文件
if (!assetsNameHash.Add((asset.TypeString + asset.Text).ToUpper()))
{
asset.Text += " #" + asset.uniqueID;
}
//处理非法文件名
asset.Text = FixFileName(asset.Text);
if (displayAll) if (displayAll)
{ {
exportable = true; exportable = true;
} }
if (exportable) if (exportable)
{ {
if (asset.Text == "")
{
asset.Text = asset.TypeString + " #" + asset.uniqueID;
}
asset.SubItems.AddRange(new[] { asset.TypeString, asset.fullSize.ToString() });
//处理同名文件
if (!exportableAssetsHash.Add((asset.TypeString + asset.Text).ToUpper()))
{
asset.Text += " #" + asset.uniqueID;
}
//处理非法文件名
asset.Text = FixFileName(asset.Text);
assetsFile.exportableAssets.Add(asset); assetsFile.exportableAssets.Add(asset);
} }
ProgressBarPerformStep(); ProgressBarPerformStep();
@ -317,7 +316,7 @@ namespace AssetStudio
} }
visibleAssets = exportableAssets; visibleAssets = exportableAssets;
exportableAssetsHash.Clear(); assetsNameHash.Clear();
} }
#endregion #endregion
@ -489,81 +488,90 @@ namespace AssetStudio
exportpath = savePath + "\\" + asset.TypeString + "\\"; exportpath = savePath + "\\" + asset.TypeString + "\\";
} }
StatusStripUpdate($"Exporting {asset.TypeString}: {asset.Text}"); StatusStripUpdate($"Exporting {asset.TypeString}: {asset.Text}");
switch (asset.Type) try
{ {
case ClassIDReference.Texture2D: switch (asset.Type)
if (ExportTexture2D(asset, exportpath, true)) {
{ case ClassIDReference.Texture2D:
exportedCount++; if (ExportTexture2D(asset, exportpath, true))
} {
break; exportedCount++;
case ClassIDReference.AudioClip: }
if (ExportAudioClip(asset, exportpath)) break;
{ case ClassIDReference.AudioClip:
exportedCount++; if (ExportAudioClip(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.Shader: }
if (ExportShader(asset, exportpath)) break;
{ case ClassIDReference.Shader:
exportedCount++; if (ExportShader(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.TextAsset: }
if (ExportTextAsset(asset, exportpath)) break;
{ case ClassIDReference.TextAsset:
exportedCount++; if (ExportTextAsset(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.MonoBehaviour: }
if (ExportMonoBehaviour(asset, exportpath)) break;
{ case ClassIDReference.MonoBehaviour:
exportedCount++; if (ExportMonoBehaviour(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.Font: }
if (ExportFont(asset, exportpath)) break;
{ case ClassIDReference.Font:
exportedCount++; if (ExportFont(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.Mesh: }
if (ExportMesh(asset, exportpath)) break;
{ case ClassIDReference.Mesh:
exportedCount++; if (ExportMesh(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.VideoClip: }
if (ExportVideoClip(asset, exportpath)) break;
{ case ClassIDReference.VideoClip:
exportedCount++; if (ExportVideoClip(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.MovieTexture: }
if (ExportMovieTexture(asset, exportpath)) break;
{ case ClassIDReference.MovieTexture:
exportedCount++; if (ExportMovieTexture(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.Sprite: }
if (ExportSprite(asset, exportpath)) break;
{ case ClassIDReference.Sprite:
exportedCount++; if (ExportSprite(asset, exportpath))
} {
break; exportedCount++;
case ClassIDReference.Animator: }
if (ExportAnimator(asset, exportpath)) break;
{ case ClassIDReference.Animator:
exportedCount++; if (ExportAnimator(asset, exportpath))
} {
break; exportedCount++;
default: }
if (ExportRawFile(asset, exportpath)) break;
{ case ClassIDReference.AnimationClip:
exportedCount++; break;
} default:
break; if (ExportRawFile(asset, exportpath))
{
exportedCount++;
}
break;
}
}
catch (Exception ex)
{
MessageBox.Show($"Export {asset.Type}:{asset.Text} error\r\n{ex.Message}\r\n{ex.StackTrace}");
} }
ProgressBarPerformStep(); ProgressBarPerformStep();
} }