diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index ff15c95..8f735fa 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -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; } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index a1fdb70..c5fb434 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -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(); @@ -1599,10 +1616,20 @@ namespace AssetStudioGUI } if (listSearch.Text != " Filter ") { - 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); + 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();