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