- [CLI] added export_type option, #35.
This commit is contained in:
@@ -32,6 +32,7 @@ namespace AssetStudio.CLI
|
||||
optionsBinder.MapName,
|
||||
optionsBinder.UnityVersion,
|
||||
optionsBinder.GroupAssetsType,
|
||||
optionsBinder.AssetExportType,
|
||||
optionsBinder.Model,
|
||||
optionsBinder.Key,
|
||||
optionsBinder.AIFile,
|
||||
@@ -59,6 +60,7 @@ namespace AssetStudio.CLI
|
||||
public string MapName { get; set; }
|
||||
public string UnityVersion { get; set; }
|
||||
public AssetGroupOption GroupAssetsType { get; set; }
|
||||
public ExportType AssetExportType { get; set; }
|
||||
public bool Model { get; set; }
|
||||
public byte Key { get; set; }
|
||||
public FileInfo AIFile { get; set; }
|
||||
@@ -81,6 +83,7 @@ namespace AssetStudio.CLI
|
||||
public readonly Option<string> MapName;
|
||||
public readonly Option<string> UnityVersion;
|
||||
public readonly Option<AssetGroupOption> GroupAssetsType;
|
||||
public readonly Option<ExportType> AssetExportType;
|
||||
public readonly Option<bool> Model;
|
||||
public readonly Option<byte> Key;
|
||||
public readonly Option<FileInfo> AIFile;
|
||||
@@ -103,6 +106,7 @@ namespace AssetStudio.CLI
|
||||
MapName = new Option<string>("--map_name", () => "assets_map", "Specify AssetMap file name.");
|
||||
UnityVersion = new Option<string>("--unity_version", "Specify Unity version.");
|
||||
GroupAssetsType = new Option<AssetGroupOption>("--group_assets", "Specify how exported assets should be grouped.");
|
||||
AssetExportType = new Option<ExportType>("--export_type", "Specify how assets should be exported.");
|
||||
Model = new Option<bool>("--models", "Enable to export models only");
|
||||
AIFile = new Option<FileInfo>("--ai_file", "Specify asset_index json file path (to recover GI containers).").LegalFilePathsOnly();
|
||||
DummyDllFolder = new Option<DirectoryInfo>("--dummy_dlls", "Specify DummyDll path.").LegalFilePathsOnly();
|
||||
@@ -150,6 +154,7 @@ namespace AssetStudio.CLI
|
||||
GameName.FromAmong(GameManager.GetGameNames());
|
||||
|
||||
GroupAssetsType.SetDefaultValue(AssetGroupOption.ByType);
|
||||
AssetExportType.SetDefaultValue(ExportType.Convert);
|
||||
MapOp.SetDefaultValue(MapOpType.None);
|
||||
MapType.SetDefaultValue(ExportListType.XML);
|
||||
KeyIndex.SetDefaultValue(0);
|
||||
@@ -193,6 +198,7 @@ namespace AssetStudio.CLI
|
||||
MapName = bindingContext.ParseResult.GetValueForOption(MapName),
|
||||
UnityVersion = bindingContext.ParseResult.GetValueForOption(UnityVersion),
|
||||
GroupAssetsType = bindingContext.ParseResult.GetValueForOption(GroupAssetsType),
|
||||
AssetExportType = bindingContext.ParseResult.GetValueForOption(AssetExportType),
|
||||
Model = bindingContext.ParseResult.GetValueForOption(Model),
|
||||
Key = bindingContext.ParseResult.GetValueForOption(Key),
|
||||
AIFile = bindingContext.ParseResult.GetValueForOption(AIFile),
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace AssetStudio.CLI
|
||||
if (assetsManager.assetsFileList.Count > 0)
|
||||
{
|
||||
BuildAssetData(o.TypeFilter, o.NameFilter, o.ContainerFilter, ref i);
|
||||
ExportAssets(o.Output.FullName, exportableAssets, o.GroupAssetsType);
|
||||
ExportAssets(o.Output.FullName, exportableAssets, o.GroupAssetsType, o.AssetExportType);
|
||||
}
|
||||
exportableAssets.Clear();
|
||||
assetsManager.Clear();
|
||||
|
||||
@@ -22,14 +22,6 @@ namespace AssetStudio.CLI
|
||||
All = Both | Load,
|
||||
}
|
||||
|
||||
public enum AssetGroupOption
|
||||
{
|
||||
ByType,
|
||||
ByContainer,
|
||||
BySource,
|
||||
None,
|
||||
}
|
||||
|
||||
internal static class Studio
|
||||
{
|
||||
public static Game Game;
|
||||
@@ -364,7 +356,7 @@ namespace AssetStudio.CLI
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExportAssets(string savePath, List<AssetItem> toExportAssets, AssetGroupOption assetGroupOption)
|
||||
public static void ExportAssets(string savePath, List<AssetItem> toExportAssets, AssetGroupOption assetGroupOption, ExportType exportType)
|
||||
{
|
||||
int toExportCount = toExportAssets.Count;
|
||||
int exportedCount = 0;
|
||||
@@ -404,9 +396,32 @@ namespace AssetStudio.CLI
|
||||
Logger.Info($"[{exportedCount}/{toExportCount}] Exporting {asset.TypeString}: {asset.Text}");
|
||||
try
|
||||
{
|
||||
if (ExportConvertFile(asset, exportPath))
|
||||
switch (exportType)
|
||||
{
|
||||
exportedCount++;
|
||||
case ExportType.Raw:
|
||||
if (ExportRawFile(asset, exportPath))
|
||||
{
|
||||
exportedCount++;
|
||||
}
|
||||
break;
|
||||
case ExportType.Dump:
|
||||
if (ExportDumpFile(asset, exportPath))
|
||||
{
|
||||
exportedCount++;
|
||||
}
|
||||
break;
|
||||
case ExportType.Convert:
|
||||
if (ExportConvertFile(asset, exportPath))
|
||||
{
|
||||
exportedCount++;
|
||||
}
|
||||
break;
|
||||
case ExportType.JSON:
|
||||
if (ExportJSONFile(asset, exportPath))
|
||||
{
|
||||
exportedCount++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -11,14 +11,6 @@ using static AssetStudio.GUI.Exporter;
|
||||
|
||||
namespace AssetStudio.GUI
|
||||
{
|
||||
internal enum ExportType
|
||||
{
|
||||
Convert,
|
||||
Raw,
|
||||
Dump,
|
||||
JSON
|
||||
}
|
||||
|
||||
internal enum ExportFilter
|
||||
{
|
||||
All,
|
||||
|
||||
10
AssetStudio/ExportType.cs
Normal file
10
AssetStudio/ExportType.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace AssetStudio
|
||||
{
|
||||
public enum ExportType
|
||||
{
|
||||
Convert,
|
||||
Raw,
|
||||
Dump,
|
||||
JSON
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user