mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-07 09:06:04 +00:00
Moved PckNodeSorter to 'Internal' folder
This commit is contained in:
@@ -1,37 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
public class PckNodeSorter : IComparer, IComparer<TreeNode>
|
||||
{
|
||||
public object SortingOptions { get; set; } = null;
|
||||
public bool Descending { get; set; } = false;
|
||||
|
||||
private bool CheckForSkinAndCapeFiles(TreeNode node)
|
||||
{
|
||||
if (node.TryGetTagData(out PckFile.FileData file))
|
||||
return file.Filetype == PckFile.FileData.FileType.SkinFile || file.Filetype == PckFile.FileData.FileType.CapeFile;
|
||||
return false;
|
||||
return node.TryGetTagData(out PckFile.FileData file) &&
|
||||
(file.Filetype == PckFile.FileData.FileType.SkinFile || file.Filetype == PckFile.FileData.FileType.CapeFile);
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
{
|
||||
TreeNode tx = x as TreeNode;
|
||||
TreeNode ty = y as TreeNode;
|
||||
return Compare(tx, ty);
|
||||
}
|
||||
|
||||
public int Compare(TreeNode x, TreeNode y)
|
||||
{
|
||||
{
|
||||
int result = InternalCompare(x, y);
|
||||
Debug.WriteLine(result);
|
||||
if (Descending && result != 0)
|
||||
{
|
||||
result = 2 % result + 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -43,12 +45,12 @@ namespace PckStudio
|
||||
return 1;
|
||||
|
||||
if (CheckForSkinAndCapeFiles(first))
|
||||
return -1;
|
||||
return 1;
|
||||
if (CheckForSkinAndCapeFiles(second))
|
||||
return 1;
|
||||
|
||||
return first.Text.CompareTo(second.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -439,7 +439,7 @@
|
||||
<Compile Include="Forms\Utilities\TextureConverterUtility.Designer.cs">
|
||||
<DependentUpon>TextureConverterUtility.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PckNodeSorter.cs" />
|
||||
<Compile Include="Internal\PckNodeSorter.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Forms\CreditsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
Reference in New Issue
Block a user