Skip to content

Commit 76a62bd

Browse files
Fixed: Vanilla-file context items didn't actually work in merge tree.
1 parent bf4a5fc commit 76a62bd

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

WitcherScriptMerger/Controls/SMTree.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,14 @@ void InitializeContextMenu()
309309
_contextOpenVanillaFile.Size = new Size(225, 22);
310310
_contextOpenVanillaFile.Text = "Open Vanilla File";
311311
_contextOpenVanillaFile.ToolTipText = "Opens the unmodded version of the file";
312-
_contextOpenVanillaFile.Click += ContextOpenFile_Click;
312+
_contextOpenVanillaFile.Click += ContextOpenVanillaFile_Click;
313313

314314
// contextOpenVanillaFileDir
315315
_contextOpenVanillaFileDir.Name = "contextOpenVanillaFileDir";
316316
_contextOpenVanillaFileDir.Size = new Size(225, 22);
317317
_contextOpenVanillaFileDir.Text = "Open Vanilla File Directory";
318318
_contextOpenVanillaFileDir.ToolTipText = "Opens the location of the unmodded version of the file";
319-
_contextOpenVanillaFileDir.Click += ContextOpenDirectory_Click;
319+
_contextOpenVanillaFileDir.Click += ContextOpenVanillaDirectory_Click;
320320

321321
// contextCopyPath
322322
_contextCopyPath.Name = "contextCopyPath";
@@ -377,7 +377,7 @@ protected virtual void SetContextItemAvailability()
377377
_contextCopyPath.Available = true;
378378
if (IsFileNode(ClickedNode)
379379
&& !((ModFileCategory)ClickedNode.Parent.Tag).IsBundled
380-
&& File.Exists((ClickedNode.Tag as NodeMetadata).FilePath))
380+
&& File.Exists((ClickedNode.Tag as NodeMetadata).ModFile.GetVanillaFile()))
381381
{
382382
_contextOpenVanillaFile.Available = true;
383383
_contextOpenVanillaFileDir.Available = true;
@@ -438,6 +438,26 @@ protected void ContextOpenDirectory_Click(object sender, EventArgs e)
438438
RightClickedNode = null;
439439
}
440440

441+
protected void ContextOpenVanillaFile_Click(object sender, EventArgs e)
442+
{
443+
if (RightClickedNode == null)
444+
return;
445+
446+
Program.TryOpenFile(RightClickedNode.GetMetadata().ModFile.GetVanillaFile());
447+
448+
RightClickedNode = null;
449+
}
450+
451+
protected void ContextOpenVanillaDirectory_Click(object sender, EventArgs e)
452+
{
453+
if (RightClickedNode == null)
454+
return;
455+
456+
Program.TryOpenFileLocation(RightClickedNode.GetMetadata().ModFile.GetVanillaFile());
457+
458+
RightClickedNode = null;
459+
}
460+
441461
void ContextCopyPath_Click(object sender, EventArgs e)
442462
{
443463
if (RightClickedNode == null)

0 commit comments

Comments
 (0)