mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-20 07:34:25 +01:00
Apply meta manipulation and load the corresponding files when encountering meta files.
This commit is contained in:
parent
739627b7c2
commit
db5ce7a2e4
5 changed files with 234 additions and 3 deletions
|
|
@ -1,6 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin;
|
||||
using Penumbra.Importer;
|
||||
using Penumbra.Models;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
@ -19,16 +22,32 @@ namespace Penumbra.Mods
|
|||
public DirectoryInfo ModBasePath { get; set; }
|
||||
|
||||
public List< FileInfo > ModFiles { get; } = new();
|
||||
public Dictionary< FileInfo, TexToolsMeta > MetaManipulations { get; } = new();
|
||||
|
||||
public Dictionary< string, List< GamePath > > FileConflicts { get; } = new();
|
||||
|
||||
|
||||
public void RefreshModFiles()
|
||||
{
|
||||
FileConflicts.Clear();
|
||||
ModFiles.Clear();
|
||||
MetaManipulations.Clear();
|
||||
// we don't care about any _files_ in the root dir, but any folders should be a game folder/file combo
|
||||
foreach( var file in ModBasePath.EnumerateDirectories()
|
||||
.SelectMany( dir => dir.EnumerateFiles( "*.*", SearchOption.AllDirectories ) ) )
|
||||
{
|
||||
if( file.Extension == ".meta" )
|
||||
{
|
||||
try
|
||||
{
|
||||
MetaManipulations[ file ] = new TexToolsMeta( File.ReadAllBytes( file.FullName ) );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Could not parse meta file {file.FullName}:\n{e}" );
|
||||
}
|
||||
}
|
||||
|
||||
ModFiles.Add( file );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue