Skip to content

Commit 66afd7d

Browse files
attept further simplification
1 parent 8810c7d commit 66afd7d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ProtectionScan/Features/MainFeature.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,14 @@ private void WriteProtectionResultJson(string path, Dictionary<string, List<stri
292292
for (int i = 0; i < modifyNodeList.Count; i++)
293293
{
294294
string part = modifyNodeList[i].Item2;
295-
string[] nodeProtections = modifyNodeList[i].Item3;
296-
var copyDictionary = new Dictionary<string, object>((Dictionary<string, object>)modifyNodeList[i].Item1[part]);
297-
modifyNodeList[i].Item1[part] = new List<object>();
298-
List<object> modifyNode = (List<object>)modifyNodeList[i].Item1[part];
299-
modifyNode.Add(nodeProtections);
300-
modifyNode.Add(copyDictionary);
295+
var modifyNode = modifyNodeList[i].Item1[part];
296+
var copyDictionary = new Dictionary<string, object>((Dictionary<string, object>)modifyNode);
297+
modifyNode = new List<object>();
298+
if (modifyNode is List<object> modifyThisNode)
299+
{
300+
modifyThisNode.Add(modifyNodeList[i].Item3);
301+
modifyThisNode.Add(copyDictionary);
302+
}
301303
}
302304

303305
// Move nested dictionary into final dictionary with the base path as a key.

0 commit comments

Comments
 (0)