<commit_before>﻿using System;
using System.Drawing;
using ReClassNET.Memory;
using ReClassNET.UI;

namespace ReClassNET.Nodes
{
	public class PointerNode : BaseWrapperNode
	{
		private readonly MemoryBuffer memory = new MemoryBuffer();

		public override int MemorySize => IntPtr.Size;

		protected override bool PerformCycleCheck => false;

		public PointerNode()
		{
			LevelsOpen.DefaultValue = true;
		}

		public override void GetUserInterfaceInfo(out string name, out Image icon)
		{
			name = "Pointer";
			icon = Properties.Resources.B16x16_Button_Pointer;
		}

		public override bool CanChangeInnerNodeTo(BaseNode node)
		{
			switch (node)
			{
				case ClassNode _:
				case VirtualMethodNode _:
					return false;
			}

			return true;
		}

		public override Size Draw(ViewInfo view, int x, int y)
		{<commit_msg>Added support for the memory preview tooltip.<commit_after>﻿using System;
using System.Drawing;
using ReClassNET.Memory;
using ReClassNET.UI;

namespace ReClassNET.Nodes
{
	public class PointerNode : BaseWrapperNode
	{
		private readonly MemoryBuffer memory = new MemoryBuffer();

		public override int MemorySize => IntPtr.Size;

		protected override bool PerformCycleCheck => false;

		public PointerNode()
		{
			LevelsOpen.DefaultValue = true;
		}

		public override void GetUserInterfaceInfo(out string name, out Image icon)
		{
			name = "Pointer";
			icon = Properties.Resources.B16x16_Button_Pointer;
		}

		public override bool UseMemoryPreviewToolTip(HotSpot spot, MemoryBuffer memory, out IntPtr address)
		{
			// TODO Should the preview be disabled if an inner node is set?

			address = memory.ReadIntPtr(Offset);

			return memory.Process?.GetNamedAddress(address) != null;
		}

		public override bool CanChangeInnerNodeTo(BaseNode node)
		{
			switch (node)
			{
				case ClassNode _:
				case VirtualMethodNode _:
					return false;
			}

			return true;
		}

		public override Size Draw(ViewInfo view, int x, int y)
		{
{'fraction_non_alphanumeric': 0.07594291539245668, 'fraction_numerical': 0.004077471967380225, 'mean_word_length': 3.870967741935484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5606704', 'n_tokens_mistral': 679, 'n_tokens_neox': 569, 'n_words': 175}