Skip to content

Commit 9024e6a

Browse files
committed
Improve external data extraction for ExportRaw mode
1 parent 0b7b809 commit 9024e6a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

AssetStudioCLI/Exporter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ public static bool ExportRawFile(AssetItem item, string exportPath)
165165
case Texture2D m_Texture2D:
166166
if (!string.IsNullOrEmpty(m_Texture2D.m_StreamData?.path))
167167
{
168-
File.WriteAllBytes(exportFullPath.Replace(".dat", "_data.dat"), m_Texture2D.image_data.GetData());
168+
m_Texture2D.image_data.WriteData(exportFullPath.Replace(".dat", "_data.dat"));
169169
}
170170
break;
171171
case AudioClip m_AudioClip:
172172
if (!string.IsNullOrEmpty(m_AudioClip.m_Source))
173173
{
174-
File.WriteAllBytes(exportFullPath.Replace(".dat", "_data.dat"), m_AudioClip.m_AudioData.GetData());
174+
m_AudioClip.m_AudioData.WriteData(exportFullPath.Replace(".dat", "_data.dat"));
175175
}
176176
break;
177177
case VideoClip m_VideoClip:
178178
if (!string.IsNullOrEmpty(m_VideoClip.m_ExternalResources.m_Source))
179179
{
180-
File.WriteAllBytes(exportFullPath.Replace(".dat", "_data.dat"), m_VideoClip.m_VideoData.GetData());
180+
m_VideoClip.m_VideoData.WriteData(exportFullPath.Replace(".dat", "_data.dat"));
181181
}
182182
break;
183183
}

AssetStudioGUI/Exporter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,19 @@ public static bool ExportRawFile(AssetItem item, string exportPath)
192192
case Texture2D m_Texture2D:
193193
if (!string.IsNullOrEmpty(m_Texture2D.m_StreamData?.path))
194194
{
195-
File.WriteAllBytes(exportFullPath.Replace(".dat", "_data.dat"), m_Texture2D.image_data.GetData());
195+
m_Texture2D.image_data.WriteData(exportFullPath.Replace(".dat", "_data.dat"));
196196
}
197197
break;
198198
case AudioClip m_AudioClip:
199199
if (!string.IsNullOrEmpty(m_AudioClip.m_Source))
200200
{
201-
File.WriteAllBytes(exportFullPath.Replace(".dat", "_data.dat"), m_AudioClip.m_AudioData.GetData());
201+
m_AudioClip.m_AudioData.WriteData(exportFullPath.Replace(".dat", "_data.dat"));
202202
}
203203
break;
204204
case VideoClip m_VideoClip:
205205
if (!string.IsNullOrEmpty(m_VideoClip.m_ExternalResources.m_Source))
206206
{
207-
File.WriteAllBytes(exportFullPath.Replace(".dat", "_data.dat"), m_VideoClip.m_VideoData.GetData());
207+
m_VideoClip.m_VideoData.WriteData(exportFullPath.Replace(".dat", "_data.dat"));
208208
}
209209
break;
210210
}

0 commit comments

Comments
 (0)