mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-20 07:34:25 +01:00
Add date sort methods.
This commit is contained in:
parent
c975336e65
commit
ec91755065
9 changed files with 185 additions and 22 deletions
|
|
@ -27,6 +27,7 @@ public partial class Configuration
|
|||
public Dictionary< string, string > ModSortOrder = new();
|
||||
public bool InvertModListOrder;
|
||||
public bool SortFoldersFirst;
|
||||
public SortModeV3 SortMode = SortModeV3.FoldersFirst;
|
||||
|
||||
public static void Migrate( Configuration config )
|
||||
{
|
||||
|
|
@ -45,6 +46,31 @@ public partial class Configuration
|
|||
m.Version0To1();
|
||||
m.Version1To2();
|
||||
m.Version2To3();
|
||||
m.Version3To4();
|
||||
}
|
||||
|
||||
// SortMode was changed from an enum to a type.
|
||||
private void Version3To4()
|
||||
{
|
||||
if( _config.Version != 3 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SortMode = _data[ nameof( SortMode ) ]?.ToObject< SortModeV3 >() ?? SortMode;
|
||||
_config.SortMode = SortMode switch
|
||||
{
|
||||
SortModeV3.FoldersFirst => ISortMode< Mod >.FoldersFirst,
|
||||
SortModeV3.Lexicographical => ISortMode< Mod >.Lexicographical,
|
||||
SortModeV3.InverseFoldersFirst => ISortMode< Mod >.InverseFoldersFirst,
|
||||
SortModeV3.InverseLexicographical => ISortMode< Mod >.InverseLexicographical,
|
||||
SortModeV3.FoldersLast => ISortMode< Mod >.FoldersLast,
|
||||
SortModeV3.InverseFoldersLast => ISortMode< Mod >.InverseFoldersLast,
|
||||
SortModeV3.InternalOrder => ISortMode< Mod >.InternalOrder,
|
||||
SortModeV3.InternalOrderInverse => ISortMode< Mod >.InverseInternalOrder,
|
||||
_ => ISortMode< Mod >.FoldersFirst,
|
||||
};
|
||||
_config.Version = 4;
|
||||
}
|
||||
|
||||
// SortFoldersFirst was changed from a bool to the enum SortMode.
|
||||
|
|
@ -56,7 +82,7 @@ public partial class Configuration
|
|||
}
|
||||
|
||||
SortFoldersFirst = _data[ nameof( SortFoldersFirst ) ]?.ToObject< bool >() ?? false;
|
||||
_config.SortMode = SortFoldersFirst ? SortMode.FoldersFirst : SortMode.Lexicographical;
|
||||
SortMode = SortFoldersFirst ? SortModeV3.FoldersFirst : SortModeV3.Lexicographical;
|
||||
_config.Version = 3;
|
||||
}
|
||||
|
||||
|
|
@ -242,5 +268,17 @@ public partial class Configuration
|
|||
PluginLog.Error( $"Could not create backup copy of config at {bakName}:\n{e}" );
|
||||
}
|
||||
}
|
||||
|
||||
public enum SortModeV3 : byte
|
||||
{
|
||||
FoldersFirst = 0x00,
|
||||
Lexicographical = 0x01,
|
||||
InverseFoldersFirst = 0x02,
|
||||
InverseLexicographical = 0x03,
|
||||
FoldersLast = 0x04,
|
||||
InverseFoldersLast = 0x05,
|
||||
InternalOrder = 0x06,
|
||||
InternalOrderInverse = 0x07,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue