mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-16 19:14:15 -04:00
Performance improvement
This commit is contained in:
@ -17,12 +17,15 @@ namespace AssetStudioGUI
|
||||
var type = Properties.Settings.Default.convertType;
|
||||
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
|
||||
return false;
|
||||
var stream = m_Texture2D.ConvertToStream(type, true);
|
||||
if (stream == null)
|
||||
var image = m_Texture2D.ConvertToImage(true);
|
||||
if (image == null)
|
||||
return false;
|
||||
using (stream)
|
||||
using (image)
|
||||
{
|
||||
File.WriteAllBytes(exportFullPath, stream.ToArray());
|
||||
using (var file = File.OpenWrite(exportFullPath))
|
||||
{
|
||||
image.WriteToStream(file, type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -229,12 +232,15 @@ namespace AssetStudioGUI
|
||||
var type = Properties.Settings.Default.convertType;
|
||||
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
|
||||
return false;
|
||||
var stream = ((Sprite)item.Asset).GetImage(type);
|
||||
if (stream != null)
|
||||
var image = ((Sprite)item.Asset).GetImage();
|
||||
if (image != null)
|
||||
{
|
||||
using (stream)
|
||||
using (image)
|
||||
{
|
||||
File.WriteAllBytes(exportFullPath, stream.ToArray());
|
||||
using (var file = File.OpenWrite(exportFullPath))
|
||||
{
|
||||
image.WriteToStream(file, type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user