Moved PckNodeSorter to 'Internal' folder

This commit is contained in:
miku-666
2023-08-28 13:50:19 +02:00
parent 44456bbf6d
commit 945d9baf8e
2 changed files with 12 additions and 10 deletions

View File

@@ -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);
}
}
}
}

View File

@@ -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>