Skip to content

Commit 319235b

Browse files
authored
Merge pull request #34 from Nexus-Mods/19532-manual-install
Skip invisible steps in preset installation
2 parents dbfc28e + f2f13ef commit 319235b

4 files changed

Lines changed: 79 additions & 0 deletions

File tree

src/InstallScripting/XmlScript/XmlScriptExecutor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,16 @@ public async override Task<IList<Instruction>> DoExecute(IScript scpScript, stri
119119
if (m_Preset.HasValue)
120120
{
121121
// Preselect options for every step according to the preset (or recommended/default rules).
122+
// Skip invisible steps just like manual mode does - this ensures we don't select options
123+
// from steps that shouldn't be shown based on current conditions.
122124
foreach (var step in lstSteps)
123125
{
126+
if (step.VisibilityCondition != null &&
127+
!step.VisibilityCondition.GetIsFulfilled(m_csmState, m_Delegates))
128+
{
129+
continue;
130+
}
131+
124132
preselectOptions(step);
125133
// Ensure required/not-usable flags are applied after preselection.
126134
fixSelected(step);
1.98 KB
Binary file not shown.

test/TestData/Shared/fomod-compliance.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,76 @@
3333
{ "type": "copy", "source": "shared\\folder_zzz\\test_alphabetical.txt", "destination": "test_alphabetical.txt", "priority": 0 },
3434
{ "type": "enableallplugins", "priority": 0 }
3535
]
36+
},
37+
{
38+
"name": "Invisible Step - Preset mode should skip invisible steps (Option A selected)",
39+
"mod": "Invisible Step Test",
40+
"archiveFile": "InvisibleStepTest.zip",
41+
"pluginPath": "Data",
42+
"appVersion": "1.0.0",
43+
"gameVersion": "1.0.0",
44+
"extenderVersion": "1.0.0",
45+
"installedPlugins": [],
46+
"preset": [
47+
{
48+
"name": "Step1",
49+
"groups": [
50+
{
51+
"name": "Group1",
52+
"choices": [
53+
{ "name": "Option A (hides Step 2)", "idx": 0 }
54+
]
55+
}
56+
]
57+
}
58+
],
59+
"validate": true,
60+
"expectedMessage": "Installation successful",
61+
"expectedInstructions": [
62+
{ "type": "copy", "source": "visible_step\\visible_file.txt", "destination": "visible_file.txt", "priority": 0 },
63+
{ "type": "enableallplugins", "priority": 0 }
64+
]
65+
},
66+
{
67+
"name": "Invisible Step - Preset mode should process visible steps (Option B selected)",
68+
"mod": "Invisible Step Test",
69+
"archiveFile": "InvisibleStepTest.zip",
70+
"pluginPath": "Data",
71+
"appVersion": "1.0.0",
72+
"gameVersion": "1.0.0",
73+
"extenderVersion": "1.0.0",
74+
"installedPlugins": [],
75+
"preset": [
76+
{
77+
"name": "Step1",
78+
"groups": [
79+
{
80+
"name": "Group1",
81+
"choices": [
82+
{ "name": "Option B (shows Step 2)", "idx": 1 }
83+
]
84+
}
85+
]
86+
},
87+
{
88+
"name": "Step2",
89+
"groups": [
90+
{
91+
"name": "InvisibleGroup",
92+
"choices": [
93+
{ "name": "Invisible Option", "idx": 0 }
94+
]
95+
}
96+
]
97+
}
98+
],
99+
"validate": true,
100+
"expectedMessage": "Installation successful",
101+
"expectedInstructions": [
102+
{ "type": "copy", "source": "visible_step\\visible_file.txt", "destination": "visible_file.txt", "priority": 0 },
103+
{ "type": "copy", "source": "invisible_step\\should_not_install.txt", "destination": "should_not_install.txt", "priority": 0 },
104+
{ "type": "enableallplugins", "priority": 0 }
105+
]
36106
}
37107
]
38108
}

test/TestData/TestData.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<EmbeddedResource Include="Data\Skyrim\Spell Perk Item Distributor-36869-7-1-3-1713397024.7z" />
1717
<EmbeddedResource Include="Data\Skyrim\XP32 Maximum Skeleton Special Extended-1988-5-06-1707663131.7z" />
1818
<EmbeddedResource Include="Data\FomodComplianceTests.zip" />
19+
<EmbeddedResource Include="Data\InvisibleStepTest.zip" />
1920
<EmbeddedResource Include="Data\CSharpTestCase.zip" />
2021
</ItemGroup>
2122

0 commit comments

Comments
 (0)