VaDiM
2024-02-11 02:24:06 +03:00
parent 535153be6b
commit f90c0ecc00
7 changed files with 120 additions and 9 deletions

View File

@ -32,6 +32,8 @@
this.OKbutton = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.filenameFormatLabel = new System.Windows.Forms.Label();
this.filenameFormatComboBox = new System.Windows.Forms.ComboBox();
this.exportSpriteWithAlphaMask = new System.Windows.Forms.CheckBox();
this.openAfterExport = new System.Windows.Forms.CheckBox();
this.restoreExtensionName = new System.Windows.Forms.CheckBox();
@ -104,6 +106,8 @@
// groupBox1
//
this.groupBox1.AutoSize = true;
this.groupBox1.Controls.Add(this.filenameFormatLabel);
this.groupBox1.Controls.Add(this.filenameFormatComboBox);
this.groupBox1.Controls.Add(this.exportSpriteWithAlphaMask);
this.groupBox1.Controls.Add(this.openAfterExport);
this.groupBox1.Controls.Add(this.restoreExtensionName);
@ -119,6 +123,28 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Export";
//
// filenameFormatLabel
//
this.filenameFormatLabel.AutoSize = true;
this.filenameFormatLabel.Location = new System.Drawing.Point(177, 18);
this.filenameFormatLabel.Name = "filenameFormatLabel";
this.filenameFormatLabel.Size = new System.Drawing.Size(84, 13);
this.filenameFormatLabel.TabIndex = 10;
this.filenameFormatLabel.Text = "File name format";
//
// filenameFormatComboBox
//
this.filenameFormatComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.filenameFormatComboBox.FormattingEnabled = true;
this.filenameFormatComboBox.Items.AddRange(new object[] {
"assetName",
"assetName@pathID",
"pathID"});
this.filenameFormatComboBox.Location = new System.Drawing.Point(177, 35);
this.filenameFormatComboBox.Name = "filenameFormatComboBox";
this.filenameFormatComboBox.Size = new System.Drawing.Size(118, 21);
this.filenameFormatComboBox.TabIndex = 9;
//
// exportSpriteWithAlphaMask
//
this.exportSpriteWithAlphaMask.AutoSize = true;
@ -646,5 +672,7 @@
private System.Windows.Forms.RadioButton l2dAnimationClipRadioButton;
private System.Windows.Forms.RadioButton l2dMonoBehaviourRadioButton;
private System.Windows.Forms.Panel l2dMotionExportMethodPanel;
private System.Windows.Forms.ComboBox filenameFormatComboBox;
private System.Windows.Forms.Label filenameFormatLabel;
}
}

View File

@ -33,6 +33,7 @@ namespace AssetStudioGUI
var defaultMotionMode = Properties.Settings.Default.l2dMotionMode.ToString();
((RadioButton)l2dMotionExportMethodPanel.Controls.Cast<Control>().First(x => x.AccessibleName == defaultMotionMode)).Checked = true;
l2dForceBezierCheckBox.Checked = Properties.Settings.Default.l2dForceBezier;
filenameFormatComboBox.SelectedIndex = Properties.Settings.Default.filenameFormat;
}
private void OKbutton_Click(object sender, EventArgs e)
@ -60,6 +61,7 @@ namespace AssetStudioGUI
var checkedMotionMode = (RadioButton)l2dMotionExportMethodPanel.Controls.Cast<Control>().First(x => ((RadioButton)x).Checked);
Properties.Settings.Default.l2dMotionMode = (CubismLive2DExtractor.Live2DMotionMode)Enum.Parse(typeof(CubismLive2DExtractor.Live2DMotionMode), checkedMotionMode.AccessibleName);
Properties.Settings.Default.l2dForceBezier = l2dForceBezierCheckBox.Checked;
Properties.Settings.Default.filenameFormat = filenameFormatComboBox.SelectedIndex;
Properties.Settings.Default.Save();
DialogResult = DialogResult.OK;
Close();

View File

@ -269,18 +269,32 @@ namespace AssetStudioGUI
private static bool TryExportFile(string dir, AssetItem item, string extension, out string fullPath)
{
var fileName = FixFileName(item.Text);
var filenameFormatIndex = Properties.Settings.Default.filenameFormat;
switch (filenameFormatIndex)
{
case 1: //assetName@pathID
fileName = $"{fileName} @{item.m_PathID}";
break;
case 2: //pathID
fileName = item.m_PathID.ToString();
break;
}
fullPath = Path.Combine(dir, fileName + extension);
if (!File.Exists(fullPath))
{
Directory.CreateDirectory(dir);
return true;
}
fullPath = Path.Combine(dir, fileName + item.UniqueID + extension);
if (!File.Exists(fullPath))
if (filenameFormatIndex == 0) //assetName
{
Directory.CreateDirectory(dir);
return true;
fullPath = Path.Combine(dir, fileName + item.UniqueID + extension);
if (!File.Exists(fullPath))
{
Directory.CreateDirectory(dir);
return true;
}
}
Logger.Warning($"Export error. File \"{fullPath.Color(ColorConsole.BrightYellow)}\" already exist");
return false;
}

View File

@ -346,5 +346,17 @@ namespace AssetStudioGUI.Properties {
this["buildTreeStructure"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int filenameFormat {
get {
return ((int)(this["filenameFormat"]));
}
set {
this["filenameFormat"] = value;
}
}
}
}

View File

@ -83,5 +83,8 @@
<Setting Name="buildTreeStructure" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="filenameFormat" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>