mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 15:27:51 +01:00
Add Filesystem Compression as a toggle and button. Also some auto-formatting.
This commit is contained in:
parent
e26873934b
commit
4e704770cb
21 changed files with 385 additions and 344 deletions
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using OtterGui;
|
||||
using OtterGui.Compression;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Files;
|
||||
using Penumbra.Mods.Editor;
|
||||
|
|
@ -26,10 +27,10 @@ public partial class MdlMaterialEditor
|
|||
public MdlMaterialEditor(ModFileCollection files)
|
||||
=> _files = files;
|
||||
|
||||
public void SaveAllModels()
|
||||
public void SaveAllModels(FileCompactor compactor)
|
||||
{
|
||||
foreach (var info in _modelFiles)
|
||||
info.Save();
|
||||
info.Save(compactor);
|
||||
}
|
||||
|
||||
public void RestoreAllModels()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using OtterGui;
|
||||
using Penumbra.Mods.Editor;
|
||||
using OtterGui.Compression;
|
||||
using Penumbra.Mods.Subclasses;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
namespace Penumbra.Mods.Editor;
|
||||
|
||||
public class ModEditor : IDisposable
|
||||
{
|
||||
|
|
@ -15,6 +15,7 @@ public class ModEditor : IDisposable
|
|||
public readonly ModFileCollection Files;
|
||||
public readonly ModSwapEditor SwapEditor;
|
||||
public readonly MdlMaterialEditor MdlMaterialEditor;
|
||||
public readonly FileCompactor Compactor;
|
||||
|
||||
public Mod? Mod { get; private set; }
|
||||
public int GroupIdx { get; private set; }
|
||||
|
|
@ -24,7 +25,8 @@ public class ModEditor : IDisposable
|
|||
public ISubMod? Option { get; private set; }
|
||||
|
||||
public ModEditor(ModNormalizer modNormalizer, ModMetaEditor metaEditor, ModFileCollection files,
|
||||
ModFileEditor fileEditor, DuplicateManager duplicates, ModSwapEditor swapEditor, MdlMaterialEditor mdlMaterialEditor)
|
||||
ModFileEditor fileEditor, DuplicateManager duplicates, ModSwapEditor swapEditor, MdlMaterialEditor mdlMaterialEditor,
|
||||
FileCompactor compactor)
|
||||
{
|
||||
ModNormalizer = modNormalizer;
|
||||
MetaEditor = metaEditor;
|
||||
|
|
@ -33,6 +35,7 @@ public class ModEditor : IDisposable
|
|||
Duplicates = duplicates;
|
||||
SwapEditor = swapEditor;
|
||||
MdlMaterialEditor = mdlMaterialEditor;
|
||||
Compactor = compactor;
|
||||
}
|
||||
|
||||
public void LoadMod(Mod mod)
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OtterGui;
|
||||
using OtterGui.Compression;
|
||||
using Penumbra.GameData.Files;
|
||||
using Penumbra.String.Classes;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
namespace Penumbra.Mods.Editor;
|
||||
|
||||
/// <summary> A class that collects information about skin materials in a model file and handle changes on them. </summary>
|
||||
public class ModelMaterialInfo
|
||||
|
|
@ -40,7 +41,7 @@ public class ModelMaterialInfo
|
|||
}
|
||||
|
||||
// Save a changed .mdl file.
|
||||
public void Save()
|
||||
public void Save(FileCompactor compactor)
|
||||
{
|
||||
if (!Changed)
|
||||
return;
|
||||
|
|
@ -50,7 +51,7 @@ public class ModelMaterialInfo
|
|||
|
||||
try
|
||||
{
|
||||
System.IO.File.WriteAllBytes(Path.FullName, File.Write());
|
||||
compactor.WriteAllBytes(Path.FullName, File.Write());
|
||||
Changed = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ public class ItemSwapContainer
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
if( writeType == WriteType.UseSwaps && file.SwapToModdedExistsInGame && !file.DataWasChanged )
|
||||
{
|
||||
convertedSwaps.TryAdd( file.SwapFromRequestPath, file.SwapToModded );
|
||||
|
|
@ -73,7 +72,7 @@ public class ItemSwapContainer
|
|||
var path = file.GetNewPath( directory.FullName );
|
||||
var bytes = file.FileData.Write();
|
||||
Directory.CreateDirectory( Path.GetDirectoryName( path )! );
|
||||
File.WriteAllBytes( path, bytes );
|
||||
_manager.Compactor.WriteAllBytes( path, bytes );
|
||||
convertedFiles.TryAdd( file.SwapFromRequestPath, new FullPath( path ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Penumbra.Import;
|
||||
using Penumbra.Mods.Editor;
|
||||
|
||||
namespace Penumbra.Mods.Manager;
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ public class ModImportManager : IDisposable
|
|||
if (files.Length == 0)
|
||||
return;
|
||||
|
||||
_import = new TexToolsImporter(files.Length, files, AddNewMod, _config, _modEditor, _modManager);
|
||||
_import = new TexToolsImporter(files.Length, files, AddNewMod, _config, _modEditor, _modManager, _modEditor.Compactor);
|
||||
}
|
||||
|
||||
public bool Importing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue