mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
Add exclude mode to asset list filter
This commit is contained in:
parent
b9cf95616b
commit
5c662d64e4
20
AssetStudioGUI/AssetStudioGUIForm.Designer.cs
generated
20
AssetStudioGUI/AssetStudioGUIForm.Designer.cs
generated
@ -81,6 +81,7 @@
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.treeSearch = new System.Windows.Forms.TextBox();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.filterExcludeMode = new System.Windows.Forms.CheckBox();
|
||||
this.assetListView = new System.Windows.Forms.ListView();
|
||||
this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderContainer = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
@ -588,6 +589,7 @@
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.filterExcludeMode);
|
||||
this.tabPage2.Controls.Add(this.assetListView);
|
||||
this.tabPage2.Controls.Add(this.listSearch);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
@ -597,6 +599,23 @@
|
||||
this.tabPage2.Text = "Asset List";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// filterExludeMode
|
||||
//
|
||||
this.filterExcludeMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.filterExcludeMode.AutoSize = true;
|
||||
this.filterExcludeMode.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.filterExcludeMode.Enabled = false;
|
||||
this.filterExcludeMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.filterExcludeMode.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.filterExcludeMode.Location = new System.Drawing.Point(409, 2);
|
||||
this.filterExcludeMode.Name = "filterExludeMode";
|
||||
this.filterExcludeMode.Size = new System.Drawing.Size(61, 17);
|
||||
this.filterExcludeMode.TabIndex = 2;
|
||||
this.filterExcludeMode.Text = "Exclude";
|
||||
this.filterExcludeMode.TextAlign = System.Drawing.ContentAlignment.BottomRight;
|
||||
this.filterExcludeMode.UseVisualStyleBackColor = false;
|
||||
this.filterExcludeMode.CheckedChanged += new System.EventHandler(this.filterExludeMode_CheckedChanged);
|
||||
//
|
||||
// assetListView
|
||||
//
|
||||
this.assetListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
@ -1219,6 +1238,7 @@
|
||||
private System.Windows.Forms.ToolStripTextBox specifyUnityVersion;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem15;
|
||||
private System.Windows.Forms.ToolStripMenuItem dumpSelectedAssetsToolStripMenuItem;
|
||||
private System.Windows.Forms.CheckBox filterExcludeMode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,6 +212,7 @@ namespace AssetStudioGUI
|
||||
{
|
||||
if (assetsManager.assetsFileList.Count == 0)
|
||||
{
|
||||
filterExcludeModeCheck(assetsManager.assetsFileList.Count);
|
||||
StatusStripUpdate("No Unity file can be loaded.");
|
||||
return;
|
||||
}
|
||||
@ -250,6 +251,8 @@ namespace AssetStudioGUI
|
||||
typeMap.Clear();
|
||||
classesListView.EndUpdate();
|
||||
|
||||
filterExcludeModeCheck(exportableAssets.Count);
|
||||
|
||||
var types = exportableAssets.Select(x => x.Type).Distinct().OrderBy(x => x.ToString()).ToArray();
|
||||
foreach (var type in types)
|
||||
{
|
||||
@ -1576,6 +1579,20 @@ namespace AssetStudioGUI
|
||||
return selectedAssets;
|
||||
}
|
||||
|
||||
private void filterExludeMode_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
FilterAssetList();
|
||||
}
|
||||
|
||||
private void filterExcludeModeCheck(int itemCount)
|
||||
{
|
||||
filterExcludeMode.Enabled = itemCount > 0;
|
||||
if (!filterExcludeMode.Enabled)
|
||||
{
|
||||
filterExcludeMode.Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void FilterAssetList()
|
||||
{
|
||||
assetListView.BeginUpdate();
|
||||
@ -1598,12 +1615,22 @@ namespace AssetStudioGUI
|
||||
visibleAssets = exportableAssets;
|
||||
}
|
||||
if (listSearch.Text != " Filter ")
|
||||
{
|
||||
if (filterExcludeMode.Checked)
|
||||
{
|
||||
visibleAssets = visibleAssets.FindAll(
|
||||
x => x.Text.IndexOf(listSearch.Text, StringComparison.OrdinalIgnoreCase) <= 0 &&
|
||||
x.SubItems[1].Text.IndexOf(listSearch.Text, StringComparison.OrdinalIgnoreCase) <= 0 &&
|
||||
x.SubItems[3].Text.IndexOf(listSearch.Text, StringComparison.OrdinalIgnoreCase) <= 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleAssets = visibleAssets.FindAll(
|
||||
x => x.Text.IndexOf(listSearch.Text, StringComparison.OrdinalIgnoreCase) >= 0 ||
|
||||
x.SubItems[1].Text.IndexOf(listSearch.Text, StringComparison.OrdinalIgnoreCase) >= 0 ||
|
||||
x.SubItems[3].Text.IndexOf(listSearch.Text, StringComparison.OrdinalIgnoreCase) >= 0);
|
||||
}
|
||||
}
|
||||
assetListView.VirtualListSize = visibleAssets.Count;
|
||||
assetListView.EndUpdate();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user