diff --git a/PCK-Studio/PckNodeSorter.cs b/PCK-Studio/Internal/PckNodeSorter.cs similarity index 76% rename from PCK-Studio/PckNodeSorter.cs rename to PCK-Studio/Internal/PckNodeSorter.cs index b554bf86..55d419f1 100644 --- a/PCK-Studio/PckNodeSorter.cs +++ b/PCK-Studio/Internal/PckNodeSorter.cs @@ -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 { + 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); } - } + } } \ No newline at end of file diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 77455a9b..73092839 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -439,7 +439,7 @@ TextureConverterUtility.cs - + Form