mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-19 11:34:16 -04:00
Improve search
This commit is contained in:
@ -173,7 +173,6 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="StudioClasses\SpriteHelper.cs" />
|
<Compile Include="StudioClasses\SpriteHelper.cs" />
|
||||||
<Compile Include="StudioClasses\StringExtensions.cs" />
|
|
||||||
<Compile Include="StudioClasses\EndianBinaryReader.cs" />
|
<Compile Include="StudioClasses\EndianBinaryReader.cs" />
|
||||||
<Compile Include="StudioClasses\Exporter.cs" />
|
<Compile Include="StudioClasses\Exporter.cs" />
|
||||||
<Compile Include="StudioClasses\Importer.cs" />
|
<Compile Include="StudioClasses\Importer.cs" />
|
||||||
|
@ -167,7 +167,6 @@
|
|||||||
<Compile Include="StudioClasses\ClassStruct.cs" />
|
<Compile Include="StudioClasses\ClassStruct.cs" />
|
||||||
<Compile Include="StudioClasses\FBXExporter.cs" />
|
<Compile Include="StudioClasses\FBXExporter.cs" />
|
||||||
<Compile Include="StudioClasses\SpriteHelper.cs" />
|
<Compile Include="StudioClasses\SpriteHelper.cs" />
|
||||||
<Compile Include="StudioClasses\StringExtensions.cs" />
|
|
||||||
<Compile Include="StudioClasses\Exporter.cs" />
|
<Compile Include="StudioClasses\Exporter.cs" />
|
||||||
<Compile Include="StudioClasses\Importer.cs" />
|
<Compile Include="StudioClasses\Importer.cs" />
|
||||||
<Compile Include="StudioClasses\Studio.cs" />
|
<Compile Include="StudioClasses\Studio.cs" />
|
||||||
|
5
AssetStudio/AssetStudioForm.Designer.cs
generated
5
AssetStudio/AssetStudioForm.Designer.cs
generated
@ -108,7 +108,6 @@
|
|||||||
this.timerOpenTK = new System.Windows.Forms.Timer(this.components);
|
this.timerOpenTK = new System.Windows.Forms.Timer(this.components);
|
||||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.treeTip = new System.Windows.Forms.ToolTip(this.components);
|
|
||||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.exportSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.exportSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -522,7 +521,6 @@
|
|||||||
this.treeSearch.Enter += new System.EventHandler(this.treeSearch_Enter);
|
this.treeSearch.Enter += new System.EventHandler(this.treeSearch_Enter);
|
||||||
this.treeSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeSearch_KeyDown);
|
this.treeSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeSearch_KeyDown);
|
||||||
this.treeSearch.Leave += new System.EventHandler(this.treeSearch_Leave);
|
this.treeSearch.Leave += new System.EventHandler(this.treeSearch_Leave);
|
||||||
this.treeSearch.MouseEnter += new System.EventHandler(this.treeSearch_MouseEnter);
|
|
||||||
//
|
//
|
||||||
// tabPage2
|
// tabPage2
|
||||||
//
|
//
|
||||||
@ -906,7 +904,7 @@
|
|||||||
this.jumpToSceneHierarchyToolStripMenuItem,
|
this.jumpToSceneHierarchyToolStripMenuItem,
|
||||||
this.showOriginalFileToolStripMenuItem});
|
this.showOriginalFileToolStripMenuItem});
|
||||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
this.contextMenuStrip1.Size = new System.Drawing.Size(335, 136);
|
this.contextMenuStrip1.Size = new System.Drawing.Size(335, 114);
|
||||||
//
|
//
|
||||||
// exportSelectedAssetsToolStripMenuItem
|
// exportSelectedAssetsToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -1049,7 +1047,6 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem openAfterExport;
|
private System.Windows.Forms.ToolStripMenuItem openAfterExport;
|
||||||
private System.Windows.Forms.ToolStripMenuItem showExpOpt;
|
private System.Windows.Forms.ToolStripMenuItem showExpOpt;
|
||||||
private GOHierarchy sceneTreeView;
|
private GOHierarchy sceneTreeView;
|
||||||
private System.Windows.Forms.ToolTip treeTip;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem debugMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem debugMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem buildClassStructuresMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem buildClassStructuresMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem dontLoadAssetsMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem dontLoadAssetsMenuItem;
|
||||||
|
@ -515,11 +515,6 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void treeSearch_MouseEnter(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
treeTip.Show("Search with * ? widcards. Enter to scroll through results, Ctrl+Enter to select all results.", treeSearch, 5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void treeSearch_Enter(object sender, EventArgs e)
|
private void treeSearch_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (treeSearch.Text == " Search ")
|
if (treeSearch.Text == " Search ")
|
||||||
@ -538,19 +533,6 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void recurseTreeCheck(TreeNodeCollection start)
|
|
||||||
{
|
|
||||||
foreach (GameObject GObject in start)
|
|
||||||
{
|
|
||||||
if (GObject.Text.Like(treeSearch.Text))
|
|
||||||
{
|
|
||||||
GObject.Checked = !GObject.Checked;
|
|
||||||
if (GObject.Checked) { GObject.EnsureVisible(); }
|
|
||||||
}
|
|
||||||
else { recurseTreeCheck(GObject.Nodes); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void treeSearch_TextChanged(object sender, EventArgs e)
|
private void treeSearch_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
treeSrcResults.Clear();
|
treeSrcResults.Clear();
|
||||||
@ -565,33 +547,27 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
foreach (var aFile in assetsfileList)
|
foreach (var aFile in assetsfileList)
|
||||||
{
|
{
|
||||||
foreach (var GObject in aFile.GameObjectList.Values)
|
foreach (var gObject in aFile.GameObjectList.Values)
|
||||||
{
|
{
|
||||||
if (GObject.Text.Like(treeSearch.Text)) { treeSrcResults.Add(GObject); }
|
if (gObject.Text.IndexOf(treeSearch.Text, StringComparison.CurrentCultureIgnoreCase) >= 0)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (e.Control) //toggle all matching nodes
|
|
||||||
{
|
{
|
||||||
sceneTreeView.BeginUpdate();
|
treeSrcResults.Add(gObject);
|
||||||
//loop TreeView recursively to avoid children already checked by parent
|
}
|
||||||
recurseTreeCheck(sceneTreeView.Nodes);
|
}
|
||||||
sceneTreeView.EndUpdate();
|
}
|
||||||
}
|
}
|
||||||
else //make visible one by one
|
|
||||||
{
|
|
||||||
if (treeSrcResults.Count > 0)
|
if (treeSrcResults.Count > 0)
|
||||||
{
|
{
|
||||||
if (nextGObject >= treeSrcResults.Count) { nextGObject = 0; }
|
if (nextGObject >= treeSrcResults.Count)
|
||||||
|
{
|
||||||
|
nextGObject = 0;
|
||||||
|
}
|
||||||
treeSrcResults[nextGObject].EnsureVisible();
|
treeSrcResults[nextGObject].EnsureVisible();
|
||||||
sceneTreeView.SelectedNode = treeSrcResults[nextGObject];
|
sceneTreeView.SelectedNode = treeSrcResults[nextGObject];
|
||||||
nextGObject++;
|
nextGObject++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void sceneTreeView_AfterCheck(object sender, TreeViewEventArgs e)
|
private void sceneTreeView_AfterCheck(object sender, TreeViewEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -153,9 +153,6 @@ The quick brown fox jumps over the lazy dog. 1234567890</value>
|
|||||||
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>784, 17</value>
|
<value>784, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="treeTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>928, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>147, 17</value>
|
<value>147, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace AssetStudio
|
|
||||||
{
|
|
||||||
public static class StringExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Compares the string against a given pattern.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="str">The string.</param>
|
|
||||||
/// <param name="pattern">The pattern to match, where "*" means any sequence of characters, and "?" means any single character.</param>
|
|
||||||
/// <returns><c>true</c> if the string matches the given pattern; otherwise <c>false</c>.</returns>
|
|
||||||
public static bool Like(this string str, string pattern)
|
|
||||||
{
|
|
||||||
return new Regex(
|
|
||||||
"^" + Regex.Escape(pattern).Replace(@"\*", ".*").Replace(@"\?", ".") + "$",
|
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Singleline
|
|
||||||
).IsMatch(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user