Skip to content

Commit

Permalink
Add Chunk Finder tool to search menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jaquadro committed Nov 10, 2013
1 parent 9f44174 commit ed6b699
Show file tree
Hide file tree
Showing 12 changed files with 1,851 additions and 612 deletions.
7 changes: 7 additions & 0 deletions Controllers/NodeTreeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,13 @@ public void SelectNode (DataNode node)
}
}

public void ScrollNode (DataNode node)
{
TreeNode treeNode = FindFrontNode(node);
if (treeNode != null)
treeNode.EnsureVisible();
}

public void RefreshRootNodes ()
{
if (ShowVirtualRoot) {
Expand Down
10 changes: 10 additions & 0 deletions Model/RegionChunkDataNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ public RegionChunkDataNode (RegionFile regionFile, int x, int z)
_container = new CompoundTagContainer(new TagNodeCompound());
}

public int X
{
get { return _x; }
}

public int Z
{
get { return _z; }
}

protected override NodeCapabilities Capabilities
{
get
Expand Down
16 changes: 15 additions & 1 deletion Model/RegionFileDataNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class RegionFileDataNode : DataNode
private string _path;
private RegionFile _region;

private static Regex _namePattern = new Regex(@"^r(\.-?\d+){2}\.(mcr|mca)$");
private static Regex _namePattern = new Regex(@"^r\.(-?\d+)\.(-?\d+)\.(mcr|mca)$");

private RegionFileDataNode (string path)
{
Expand All @@ -28,6 +28,20 @@ public static bool SupportedNamePattern (string path)
return _namePattern.IsMatch(path);
}

public static bool RegionCoordinates (string path, out int rx, out int rz)
{
rx = 0;
rz = 0;

Match match = _namePattern.Match(path);
if (match.Success && match.Groups.Count > 3) {
rx = int.Parse(match.Groups[1].Value);
rz = int.Parse(match.Groups[2].Value);
}

return match.Success;
}

protected override NodeCapabilities Capabilities
{
get
Expand Down
12 changes: 12 additions & 0 deletions NBTExplorer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@
<Compile Include="Windows\CancelSearchForm.Designer.cs">
<DependentUpon>CancelSearchForm.cs</DependentUpon>
</Compile>
<Compile Include="Windows\FindBlock.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\FindBlock.Designer.cs">
<DependentUpon>FindBlock.cs</DependentUpon>
</Compile>
<Compile Include="Windows\FindReplace.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -229,9 +235,15 @@
<DependentUpon>ValueRuleForm.cs</DependentUpon>
</Compile>
<Compile Include="Windows\ToolStripExplorerRenderer.cs" />
<Compile Include="Windows\WatermarkTextBox.cs">
<SubType>Component</SubType>
</Compile>
<EmbeddedResource Include="Windows\CancelSearchForm.resx">
<DependentUpon>CancelSearchForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\FindBlock.resx">
<DependentUpon>FindBlock.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\FindReplace.resx">
<DependentUpon>FindReplace.cs</DependentUpon>
</EmbeddedResource>
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]
[assembly: AssemblyVersion("2.6.0.0")]
[assembly: AssemblyFileVersion("2.6.0.0")]
Loading

0 comments on commit ed6b699

Please sign in to comment.