GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improved type checks. · ReClassNET/ReClass.NET@a55ebc4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • ReClass.NET/Nodes
    • BaseContainerNode.cs
    • BaseWrapperArrayNode.cs
    • ClassNode.cs
    • PointerNode.cs
    • VTableNode.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ReClass.NET/Nodes/BaseContainerNode.cs‎

Copy file name to clipboardExpand all lines: ReClass.NET/Nodes/BaseContainerNode.cs
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics.Contracts;
44
using ReClassNET.Extensions;
@@ -18,6 +18,13 @@ private void ObjectInvariants()
1818
/// <summary>The child nodes of the node.</summary>
1919
public IEnumerable<BaseNode> Nodes => nodes;
2020

21+
/// <summary>
22+
/// Should be called before adding a child to test if the container can handle the node type.
23+
/// </summary>
24+
/// <param name="node">The new child node.</param>
25+
/// <returns>True if the container can handle the child node or false otherwise.</returns>
26+
public abstract bool CanHandleChildNode(BaseNode node);
27+
2128
/// <summary>Calculates the offset of every child node.</summary>
2229
public void UpdateOffsets()
2330
{
Collapse file

‎ReClass.NET/Nodes/BaseWrapperArrayNode.cs‎

Copy file name to clipboardExpand all lines: ReClass.NET/Nodes/BaseWrapperArrayNode.cs
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ public abstract class BaseWrapperArrayNode : BaseWrapperNode
1616

1717
public override bool CanChangeInnerNodeTo(BaseNode node)
1818
{
19-
// A null node (aka void) is not allowed for instances.
19+
switch (node)
20+
{
21+
case null:
22+
case ClassNode _:
23+
case VMethodNode _:
24+
return false;
25+
}
2026

21-
return node != null;
27+
return true;
2228
}
2329

2430
protected Size Draw(ViewInfo view, int x, int y, string type)
Collapse file

‎ReClass.NET/Nodes/ClassNode.cs‎

Copy file name to clipboardExpand all lines: ReClass.NET/Nodes/ClassNode.cs
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ public override void GetUserInterfaceInfo(out string name, out Image icon)
7979
throw new InvalidOperationException($"The '{nameof(ClassNode)}' node should not be accessible from the ui.");
8080
}
8181

82+
public override bool CanHandleChildNode(BaseNode node)
83+
{
84+
switch (node)
85+
{
86+
case null:
87+
case ClassNode _:
88+
case VMethodNode _:
89+
return false;
90+
}
91+
92+
return true;
93+
}
94+
8295
public override void Intialize()
8396
{
8497
AddBytes(IntPtr.Size);
Collapse file

‎ReClass.NET/Nodes/PointerNode.cs‎

Copy file name to clipboardExpand all lines: ReClass.NET/Nodes/PointerNode.cs
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ public override void GetUserInterfaceInfo(out string name, out Image icon)
2626

2727
public override bool CanChangeInnerNodeTo(BaseNode node)
2828
{
29+
switch (node)
30+
{
31+
case ClassNode _:
32+
case VMethodNode _:
33+
return false;
34+
}
35+
2936
return true;
3037
}
3138

Collapse file

‎ReClass.NET/Nodes/VTableNode.cs‎

Copy file name to clipboardExpand all lines: ReClass.NET/Nodes/VTableNode.cs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public override void GetUserInterfaceInfo(out string name, out Image icon)
1919
icon = Properties.Resources.B16x16_Button_VTable;
2020
}
2121

22+
public override bool CanHandleChildNode(BaseNode node)
23+
{
24+
return node is VMethodNode;
25+
}
26+
2227
public override void Intialize()
2328
{
2429
AddBytes(10 * IntPtr.Size);

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.