Skip to content

Commit 1253581

Browse files
committed
Block DT upgrades in invalid state.
1 parent 3804f14 commit 1253581

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

xivModdingFramework/Mods/EndwalkerUpgrade.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ public struct UpgradeInfo
5555

5656
private const string _SampleHair = "chara/human/c0801/obj/hair/h0115/material/v0001/mt_c0801h0115_hir_a.mtrl";
5757

58+
public static async Task AssertIsDawntrail(ModTransaction tx = null)
59+
{
60+
if(tx == null)
61+
{
62+
tx = ModTransaction.BeginReadonlyTransaction();
63+
}
64+
65+
if(!await tx.FileExists(Eqp.DawntrailTestFile, true))
66+
{
67+
throw new InvalidDataException("The currently set FFXIV Directory is not a Dawntrail install.");
68+
}
69+
}
70+
5871
/// <summary>
5972
/// Performs Endwalker => Dawntrail Upgrades on an arbitrary set of internal files as part of a transaction.
6073
/// This is used primarily during Modpack installs.
@@ -69,6 +82,7 @@ public struct UpgradeInfo
6982
/// <returns></returns>
7083
public static async Task<Dictionary<string, UpgradeInfo>> UpdateEndwalkerFiles(IEnumerable<string> paths, string sourceApplication, bool includePartials = true, IProgress<(int current, int total, string message)> progress = null, ModTransaction tx = null)
7184
{
85+
await AssertIsDawntrail();
7286
var filePaths = new HashSet<string>(paths);
7387
var ret = new Dictionary<string, UpgradeInfo>();
7488

@@ -136,6 +150,7 @@ public static async Task<Dictionary<string, UpgradeInfo>> UpdateEndwalkerFiles(I
136150
/// <returns></returns>
137151
public static async Task<Dictionary<string, UpgradeInfo>> UpdateEndwalkerFiles(Dictionary<string, FileStorageInformation> files, IProgress<(int current, int total, string message)> progress = null)
138152
{
153+
await AssertIsDawntrail();
139154
var ret = new Dictionary<string, UpgradeInfo>();
140155

141156
HashSet<string> _ConvertedTextures = new HashSet<string>();

0 commit comments

Comments
 (0)