Skip to content

Commit 32d8ef6

Browse files
committed
Added additional Lumina safeguards.
1 parent 3cd821b commit 32d8ef6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

xivModdingFramework/Mods/Modding.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ public async Task<XivModStatus> IsModEnabled(string internalPath, bool indexChec
276276
/// <param name="enable">The status of the mod</param>
277277
public async Task<bool> ToggleModStatus(string internalFilePath, bool enable)
278278
{
279+
if (XivCache.GameInfo.UseLumina)
280+
{
281+
throw new Exception("TexTools mods cannot be altered in Lumina mode.");
282+
}
283+
279284
var index = new Index(_gameDirectory);
280285

281286
if (string.IsNullOrEmpty(internalFilePath))
@@ -307,6 +312,11 @@ public async Task<bool> ToggleModStatus(string internalFilePath, bool enable)
307312
/// <param name="enable">The status of the mod</param>
308313
public async Task ToggleModPackStatus(string modPackName, bool enable)
309314
{
315+
if (XivCache.GameInfo.UseLumina)
316+
{
317+
throw new Exception("TexTools mods cannot be altered in Lumina mode.");
318+
}
319+
310320
var index = new Index(_gameDirectory);
311321

312322
var modList = GetModList();
@@ -348,6 +358,11 @@ public async Task ToggleModPackStatus(string modPackName, bool enable)
348358
/// <returns></returns>
349359
public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeInternal, bool updateCache, IndexFile cachedIndex = null, ModList cachedModlist = null)
350360
{
361+
if (XivCache.GameInfo.UseLumina)
362+
{
363+
throw new Exception("TexTools mods cannot be altered in Lumina mode.");
364+
}
365+
351366
if (mod == null) return false;
352367
if (string.IsNullOrEmpty(mod.name)) return false;
353368
if (string.IsNullOrEmpty(mod.fullPath)) return false;
@@ -446,12 +461,21 @@ public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeIntern
446461
/// <param name="enable">The status to switch the mods to True if enable False if disable</param>
447462
public async Task ToggleAllMods(bool enable, IProgress<(int current, int total, string message)> progress = null)
448463
{
464+
if(XivCache.GameInfo.UseLumina)
465+
{
466+
throw new Exception("TexTools mods cannot be toggled in Lumina mode.");
467+
}
449468
var modList = await GetModListAsync();
450469
await ToggleMods(enable, modList.Mods.Select(x => x.fullPath), progress);
451470
}
452471

453472
public async Task ToggleMods(bool enable, IEnumerable<string> filePaths, IProgress<(int current, int total, string message)> progress = null)
454473
{
474+
if (XivCache.GameInfo.UseLumina)
475+
{
476+
throw new Exception("TexTools mods cannot be toggled in Lumina mode.");
477+
}
478+
455479
var _index = new Index(_gameDirectory);
456480

457481
var modList = await GetModListAsync();
@@ -625,6 +649,11 @@ public async Task<int> PurgeInvalidEmptyBlocks()
625649
/// <param name="modItemPath">The mod item path of the mod to delete</param>
626650
public async Task DeleteMod(string modItemPath, bool allowInternal = false, IndexFile index = null, ModList modList = null)
627651
{
652+
if (XivCache.GameInfo.UseLumina)
653+
{
654+
throw new Exception("TexTools mods cannot be altered in Lumina mode.");
655+
}
656+
628657
var doSave = false;
629658
var _index = new Index(_gameDirectory);
630659
if (modList == null)
@@ -676,6 +705,11 @@ where mod.fullPath.Equals(modItemPath)
676705
/// <param name="modPackName">The name of the Mod Pack to be deleted</param>
677706
public async Task DeleteModPack(string modPackName)
678707
{
708+
if (XivCache.GameInfo.UseLumina)
709+
{
710+
throw new Exception("TexTools mods cannot be altered in Lumina mode.");
711+
}
712+
679713
var modList = GetModList();
680714

681715
var modPackItem = (from modPack in modList.ModPacks
@@ -716,6 +750,11 @@ where modPack.name.Equals(modPackName)
716750
/// <returns></returns>
717751
public async Task CleanUpModlist(IProgress<(int Current, int Total, string Message)> progressReporter = null)
718752
{
753+
if (XivCache.GameInfo.UseLumina)
754+
{
755+
throw new Exception("TexTools mods cannot be altered in Lumina mode.");
756+
}
757+
719758
progressReporter?.Report((0, 0, "Loading Modlist file..."));
720759
var modlist = await GetModListAsync();
721760

@@ -902,6 +941,11 @@ public async Task<long> GetTotalModDataSize()
902941
/// <returns></returns>
903942
public async Task<long> DefragmentModdedDats(IProgress<(int Current, int Total, string Message)> progressReporter = null)
904943
{
944+
if (XivCache.GameInfo.UseLumina)
945+
{
946+
throw new Exception("TexTools mods cannot be altered in Lumina mode.");
947+
}
948+
905949
var modlist = await GetModListAsync();
906950
var _dat = new Dat(XivCache.GameInfo.GameDirectory);
907951
var _index = new Index(XivCache.GameInfo.GameDirectory);

0 commit comments

Comments
 (0)