mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-15 19:28:48 -05:00
Some refactor for custom options
wip
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using static AssetStudio.CustomOptions.GameSpecificOptions.CustomMeshOptions;
|
using static AssetStudio.CustomOptions.GameSpecific.CustomMeshOptions;
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
namespace AssetStudio.CustomOptions
|
|
||||||
{
|
|
||||||
public partial class GameSpecificOptions
|
|
||||||
{
|
|
||||||
public sealed class CustomBundleOptions
|
|
||||||
{
|
|
||||||
private CompressionType _customBlockCompression = CompressionType.Auto;
|
|
||||||
private CompressionType _customBlockInfoCompression = CompressionType.Auto;
|
|
||||||
|
|
||||||
public CompressionType CustomBlockCompression
|
|
||||||
{
|
|
||||||
get => _customBlockCompression;
|
|
||||||
set => _customBlockCompression = SetOption(nameof(CustomBlockCompression), value, _customBlockCompression);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CompressionType CustomBlockInfoCompression
|
|
||||||
{
|
|
||||||
get => _customBlockInfoCompression;
|
|
||||||
set => _customBlockInfoCompression = SetOption(nameof(CustomBlockInfoCompression), value, _customBlockInfoCompression);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomBundleOptions() { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
namespace AssetStudio.CustomOptions
|
|
||||||
{
|
|
||||||
public partial class GameSpecificOptions
|
|
||||||
{
|
|
||||||
public sealed class CustomMeshOptions
|
|
||||||
{
|
|
||||||
public enum MeshParsingMode
|
|
||||||
{
|
|
||||||
Auto,
|
|
||||||
Tuanjie,
|
|
||||||
Unity,
|
|
||||||
}
|
|
||||||
|
|
||||||
private MeshParsingMode _tuanjieMeshParsingMode;
|
|
||||||
|
|
||||||
public MeshParsingMode TuanjieMeshParsingMode
|
|
||||||
{
|
|
||||||
get => _tuanjieMeshParsingMode;
|
|
||||||
set => _tuanjieMeshParsingMode = SetOption(nameof(TuanjieMeshParsingMode), value, _tuanjieMeshParsingMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomMeshOptions() { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace AssetStudio.CustomOptions
|
||||||
|
{
|
||||||
|
public abstract class CustomOption
|
||||||
|
{
|
||||||
|
protected static T SetOption<T>(string option, T value, T curValue)
|
||||||
|
{
|
||||||
|
if (value.Equals(curValue))
|
||||||
|
return curValue;
|
||||||
|
|
||||||
|
var val = string.IsNullOrEmpty(value.ToString())
|
||||||
|
? "None"
|
||||||
|
: value.ToString();
|
||||||
|
Logger.Info($"- {option}: {val}");
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
namespace AssetStudio.CustomOptions.GameSpecific
|
||||||
|
{
|
||||||
|
public sealed class CustomBundleOptions : CustomOption
|
||||||
|
{
|
||||||
|
private CompressionType _customBlockCompression = CompressionType.Auto;
|
||||||
|
private CompressionType _customBlockInfoCompression = CompressionType.Auto;
|
||||||
|
|
||||||
|
public CompressionType CustomBlockCompression
|
||||||
|
{
|
||||||
|
get => _customBlockCompression;
|
||||||
|
set => _customBlockCompression = SetOption(nameof(CustomBlockCompression), value, _customBlockCompression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompressionType CustomBlockInfoCompression
|
||||||
|
{
|
||||||
|
get => _customBlockInfoCompression;
|
||||||
|
set => _customBlockInfoCompression = SetOption(nameof(CustomBlockInfoCompression), value, _customBlockInfoCompression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomBundleOptions() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
namespace AssetStudio.CustomOptions.GameSpecific
|
||||||
|
{
|
||||||
|
public sealed class CustomMeshOptions : CustomOption
|
||||||
|
{
|
||||||
|
public enum MeshParsingMode
|
||||||
|
{
|
||||||
|
Auto,
|
||||||
|
Tuanjie,
|
||||||
|
Unity,
|
||||||
|
}
|
||||||
|
|
||||||
|
private MeshParsingMode _tuanjieMeshParsingMode;
|
||||||
|
|
||||||
|
public MeshParsingMode TuanjieMeshParsingMode
|
||||||
|
{
|
||||||
|
get => _tuanjieMeshParsingMode;
|
||||||
|
set => _tuanjieMeshParsingMode = SetOption(nameof(TuanjieMeshParsingMode), value, _tuanjieMeshParsingMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomMeshOptions() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using AssetStudio.CustomOptions.Asmo;
|
using AssetStudio.CustomOptions.Asmo;
|
||||||
|
using AssetStudio.CustomOptions.GameSpecific;
|
||||||
using SevenZip;
|
using SevenZip;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -8,7 +9,7 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace AssetStudio.CustomOptions
|
namespace AssetStudio.CustomOptions
|
||||||
{
|
{
|
||||||
public partial class GameSpecificOptions
|
public class GameSpecificOptions
|
||||||
{
|
{
|
||||||
private static JsonSerializerOptions jsonOptions;
|
private static JsonSerializerOptions jsonOptions;
|
||||||
private static string fileName = "GameOptions";
|
private static string fileName = "GameOptions";
|
||||||
@@ -106,17 +107,5 @@ namespace AssetStudio.CustomOptions
|
|||||||
|
|
||||||
Logger.Info($"- Specified Unity version: {_customUnityVer}");
|
Logger.Info($"- Specified Unity version: {_customUnityVer}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static T SetOption<T>(string option, T value, T curValue)
|
|
||||||
{
|
|
||||||
if (value.Equals(curValue))
|
|
||||||
return curValue;
|
|
||||||
|
|
||||||
var val = string.IsNullOrEmpty(value.ToString())
|
|
||||||
? "None"
|
|
||||||
: value.ToString();
|
|
||||||
Logger.Info($"- {option}: {val}");
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using AssetStudio;
|
using AssetStudio;
|
||||||
using AssetStudio.CustomOptions;
|
using AssetStudio.CustomOptions;
|
||||||
|
using AssetStudio.CustomOptions.GameSpecific;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@@ -55,7 +56,7 @@ namespace AssetStudioGUI
|
|||||||
_gameOptions.Bundles.CustomBlockInfoCompression = blockInfoCompression;
|
_gameOptions.Bundles.CustomBlockInfoCompression = blockInfoCompression;
|
||||||
|
|
||||||
var tMeshModeIndex = ((RadioButton)panel1.Controls.Cast<Control>().First(x => ((RadioButton)x).Checked)).TabIndex;
|
var tMeshModeIndex = ((RadioButton)panel1.Controls.Cast<Control>().First(x => ((RadioButton)x).Checked)).TabIndex;
|
||||||
_gameOptions.Meshes.TuanjieMeshParsingMode = (GameSpecificOptions.CustomMeshOptions.MeshParsingMode)tMeshModeIndex;
|
_gameOptions.Meshes.TuanjieMeshParsingMode = (CustomMeshOptions.MeshParsingMode)tMeshModeIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region General
|
#region General
|
||||||
|
|||||||
Reference in New Issue
Block a user