mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-24 01:19:22 +01:00
mod reordering, deleting, conflict resolution, some other fixes
This commit is contained in:
parent
fbb39a8626
commit
7f1fd95a78
10 changed files with 605 additions and 203 deletions
54
Penumbra/Mods/ResourceMod.cs
Normal file
54
Penumbra/Mods/ResourceMod.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Dalamud.Plugin;
|
||||
using Penumbra.Models;
|
||||
|
||||
namespace Penumbra.Mods
|
||||
{
|
||||
public class ResourceMod
|
||||
{
|
||||
public ModMeta Meta { get; set; }
|
||||
|
||||
public DirectoryInfo ModBasePath { get; set; }
|
||||
|
||||
public List< FileInfo > ModFiles { get; } = new();
|
||||
|
||||
public Dictionary< string, List< string > > FileConflicts { get; set; } = new();
|
||||
|
||||
public void RefreshModFiles()
|
||||
{
|
||||
if( ModBasePath == null )
|
||||
{
|
||||
PluginLog.LogError( "no basepath has been set on {ResourceModName}", Meta.Name );
|
||||
return;
|
||||
}
|
||||
|
||||
// we don't care about any _files_ in the root dir, but any folders should be a game folder/file combo
|
||||
foreach( var dir in ModBasePath.EnumerateDirectories() )
|
||||
{
|
||||
foreach( var file in dir.EnumerateFiles( "*.*", SearchOption.AllDirectories ) )
|
||||
{
|
||||
ModFiles.Add( file );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddConflict( string modName, string path )
|
||||
{
|
||||
if( FileConflicts.TryGetValue( modName, out var arr ) )
|
||||
{
|
||||
if( !arr.Contains( path ) )
|
||||
{
|
||||
arr.Add( path );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
FileConflicts[ modName ] = new List< string >
|
||||
{
|
||||
path
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue