mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 14:30:26 +00:00
Improve batch exporting to catch files inside archives to skip errors.
This commit is contained in:
parent
ab984fe93a
commit
45805b6272
1 changed files with 46 additions and 31 deletions
|
@ -1007,6 +1007,7 @@ namespace Toolbox
|
||||||
|
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region TabMdiWindows
|
#region TabMdiWindows
|
||||||
|
@ -1378,13 +1379,14 @@ namespace Toolbox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<string> failedFiles = new List<string>();
|
||||||
private List<string> batchExportFileList = new List<string>();
|
private List<string> batchExportFileList = new List<string>();
|
||||||
private void BatchExportModels(string[] files, string outputFolder)
|
private void BatchExportModels(string[] files, string outputFolder)
|
||||||
{
|
{
|
||||||
List<string> Formats = new List<string>();
|
List<string> Formats = new List<string>();
|
||||||
Formats.Add("DAE (.dae)");
|
Formats.Add("DAE (.dae)");
|
||||||
|
|
||||||
List<string> failedFiles = new List<string>();
|
failedFiles = new List<string>();
|
||||||
|
|
||||||
BatchFormatExport form = new BatchFormatExport(Formats);
|
BatchFormatExport form = new BatchFormatExport(Formats);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
@ -1392,15 +1394,17 @@ namespace Toolbox
|
||||||
string extension = form.GetSelectedExtension();
|
string extension = form.GetSelectedExtension();
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
|
IFileFormat fileFormat = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fileFormat = STFileLoader.OpenFileFormat(file);
|
fileFormat = STFileLoader.OpenFileFormat(file);
|
||||||
SearchFileFormat(form.BatchSettings, fileFormat, extension, outputFolder, ExportMode.Models);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
failedFiles.Add($"{file} \n Error:\n {ex} \n");
|
failedFiles.Add($"{file} \n Error:\n {ex} \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SearchFileFormat(form.BatchSettings, fileFormat, extension, outputFolder, ExportMode.Models);
|
||||||
}
|
}
|
||||||
batchExportFileList.Clear();
|
batchExportFileList.Clear();
|
||||||
}
|
}
|
||||||
|
@ -1429,7 +1433,7 @@ namespace Toolbox
|
||||||
Formats.Add("Tagged Image File Format (.tiff)");
|
Formats.Add("Tagged Image File Format (.tiff)");
|
||||||
Formats.Add("ASTC (.astc)");
|
Formats.Add("ASTC (.astc)");
|
||||||
|
|
||||||
List<string> failedFiles = new List<string>();
|
failedFiles = new List<string>();
|
||||||
|
|
||||||
BatchFormatExport form = new BatchFormatExport(Formats);
|
BatchFormatExport form = new BatchFormatExport(Formats);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
@ -1437,15 +1441,17 @@ namespace Toolbox
|
||||||
string extension = form.GetSelectedExtension();
|
string extension = form.GetSelectedExtension();
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
|
IFileFormat fileFormat = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fileFormat = STFileLoader.OpenFileFormat(file);
|
fileFormat = STFileLoader.OpenFileFormat(file);
|
||||||
SearchFileFormat(form.BatchSettings, fileFormat, extension, outputFolder, ExportMode.Textures);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
failedFiles.Add($"{file} \n Error:\n {ex} \n");
|
failedFiles.Add($"{file} \n Error:\n {ex} \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SearchFileFormat(form.BatchSettings, fileFormat, extension, outputFolder, ExportMode.Textures);
|
||||||
}
|
}
|
||||||
batchExportFileList.Clear();
|
batchExportFileList.Clear();
|
||||||
}
|
}
|
||||||
|
@ -1538,7 +1544,16 @@ namespace Toolbox
|
||||||
ArchiveFilePath = Path.Combine(outputFolder, Path.GetFileNameWithoutExtension(((IFileFormat)archiveFile).FileName));
|
ArchiveFilePath = Path.Combine(outputFolder, Path.GetFileNameWithoutExtension(((IFileFormat)archiveFile).FileName));
|
||||||
|
|
||||||
foreach (var file in archiveFile.Files)
|
foreach (var file in archiveFile.Files)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
SearchFileFormat(settings, file.OpenFile(), extension, ArchiveFilePath, exportMode);
|
SearchFileFormat(settings, file.OpenFile(), extension, ArchiveFilePath, exportMode);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
failedFiles.Add($"{file} \n Error:\n {ex} \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue