mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-31 21:03:48 +01:00
Add unsolved conflicts to both mods, add button to auto-generate groups based on folders, misc. fixes.
This commit is contained in:
parent
795d605d3f
commit
4a82e6faf1
7 changed files with 102 additions and 12 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
|
|
@ -478,5 +479,46 @@ namespace Penumbra.Mod
|
|||
RemoveUselessGroups( meta );
|
||||
ClearEmptySubDirectories( baseDir );
|
||||
}
|
||||
|
||||
public static void AutoGenerateGroups( DirectoryInfo baseDir, ModMeta meta )
|
||||
{
|
||||
meta.Groups.Clear();
|
||||
ClearEmptySubDirectories( baseDir );
|
||||
foreach( var groupDir in baseDir.EnumerateDirectories() )
|
||||
{
|
||||
var group = new OptionGroup
|
||||
{
|
||||
GroupName = groupDir.Name,
|
||||
SelectionType = SelectType.Single,
|
||||
Options = new List< Option >(),
|
||||
};
|
||||
|
||||
foreach( var optionDir in groupDir.EnumerateDirectories() )
|
||||
{
|
||||
var option = new Option
|
||||
{
|
||||
OptionDesc = string.Empty,
|
||||
OptionName = optionDir.Name,
|
||||
OptionFiles = new Dictionary< RelPath, HashSet< GamePath > >(),
|
||||
};
|
||||
foreach( var file in optionDir.EnumerateFiles( "*.*", SearchOption.AllDirectories ) )
|
||||
{
|
||||
var relPath = new RelPath( file, baseDir );
|
||||
var gamePath = new GamePath( file, optionDir );
|
||||
option.OptionFiles[ relPath ] = new HashSet< GamePath > { gamePath };
|
||||
}
|
||||
|
||||
if( option.OptionFiles.Any() )
|
||||
{
|
||||
group.Options.Add( option );
|
||||
}
|
||||
}
|
||||
|
||||
if( group.Options.Any() )
|
||||
{
|
||||
meta.Groups.Add( groupDir.Name, @group );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue