mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-22 07:47:48 +01:00
temp
This commit is contained in:
parent
33db156544
commit
8db54ef4f4
17 changed files with 546 additions and 212 deletions
|
|
@ -3,7 +3,7 @@ using System.IO;
|
|||
using Dalamud.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Penumbra.Util;
|
||||
using OtterGui;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
|
|
|
|||
39
Penumbra/Mods/ModFileSystemA.cs
Normal file
39
Penumbra/Mods/ModFileSystemA.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System.IO;
|
||||
using OtterGui.Filesystem;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
public sealed class ModFileSystemA : FileSystem< Mod >
|
||||
{
|
||||
public void Save()
|
||||
=> SaveToFile( new FileInfo( Mod.Manager.SortOrderFile ), SaveMod, true );
|
||||
|
||||
public static ModFileSystemA Load()
|
||||
{
|
||||
var x = new ModFileSystemA();
|
||||
if( x.Load( new FileInfo( Mod.Manager.SortOrderFile ), Penumbra.ModManager.Mods, ModToIdentifier, ModToName ) )
|
||||
{
|
||||
x.Save();
|
||||
}
|
||||
|
||||
x.Changed += ( _1, _2, _3, _4 ) => x.Save();
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
private static string ModToIdentifier( Mod mod )
|
||||
=> mod.BasePath.Name;
|
||||
|
||||
private static string ModToName( Mod mod )
|
||||
=> mod.Meta.Name.Text;
|
||||
|
||||
private static (string, bool) SaveMod( Mod mod, string fullPath )
|
||||
{
|
||||
if( fullPath == ModToName( mod ) )
|
||||
{
|
||||
return ( string.Empty, false );
|
||||
}
|
||||
|
||||
return ( ModToIdentifier( mod ), true );
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using Dalamud.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue